Revert[2] "remove SK_SUPPORT_LEGACY_CLIP_REGIONOPS"
This reverts commit a129dfef2aaab0b5995cdf1ab7b2cdd41c29cf72.
BUG=skia:
Change-Id: I717de6e5fcd4516aa684b014b1414b0f82ac2b91
Reviewed-on: https://skia-review.googlesource.com/5722
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Derek Sollenberger <djsollen@google.com>
diff --git a/gm/blurredclippedcircle.cpp b/gm/blurredclippedcircle.cpp
index e2cb288..e9640ec 100644
--- a/gm/blurredclippedcircle.cpp
+++ b/gm/blurredclippedcircle.cpp
@@ -56,7 +56,7 @@
SkRect clipRect2 = SkRect::MakeLTRB(8, 8, 288, 288);
SkRRect clipRRect = SkRRect::MakeOval(clipRect2);
- canvas->clipRRect(clipRRect, SkCanvas::kDifference_Op, true);
+ canvas->clipRRect(clipRRect, kDifference_SkClipOp, true);
SkRect r = SkRect::MakeLTRB(4, 4, 292, 292);
SkRRect rr = SkRRect::MakeOval(r);
diff --git a/gm/circularclips.cpp b/gm/circularclips.cpp
index f505310..9374f6f 100644
--- a/gm/circularclips.cpp
+++ b/gm/circularclips.cpp
@@ -36,13 +36,13 @@
}
void onDraw(SkCanvas* canvas) override {
- SkCanvas::ClipOp ops[] = {
- SkCanvas::kDifference_Op,
- SkCanvas::kIntersect_Op,
- SkCanvas::kUnion_Op,
- SkCanvas::kXOR_Op,
- SkCanvas::kReverseDifference_Op,
- SkCanvas::kReplace_Op,
+ const SkClipOp ops[] = {
+ kDifference_SkClipOp,
+ kIntersect_SkClipOp,
+ kUnion_SkClipOp,
+ kXOR_SkClipOp,
+ kReverseDifference_SkClipOp,
+ kReplace_SkClipOp,
};
SkRect rect = SkRect::MakeLTRB(fX1 - fR, fY - fR, fX2 + fR, fY + fR);
diff --git a/gm/complexclip.cpp b/gm/complexclip.cpp
index 2f8fa3d..2ae6a08 100644
--- a/gm/complexclip.cpp
+++ b/gm/complexclip.cpp
@@ -86,14 +86,14 @@
paint.setTextSize(SkIntToScalar(20));
constexpr struct {
- SkCanvas::ClipOp fOp;
+ SkClipOp fOp;
const char* fName;
} gOps[] = { //extra spaces in names for measureText
- {SkCanvas::kIntersect_Op, "Isect "},
- {SkCanvas::kDifference_Op, "Diff " },
- {SkCanvas::kUnion_Op, "Union "},
- {SkCanvas::kXOR_Op, "Xor " },
- {SkCanvas::kReverseDifference_Op, "RDiff "}
+ {kIntersect_SkClipOp, "Isect "},
+ {kDifference_SkClipOp, "Diff " },
+ {kUnion_SkClipOp, "Union "},
+ {kXOR_SkClipOp, "Xor " },
+ {kReverseDifference_SkClipOp, "RDiff "}
};
canvas->translate(SkIntToScalar(20), SkIntToScalar(20));
diff --git a/gm/complexclip2.cpp b/gm/complexclip2.cpp
index 3180f66..71e07c9 100644
--- a/gm/complexclip2.cpp
+++ b/gm/complexclip2.cpp
@@ -83,13 +83,13 @@
fPaths[4].addRoundRect(fRects[4], 5, 5);
fRectColors[4] = SK_ColorCYAN;
- SkCanvas::ClipOp ops[] = {
- SkCanvas::kDifference_Op,
- SkCanvas::kIntersect_Op,
- SkCanvas::kUnion_Op,
- SkCanvas::kXOR_Op,
- SkCanvas::kReverseDifference_Op,
- SkCanvas::kReplace_Op,
+ const SkClipOp ops[] = {
+ kDifference_SkClipOp,
+ kIntersect_SkClipOp,
+ kUnion_SkClipOp,
+ kXOR_SkClipOp,
+ kReverseDifference_SkClipOp,
+ kReplace_SkClipOp,
};
SkRandom r;
@@ -200,7 +200,7 @@
SkRRect fRRects[5];
SkPath fPaths[5];
SkColor fRectColors[5];
- SkCanvas::ClipOp fOps[kRows * kCols][5];
+ SkClipOp fOps[kRows * kCols][5];
SkScalar fWidth;
SkScalar fHeight;
SkScalar fTotalWidth;
diff --git a/gm/complexclip3.cpp b/gm/complexclip3.cpp
index 59c78ec..c174d9d 100644
--- a/gm/complexclip3.cpp
+++ b/gm/complexclip3.cpp
@@ -52,14 +52,14 @@
paint.setTextSize(SkIntToScalar(20));
constexpr struct {
- SkCanvas::ClipOp fOp;
- const char* fName;
+ SkClipOp fOp;
+ const char* fName;
} gOps[] = {
- {SkCanvas::kIntersect_Op, "I"},
- {SkCanvas::kDifference_Op, "D" },
- {SkCanvas::kUnion_Op, "U"},
- {SkCanvas::kXOR_Op, "X" },
- {SkCanvas::kReverseDifference_Op, "R"}
+ {kIntersect_SkClipOp, "I"},
+ {kDifference_SkClipOp, "D" },
+ {kUnion_SkClipOp, "U"},
+ {kXOR_SkClipOp, "X" },
+ {kReverseDifference_SkClipOp, "R"}
};
canvas->translate(SkIntToScalar(20), SkIntToScalar(20));
diff --git a/gm/complexclip_blur_tiled.cpp b/gm/complexclip_blur_tiled.cpp
index 31db174..3a0f0e0 100644
--- a/gm/complexclip_blur_tiled.cpp
+++ b/gm/complexclip_blur_tiled.cpp
@@ -52,7 +52,7 @@
SkRect rect = SkRect::MakeWH(WIDTH, HEIGHT);
tileCanvas->saveLayer(&rect, &blurPaint);
SkRRect rrect = SkRRect::MakeRectXY(rect.makeInset(20, 20), 25, 25);
- tileCanvas->clipRRect(rrect, SkCanvas::kDifference_Op, true);
+ tileCanvas->clipRRect(rrect, kDifference_SkClipOp, true);
SkPaint paint;
tileCanvas->drawRect(rect, paint);
tileCanvas->restore();
diff --git a/gm/convexpolyclip.cpp b/gm/convexpolyclip.cpp
index 5116955..5a8844a 100644
--- a/gm/convexpolyclip.cpp
+++ b/gm/convexpolyclip.cpp
@@ -173,7 +173,7 @@
canvas->save();
}
canvas->translate(x, y);
- clip->setOnCanvas(canvas, SkCanvas::kIntersect_Op, SkToBool(aa));
+ clip->setOnCanvas(canvas, kIntersect_SkClipOp, SkToBool(aa));
canvas->drawBitmap(fBmp, 0, 0);
canvas->restore();
x += fBmp.width() + kMargin;
@@ -199,7 +199,7 @@
SkPath closedClipPath;
clip->asClosedPath(&closedClipPath);
canvas->drawPath(closedClipPath, clipOutlinePaint);
- clip->setOnCanvas(canvas, SkCanvas::kIntersect_Op, SkToBool(aa));
+ clip->setOnCanvas(canvas, kIntersect_SkClipOp, SkToBool(aa));
canvas->scale(1.f, 1.8f);
canvas->drawText(kTxt, SK_ARRAY_COUNT(kTxt)-1,
0, 1.5f * txtPaint.getTextSize(),
@@ -227,7 +227,7 @@
Clip () : fClipType(kNone_ClipType) {}
- void setOnCanvas(SkCanvas* canvas, SkCanvas::ClipOp op, bool aa) const {
+ void setOnCanvas(SkCanvas* canvas, SkClipOp op, bool aa) const {
switch (fClipType) {
case kPath_ClipType:
canvas->clipPath(fPath, op, aa);
diff --git a/gm/megalooper.cpp b/gm/megalooper.cpp
index f5077c0..57df53a 100644
--- a/gm/megalooper.cpp
+++ b/gm/megalooper.cpp
@@ -91,8 +91,8 @@
outerClip.offset(x, y);
canvas->save();
- canvas->clipRect(outerClip, SkCanvas::kIntersect_Op);
- canvas->clipRect(innerClip, SkCanvas::kDifference_Op);
+ canvas->clipRect(outerClip, kIntersect_SkClipOp);
+ canvas->clipRect(innerClip, kDifference_SkClipOp);
SkPaint paint;
paint.setAntiAlias(true);
@@ -146,8 +146,8 @@
rect.offset(x, y);
canvas->save();
- canvas->clipRect(outerClip, SkCanvas::kIntersect_Op);
- canvas->clipRect(rect, SkCanvas::kDifference_Op);
+ canvas->clipRect(outerClip, kIntersect_SkClipOp);
+ canvas->clipRect(rect, kDifference_SkClipOp);
// move the rect to where we want the blur to appear
rect.offset(gBlurOffsets[i]);
@@ -195,8 +195,8 @@
paint.setLooper(create4Looper(-kOffsetToOutsideClip-kHalfSquareSize, 0));
canvas->save();
- canvas->clipRect(outerClip, SkCanvas::kIntersect_Op);
- canvas->clipRect(rect, SkCanvas::kDifference_Op);
+ canvas->clipRect(outerClip, kIntersect_SkClipOp);
+ canvas->clipRect(rect, kDifference_SkClipOp);
rect.offset(SkIntToScalar(kOffsetToOutsideClip+kHalfSquareSize), 0);
canvas->drawRect(rect, paint);
diff --git a/gm/simpleaaclip.cpp b/gm/simpleaaclip.cpp
index 9a8fe61..72a590f 100644
--- a/gm/simpleaaclip.cpp
+++ b/gm/simpleaaclip.cpp
@@ -67,7 +67,7 @@
INHERITED::setBGColor(sk_tool_utils::color_to_565(0xFFDDDDDD));
}
- void buildRgn(SkAAClip* clip, SkCanvas::ClipOp op) {
+ void buildRgn(SkAAClip* clip, SkClipOp op) {
clip->setPath(fBasePath, nullptr, true);
SkAAClip clip2;
@@ -85,7 +85,7 @@
canvas->drawRect(fRect, paint);
}
- void drawRgnOped(SkCanvas* canvas, SkCanvas::ClipOp op, SkColor color) {
+ void drawRgnOped(SkCanvas* canvas, SkClipOp op, SkColor color) {
SkAAClip clip;
@@ -97,7 +97,7 @@
paint_rgn(canvas, clip, paint);
}
- void drawPathsOped(SkCanvas* canvas, SkCanvas::ClipOp op, SkColor color) {
+ void drawPathsOped(SkCanvas* canvas, SkClipOp op, SkColor color) {
this->drawOrig(canvas);
@@ -144,14 +144,14 @@
const struct {
SkColor fColor;
const char* fName;
- SkCanvas::ClipOp fOp;
+ SkClipOp fOp;
} gOps[] = {
- { SK_ColorBLACK, "Difference", SkCanvas::kDifference_Op },
- { SK_ColorRED, "Intersect", SkCanvas::kIntersect_Op },
- { sk_tool_utils::color_to_565(0xFF008800), "Union", SkCanvas::kUnion_Op },
- { SK_ColorGREEN, "Rev Diff", SkCanvas::kReverseDifference_Op },
- { SK_ColorYELLOW, "Replace", SkCanvas::kReplace_Op },
- { SK_ColorBLUE, "XOR", SkCanvas::kXOR_Op },
+ { SK_ColorBLACK, "Difference", kDifference_SkClipOp },
+ { SK_ColorRED, "Intersect", kIntersect_SkClipOp },
+ { sk_tool_utils::color_to_565(0xFF008800), "Union", kUnion_SkClipOp },
+ { SK_ColorGREEN, "Rev Diff", kReverseDifference_SkClipOp },
+ { SK_ColorYELLOW, "Replace", kReplace_SkClipOp },
+ { SK_ColorBLUE, "XOR", kXOR_SkClipOp },
};
SkPaint textPaint;
diff --git a/gm/windowrectangles.cpp b/gm/windowrectangles.cpp
index 3949b3f..e277db6 100644
--- a/gm/windowrectangles.cpp
+++ b/gm/windowrectangles.cpp
@@ -43,20 +43,20 @@
SkClipStack stack;
stack.clipRect(SkRect::MakeXYWH(370.75, 80.25, 149, 100), SkMatrix::I(),
- SkCanvas::kDifference_Op, false);
+ kDifference_SkClipOp, false);
stack.clipRect(SkRect::MakeXYWH(80.25, 420.75, 150, 100), SkMatrix::I(),
- SkCanvas::kDifference_Op, true);
+ kDifference_SkClipOp, true);
stack.clipRRect(SkRRect::MakeRectXY(SkRect::MakeXYWH(200, 200, 200, 200), 60, 45),
- SkMatrix::I(), SkCanvas::kDifference_Op, true);
+ SkMatrix::I(), kDifference_SkClipOp, true);
SkRRect nine;
nine.setNinePatch(SkRect::MakeXYWH(550 - 30.25 - 100, 370.75, 100, 150), 12, 35, 23, 20);
- stack.clipRRect(nine, SkMatrix::I(), SkCanvas::kDifference_Op, true);
+ stack.clipRRect(nine, SkMatrix::I(), kDifference_SkClipOp, true);
SkRRect complx;
SkVector complxRadii[4] = {{6, 4}, {8, 12}, {16, 24}, {48, 32}};
complx.setRectRadii(SkRect::MakeXYWH(80.25, 80.75, 100, 149), complxRadii);
- stack.clipRRect(complx, SkMatrix::I(), SkCanvas::kDifference_Op, false);
+ stack.clipRRect(complx, SkMatrix::I(), kDifference_SkClipOp, false);
this->onCoverClipStack(stack, canvas);
@@ -79,7 +79,7 @@
*/
class ReplayClipStackVisitor final : public SkCanvasClipVisitor {
public:
- typedef SkCanvas::ClipOp Op;
+ typedef SkClipOp Op;
ReplayClipStackVisitor(SkCanvas* canvas) : fCanvas(canvas) {}
void clipRect(const SkRect& r, Op op, bool aa) override { fCanvas->clipRect(r, op, aa); }
void clipRRect(const SkRRect& rr, Op op, bool aa) override { fCanvas->clipRRect(rr, op, aa); }