本文整理汇总了C++中SkRRect::isRect方法的典型用法代码示例。如果您正苦于以下问题:C++ SkRRect::isRect方法的具体用法?C++ SkRRect::isRect怎么用?C++ SkRRect::isRect使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SkRRect
的用法示例。
在下文中一共展示了SkRRect::isRect方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: drawRRect
void SkPictureRecord::drawRRect(const SkRRect& rrect, const SkPaint& paint) {
if (rrect.isRect()) {
addDraw(DRAW_RECT);
addPaint(paint);
addRect(rrect.getBounds());
} else if (rrect.isOval()) {
addDraw(DRAW_OVAL);
addPaint(paint);
addRect(rrect.getBounds());
} else {
addDraw(DRAW_RRECT);
addPaint(paint);
addRRect(rrect);
}
validate();
}
示例2: clipRRect
bool SkPictureRecord::clipRRect(const SkRRect& rrect, SkRegion::Op op, bool doAA) {
if (rrect.isRect()) {
return this->SkPictureRecord::clipRect(rrect.getBounds(), op, doAA);
}
addDraw(CLIP_RRECT);
addRRect(rrect);
addInt(ClipParams_pack(op, doAA));
recordRestoreOffsetPlaceholder(op);
validate();
if (fRecordFlags & SkPicture::kUsePathBoundsForClip_RecordingFlag) {
return this->INHERITED::clipRect(rrect.getBounds(), op, doAA);
} else {
return this->INHERITED::clipRRect(rrect, op, doAA);
}
}
示例3: Make
std::unique_ptr<GrFragmentProcessor> GrRRectEffect::Make(GrClipEdgeType edgeType,
const SkRRect& rrect,
const GrShaderCaps& caps) {
if (rrect.isRect()) {
return GrConvexPolyEffect::Make(edgeType, rrect.getBounds());
}
if (rrect.isOval()) {
return GrOvalEffect::Make(edgeType, rrect.getBounds(), caps);
}
if (rrect.isSimple()) {
if (SkRRectPriv::GetSimpleRadii(rrect).fX < kRadiusMin ||
SkRRectPriv::GetSimpleRadii(rrect).fY < kRadiusMin) {
// In this case the corners are extremely close to rectangular and we collapse the
// clip to a rectangular clip.
return GrConvexPolyEffect::Make(edgeType, rrect.getBounds());
}
if (SkRRectPriv::GetSimpleRadii(rrect).fX == SkRRectPriv::GetSimpleRadii(rrect).fY) {
return CircularRRectEffect::Make(edgeType, CircularRRectEffect::kAll_CornerFlags,
rrect);
} else {
return EllipticalRRectEffect::Make(edgeType, rrect);
}
}
if (rrect.isComplex() || rrect.isNinePatch()) {
// Check for the "tab" cases - two adjacent circular corners and two square corners.
SkScalar circularRadius = 0;
uint32_t cornerFlags = 0;
SkVector radii[4];
bool squashedRadii = false;
for (int c = 0; c < 4; ++c) {
radii[c] = rrect.radii((SkRRect::Corner)c);
SkASSERT((0 == radii[c].fX) == (0 == radii[c].fY));
if (0 == radii[c].fX) {
// The corner is square, so no need to squash or flag as circular.
continue;
}
if (radii[c].fX < kRadiusMin || radii[c].fY < kRadiusMin) {
radii[c].set(0, 0);
squashedRadii = true;
continue;
}
if (radii[c].fX != radii[c].fY) {
cornerFlags = ~0U;
break;
}
if (!cornerFlags) {
circularRadius = radii[c].fX;
cornerFlags = 1 << c;
} else {
if (radii[c].fX != circularRadius) {
cornerFlags = ~0U;
break;
}
cornerFlags |= 1 << c;
}
}
switch (cornerFlags) {
case CircularRRectEffect::kAll_CornerFlags:
// This rrect should have been caught in the simple case above. Though, it would
// be correctly handled in the fallthrough code.
SkASSERT(false);
case CircularRRectEffect::kTopLeft_CornerFlag:
case CircularRRectEffect::kTopRight_CornerFlag:
case CircularRRectEffect::kBottomRight_CornerFlag:
case CircularRRectEffect::kBottomLeft_CornerFlag:
case CircularRRectEffect::kLeft_CornerFlags:
case CircularRRectEffect::kTop_CornerFlags:
case CircularRRectEffect::kRight_CornerFlags:
case CircularRRectEffect::kBottom_CornerFlags: {
SkTCopyOnFirstWrite<SkRRect> rr(rrect);
if (squashedRadii) {
rr.writable()->setRectRadii(rrect.getBounds(), radii);
}
return CircularRRectEffect::Make(edgeType, cornerFlags, *rr);
}
case CircularRRectEffect::kNone_CornerFlags:
return GrConvexPolyEffect::Make(edgeType, rrect.getBounds());
default: {
if (squashedRadii) {
// If we got here then we squashed some but not all the radii to zero. (If all
// had been squashed cornerFlags would be 0.) The elliptical effect doesn't
// support some rounded and some square corners.
return nullptr;
}
if (rrect.isNinePatch()) {
return EllipticalRRectEffect::Make(edgeType, rrect);
}
return nullptr;
}
}
}
return nullptr;
}
示例4: flush
//.........这里部分代码省略.........
|| style.applies()
|| runPaint.getMaskFilter();
if (!scalePath) {
// Scale can be applied to CTM -- no effects.
ctm.preConcat(pathMatrix);
} else {
// Scale the outline into source space.
// Transform the path form the normalized outline to source space. This
// way the CTM will remain the same so it can be used by the effects.
SkPath* sourceOutline = tmpPath.init();
path->transform(pathMatrix, sourceOutline);
sourceOutline->setIsVolatile(true);
path = sourceOutline;
}
} else {
// Positions and outlines are in device space.
SkPoint originalOrigin = {fInitialX, fInitialY};
fInitialViewMatrix.mapPoints(&originalOrigin, 1);
SkPoint newOrigin = {x, y};
viewMatrix.mapPoints(&newOrigin, 1);
// The origin shift in device space.
SkPoint originShift = newOrigin - originalOrigin;
// Shift the original glyph location in device space to the position of the
// new blob.
ctm = SkMatrix::MakeTrans(originShift.x() + pathGlyph.fX,
originShift.y() + pathGlyph.fY);
}
// TODO: we are losing the mutability of the path here
GrShape shape(*path, paint);
target->drawShape(clip, runPaint, ctm, shape);
}
}
// then flush each subrun, if any
if (!run.fInitialized) {
continue;
}
int lastSubRun = SkTMin(run.fSubRunInfo.count(), 1 << 16) - 1;
for (int subRun = 0; subRun <= lastSubRun; subRun++) {
const Run::SubRunInfo& info = run.fSubRunInfo[subRun];
int glyphCount = info.glyphCount();
if (0 == glyphCount) {
continue;
}
bool skipClip = false;
bool submitOp = true;
SkIRect clipRect = SkIRect::MakeEmpty();
SkRect rtBounds = SkRect::MakeWH(target->width(), target->height());
SkRRect clipRRect;
GrAA aa;
// We can clip geometrically if we're not using SDFs or transformed glyphs,
// and we have an axis-aligned rectangular non-AA clip
if (!info.drawAsDistanceFields() && !info.needsTransform() &&
clip.isRRect(rtBounds, &clipRRect, &aa) &&
clipRRect.isRect() && GrAA::kNo == aa) {
skipClip = true;
// We only need to do clipping work if the subrun isn't contained by the clip
SkRect subRunBounds;
this->computeSubRunBounds(&subRunBounds, runIndex, subRun, viewMatrix, x, y,
false);
if (!clipRRect.getBounds().contains(subRunBounds)) {
// If the subrun is completely outside, don't add an op for it
if (!clipRRect.getBounds().intersects(subRunBounds)) {
submitOp = false;
}
else {
clipRRect.getBounds().round(&clipRect);
}
}
}
if (submitOp) {
auto op = this->makeOp(info, glyphCount, runIndex, subRun, viewMatrix, x, y,
clipRect, paint, filteredColor, props, distanceAdjustTable,
target);
if (op) {
if (skipClip) {
target->addDrawOp(GrNoClip(), std::move(op));
}
else {
target->addDrawOp(clip, std::move(op));
}
}
}
}
}
}