canvas->drawRect(target, borderPaint);
target.inset(SkIntToScalar(2), SkIntToScalar(2));
canvas->drawRect(target, backgroundPaint);
- canvas->clipRect(target, SkCanvas::kIntersect_Op, true);
+ canvas->clipRect(target, true);
target.inset(SkIntToScalar(-4), SkIntToScalar(-4));
canvas->drawRect(target, foregroundPaint);
canvas->restore();
SkIntToScalar(kCloseUpSize),
SkIntToScalar(kCloseUpSize));
- canvas->clipRect(clipRect, SkCanvas::kReplace_Op, false);
+ canvas->clipRect(clipRect);
canvas->translate(desiredX-origins[k].fX,
desiredY-origins[k].fY);
canvas->save();
canvas->scale(10, 10);
canvas->translate(-((fX1 + fX2)/2 - fR), -(fY - 2*fR/3));
- canvas->clipPath(fCircle1, SkCanvas::kReplace_Op, true);
- canvas->clipPath(fCircle2, SkCanvas::kIntersect_Op, true);
+ canvas->clipPath(fCircle1, true);
+ canvas->clipPath(fCircle2, true);
canvas->drawRect(rect, fillPaint);
for (size_t op = 0; op < SK_ARRAY_COUNT(ops); op++) {
canvas->save();
- canvas->clipPath(fCircle1, SkCanvas::kReplace_Op);
+ canvas->clipPath(fCircle1);
canvas->clipPath(fCircle2, ops[op]);
canvas->drawRect(rect, fillPaint);
SkRect rect = SkRect::MakeXYWH(20, 0, 100, 20);
canvas->save();
- canvas->clipRect(rect, SkCanvas::kReplace_Op, true);
+ canvas->clipRect(rect, true);
canvas->drawRect(r, p);
canvas->restore();
SkRect rect2 = SkRect::MakeXYWH(20, 120, 100, 19);
canvas->save();
- canvas->clipRect(rect2, SkCanvas::kReplace_Op, true);
+ canvas->clipRect(rect2, true);
canvas->drawRect(r2, p);
canvas->restore();
SkPath::kEvenOdd_FillType);
clipB.setFillType(doInvB ? SkPath::kInverseEvenOdd_FillType :
SkPath::kEvenOdd_FillType);
- canvas->clipPath(clipA, SkCanvas::kIntersect_Op, fDoAAClip);
+ canvas->clipPath(clipA, fDoAAClip);
canvas->clipPath(clipB, gOps[op].fOp, fDoAAClip);
// In the inverse case we need to prevent the draw from covering the whole
SkPath::kEvenOdd_FillType);
secondClip->setFillType(doInvB ? SkPath::kInverseEvenOdd_FillType :
SkPath::kEvenOdd_FillType);
- canvas->clipPath(*firstClip, SkCanvas::kIntersect_Op, doAAA);
+ canvas->clipPath(*firstClip, doAAA);
canvas->clipPath(*secondClip, gOps[op].fOp, doAAB);
// draw rect clipped
SkRect r = SkRect::MakeXYWH(-kExtents, kOffset - kExtents, 2 * kExtents, 2 * kExtents);
SkPath p;
p.addRoundRect(r, 5, 5);
- rec->clipPath(p, SkCanvas::kIntersect_Op, true);
+ rec->clipPath(p, true);
rec->drawColor(SK_ColorGREEN);
rec->restore();
sk_sp<SkPicture> pict(recorder.finishRecordingAsPicture());
for (int i = 0; i < count; ++i) {
canvas->save();
SkRRect rr = SkRRect::MakeRectXY(r.makeOffset(dx, dy), 20, 20);
- canvas->clipRRect(rr, SkCanvas::kIntersect_Op, true);
+ canvas->clipRRect(rr, true);
canvas->saveLayer({ &rr.getBounds(), nullptr, filters[i].get(), 0 });
canvas->drawColor(0x40FFFFFF);
canvas->restore();
} else {
fClipS.transform(clipM, &clip);
}
- canvas->clipPath(clip, SkCanvas::kIntersect_Op, true);
+ canvas->clipPath(clip, true);
canvas->scale(scale, scale);
canvas->drawBitmap(offscreen, (bounds.fLeft - 17) / scale,
(bounds.fTop - 20 + 420) / scale);
clipM.postTranslate(bounds.fLeft - 17 - 275, bounds.fTop - 24.5f + 420);
SkPath clip;
fClipR.transform(clipM, &clip);
- canvas->clipPath(clip, SkCanvas::kIntersect_Op, true);
+ canvas->clipPath(clip, true);
canvas->scale(10.f, 10.f);
canvas->drawBitmap(offscreen, (bounds.fLeft - 17 - 275
+ (index >= 5 ? 5 : 0)) / scale, (bounds.fTop - 20 + 420) / scale);
two.addRect(40, 40, 100, 100);
canvas->save();
canvas->translate(0, SkIntToScalar(yPos));
- canvas->clipRect(SkRect::MakeWH(110, 110), SkCanvas::kIntersect_Op, true);
+ canvas->clipRect(SkRect::MakeWH(110, 110), true);
canvas->drawPath(one, fOnePaint);
canvas->drawPath(one, fOutlinePaint);
canvas->drawPath(two, fTwoPaint);
Op(one, two, (SkPathOp) op, &result);
canvas->save();
canvas->translate(SkIntToScalar(xPos), SkIntToScalar(yPos));
- canvas->clipRect(SkRect::MakeWH(110, 110), SkCanvas::kIntersect_Op, true);
+ canvas->clipRect(SkRect::MakeWH(110, 110), true);
canvas->drawPath(result, fOpPaint[op]);
canvas->drawPath(result, fOutlinePaint);
canvas->restore();
SkIntToScalar(700)
};
p.addRoundRect(r, SkIntToScalar(50), SkIntToScalar(50));
- rec->clipPath(p, SkCanvas::kIntersect_Op, true);
+ rec->clipPath(p, true);
rec->translate(SkIntToScalar(250), SkIntToScalar(250));
- rec->clipPath(p, SkCanvas::kIntersect_Op, true);
+ rec->clipPath(p, true);
rec->drawColor(0xffff0000);
sk_sp<SkPicture> pict(recorder.finishRecordingAsPicture());
const SkRect layerRect = SkRect::MakeWH(256.f, 256.f);
canvas->saveLayer(layerRect, nullptr);
- canvas->clipRRect(rrect, SkCanvas::kIntersect_Op, true);
+ canvas->clipRRect(rrect, true);
canvas->drawPaint(p);
canvas->restore();
canvas->concat(zoomOut);
p.setColor(SK_ColorBLUE);
canvas->saveLayer(layerRect, nullptr);
- canvas->clipRRect(rrect, SkCanvas::kIntersect_Op, false);
+ canvas->clipRRect(rrect, false);
canvas->drawPaint(p);
canvas->restore();
SkShader::kClamp_TileMode));
canvas->concat(zoomOut);
canvas->saveLayer(layerRect, nullptr);
- canvas->clipRRect(rrect, SkCanvas::kIntersect_Op, true);
+ canvas->clipRRect(rrect, true);
canvas->drawPaint(p);
canvas->restore();
SkShader::kClamp_TileMode));
canvas->concat(zoomOut);
canvas->saveLayer(layerRect, nullptr);
- canvas->clipRRect(rrect, SkCanvas::kIntersect_Op, false);
+ canvas->clipRRect(rrect, false);
canvas->drawPaint(p);
canvas->restore();
}
#endif
} else if (kBW_Clip_Type == fType || kAA_Clip_Type == fType) {
bool aaClip = (kAA_Clip_Type == fType);
- canvas->clipRRect(fRRects[curRRect], SkCanvas::kReplace_Op, aaClip);
+ canvas->clipRRect(fRRects[curRRect], aaClip);
canvas->drawRect(kMaxTileBound, paint);
} else {
canvas->drawRRect(fRRects[curRRect], paint);
SkPath path;
path.addRoundRect(temp, SkIntToScalar(5), SkIntToScalar(5));
- canvas->clipPath(path, SkCanvas::kReplace_Op, true); // AA is on
+ canvas->clipPath(path, true); // AA is on
canvas->drawText("M", 1,
SkIntToScalar(100), SkIntToScalar(100),
// create the clip mask with the supplied boolean op
if (kPath_GeomType == fGeomType) {
// path-based case
- canvas->clipPath(fBasePath, SkCanvas::kReplace_Op, true);
+ canvas->clipPath(fBasePath, true);
canvas->clipPath(fRectPath, op, true);
} else {
// rect-based case
- canvas->clipRect(fBase, SkCanvas::kReplace_Op, true);
+ canvas->clipRect(fBase, true);
canvas->clipRect(fRect, op, true);
}
SkBlurMaskFilter::kHighQuality_BlurFlag));
paint.setColorFilter(SkColorFilter::MakeModeFilter(0xBFFFFFFF, SkXfermode::kSrcIn_Mode));
- canvas->clipPath(clipPath, SkCanvas::kIntersect_Op, true);
+ canvas->clipPath(clipPath, true);
canvas->drawPath(drawPath, paint);
}
* @param op The region op to apply to the current clip
* @param doAntiAlias true if the clip should be antialiased
*/
- void clipRect(const SkRect& rect, ClipOp op = kIntersect_Op, bool doAntiAlias = false);
+ void clipRect(const SkRect& rect, ClipOp, bool doAntiAlias);
+ void clipRect(const SkRect& rect, ClipOp op) {
+ this->clipRect(rect, op, false);
+ }
+ void clipRect(const SkRect& rect, bool doAntiAlias = false) {
+ this->clipRect(rect, kIntersect_Op, doAntiAlias);
+ }
/**
* Modify the current clip with the specified SkRRect.
* @param op The region op to apply to the current clip
* @param doAntiAlias true if the clip should be antialiased
*/
- void clipRRect(const SkRRect& rrect, ClipOp op = kIntersect_Op, bool doAntiAlias = false);
+ void clipRRect(const SkRRect& rrect, ClipOp op, bool doAntiAlias);
+ void clipRRect(const SkRRect& rrect, ClipOp op) {
+ this->clipRRect(rrect, op, false);
+ }
+ void clipRRect(const SkRRect& rrect, bool doAntiAlias = false) {
+ this->clipRRect(rrect, kIntersect_Op, doAntiAlias);
+ }
/**
* Modify the current clip with the specified path.
* @param op The region op to apply to the current clip
* @param doAntiAlias true if the clip should be antialiased
*/
- void clipPath(const SkPath& path, ClipOp op = kIntersect_Op, bool doAntiAlias = false);
+ void clipPath(const SkPath& path, ClipOp op, bool doAntiAlias);
+ void clipPath(const SkPath& path, ClipOp op) {
+ this->clipPath(path, op, false);
+ }
+ void clipPath(const SkPath& path, bool doAntiAlias = false) {
+ this->clipPath(path, kIntersect_Op, doAntiAlias);
+ }
/** EXPERIMENTAL -- only used for testing
Set to false to force clips to be hard, even if doAntiAlias=true is
switch (fGeom) {
case kRect_Geometry:
- canvas->clipRect(create_rect(offset), SkCanvas::kReplace_Op, useAA);
+ canvas->clipRect(create_rect(offset), useAA);
break;
case kRRect_Geometry:
- canvas->clipRRect(create_rrect(offset), SkCanvas::kReplace_Op, useAA);
+ canvas->clipRRect(create_rrect(offset), useAA);
break;
case kCircle_Geometry:
- canvas->clipRRect(create_circle(offset), SkCanvas::kReplace_Op, useAA);
+ canvas->clipRRect(create_circle(offset), useAA);
break;
case kConvexPath_Geometry:
- canvas->clipPath(create_convex_path(offset), SkCanvas::kReplace_Op, useAA);
+ canvas->clipPath(create_convex_path(offset), useAA);
break;
case kConcavePath_Geometry:
- canvas->clipPath(create_concave_path(offset), SkCanvas::kReplace_Op, useAA);
+ canvas->clipPath(create_concave_path(offset), useAA);
break;
case kRectAndRect_Geometry: {
SkRect r = create_rect(offset);
r.offset(fSign * kXlate, fSign * kXlate);
- canvas->clipRect(r, SkCanvas::kReplace_Op, true); // AA here forces shader clips
- canvas->clipRect(create_rect(offset), SkCanvas::kIntersect_Op, useAA);
+ canvas->clipRect(r, true); // AA here forces shader clips
+ canvas->clipRect(create_rect(offset), useAA);
} break;
case kRectAndRRect_Geometry: {
SkRect r = create_rect(offset);
r.offset(fSign * kXlate, fSign * kXlate);
- canvas->clipRect(r, SkCanvas::kReplace_Op, true); // AA here forces shader clips
- canvas->clipRRect(create_rrect(offset), SkCanvas::kIntersect_Op, useAA);
+ canvas->clipRect(r, true); // AA here forces shader clips
+ canvas->clipRRect(create_rrect(offset), useAA);
} break;
case kRectAndConvex_Geometry: {
SkRect r = create_rect(offset);
r.offset(fSign * kXlate, fSign * kXlate);
- canvas->clipRect(r, SkCanvas::kReplace_Op, true); // AA here forces shader clips
- canvas->clipPath(create_convex_path(offset), SkCanvas::kIntersect_Op, useAA);
+ canvas->clipRect(r, true); // AA here forces shader clips
+ canvas->clipPath(create_convex_path(offset), useAA);
} break;
case kRectAndConcave_Geometry: {
SkRect r = create_rect(offset);
r.offset(fSign * kXlate, fSign * kXlate);
- canvas->clipRect(r, SkCanvas::kReplace_Op, true); // AA here forces shader clips
- canvas->clipPath(create_concave_path(offset), SkCanvas::kIntersect_Op, useAA);
+ canvas->clipRect(r, true); // AA here forces shader clips
+ canvas->clipPath(create_concave_path(offset), useAA);
} break;
}