diff options
74 files changed, 562 insertions, 598 deletions
diff --git a/bench/AAClipBench.cpp b/bench/AAClipBench.cpp index f91216e965..f3159b6168 100644 --- a/bench/AAClipBench.cpp +++ b/bench/AAClipBench.cpp @@ -59,9 +59,9 @@ protected: canvas->save(); #if 1 if (fDoPath) { - canvas->clipPath(fClipPath, SkCanvas::kReplace_Op, fDoAA); + canvas->clipPath(fClipPath, kReplace_SkClipOp, fDoAA); } else { - canvas->clipRect(fClipRect, SkCanvas::kReplace_Op, fDoAA); + canvas->clipRect(fClipRect, kReplace_SkClipOp, fDoAA); } canvas->drawRect(fDrawRect, paint); @@ -130,8 +130,7 @@ protected: SkASSERT(path.isConvex()); canvas->clipPath(path, - 0 == depth ? SkCanvas::kReplace_Op : - SkCanvas::kIntersect_Op, + 0 == depth ? kReplace_SkClipOp : kIntersect_SkClipOp, fDoAA); if (kNestingDepth == depth) { diff --git a/fuzz/FuzzDrawFunctions.cpp b/fuzz/FuzzDrawFunctions.cpp index c14b29a6e2..cee866c0c3 100644 --- a/fuzz/FuzzDrawFunctions.cpp +++ b/fuzz/FuzzDrawFunctions.cpp @@ -198,7 +198,7 @@ static void fuzz_drawRect(Fuzz* fuzz) { fuzz->next(&bl); fuzz->next(&a, &b, &c, &d); r = SkRect::MakeXYWH(a, b, c, d); - cnv->clipRect(r, SkCanvas::kIntersect_Op, bl); + cnv->clipRect(r, kIntersect_SkClipOp, bl); } static void fuzz_drawPath(Fuzz* fuzz) { @@ -249,7 +249,7 @@ static void fuzz_drawPath(Fuzz* fuzz) { bool bl; fuzz->next(&bl); - cnv->clipPath(path, SkCanvas::kIntersect_Op, bl); + cnv->clipPath(path, kIntersect_SkClipOp, bl); } static void fuzz_drawBitmap(Fuzz* fuzz) { diff --git a/gm/blurredclippedcircle.cpp b/gm/blurredclippedcircle.cpp index e2cb288cd5..e9640ec25e 100644 --- a/gm/blurredclippedcircle.cpp +++ b/gm/blurredclippedcircle.cpp @@ -56,7 +56,7 @@ protected: 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 f505310e4d..9374f6fb91 100644 --- a/gm/circularclips.cpp +++ b/gm/circularclips.cpp @@ -36,13 +36,13 @@ protected: } 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 2f8fa3d325..2ae6a087c6 100644 --- a/gm/complexclip.cpp +++ b/gm/complexclip.cpp @@ -86,14 +86,14 @@ protected: 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 3180f6681a..71e07c9221 100644 --- a/gm/complexclip2.cpp +++ b/gm/complexclip2.cpp @@ -83,13 +83,13 @@ protected: 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 @@ private: 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 59c78ec5a3..c174d9d5a8 100644 --- a/gm/complexclip3.cpp +++ b/gm/complexclip3.cpp @@ -52,14 +52,14 @@ protected: 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 31db174d06..3a0f0e0cb8 100644 --- a/gm/complexclip_blur_tiled.cpp +++ b/gm/complexclip_blur_tiled.cpp @@ -52,7 +52,7 @@ protected: 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 5116955021..5a8844abe2 100644 --- a/gm/convexpolyclip.cpp +++ b/gm/convexpolyclip.cpp @@ -173,7 +173,7 @@ protected: 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 @@ protected: 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 @@ private: 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 f5077c02a4..57df53aebd 100644 --- a/gm/megalooper.cpp +++ b/gm/megalooper.cpp @@ -91,8 +91,8 @@ private: 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 @@ private: 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 @@ private: 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 9a8fe61eaa..72a590f8a3 100644 --- a/gm/simpleaaclip.cpp +++ b/gm/simpleaaclip.cpp @@ -67,7 +67,7 @@ protected: 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 @@ protected: 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 @@ protected: 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 @@ protected: 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 3949b3f41c..e277db626c 100644 --- a/gm/windowrectangles.cpp +++ b/gm/windowrectangles.cpp @@ -43,20 +43,20 @@ void WindowRectanglesBaseGM::onDraw(SkCanvas* canvas) { 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 @@ private: */ 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); } diff --git a/include/core/SkCanvas.h b/include/core/SkCanvas.h index 9ba441a23a..3507786ab9 100644 --- a/include/core/SkCanvas.h +++ b/include/core/SkCanvas.h @@ -42,8 +42,6 @@ class SkSurface; class SkSurface_Base; class SkTextBlob; -//#define SK_SUPPORT_LEGACY_CLIP_REGIONOPS - /** \class SkCanvas A Canvas encapsulates all of the state about drawing into a device (bitmap). @@ -65,25 +63,6 @@ class SK_API SkCanvas : SkNoncopyable { }; public: -#ifdef SK_SUPPORT_LEGACY_CLIP_REGIONOPS - typedef SkRegion::Op ClipOp; - - static const ClipOp kDifference_Op = SkRegion::kDifference_Op; - static const ClipOp kIntersect_Op = SkRegion::kIntersect_Op; - static const ClipOp kUnion_Op = SkRegion::kUnion_Op; - static const ClipOp kXOR_Op = SkRegion::kXOR_Op; - static const ClipOp kReverseDifference_Op = SkRegion::kReverseDifference_Op; - static const ClipOp kReplace_Op = SkRegion::kReplace_Op; -#else - typedef SkClipOp ClipOp; - - static const ClipOp kDifference_Op = kDifference_SkClipOp; - static const ClipOp kIntersect_Op = kIntersect_SkClipOp; - static const ClipOp kUnion_Op = kUnion_SkClipOp; - static const ClipOp kXOR_Op = kXOR_SkClipOp; - static const ClipOp kReverseDifference_Op = kReverseDifference_SkClipOp; - static const ClipOp kReplace_Op = kReplace_SkClipOp; -#endif /** * Attempt to allocate raster canvas, matching the ImageInfo, that will draw directly into the * specified pixels. To access the pixels after drawing to them, the caller should call @@ -493,12 +472,12 @@ public: * @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, bool doAntiAlias); - void clipRect(const SkRect& rect, ClipOp op) { + void clipRect(const SkRect& rect, SkClipOp, bool doAntiAlias); + void clipRect(const SkRect& rect, SkClipOp op) { this->clipRect(rect, op, false); } void clipRect(const SkRect& rect, bool doAntiAlias = false) { - this->clipRect(rect, kIntersect_Op, doAntiAlias); + this->clipRect(rect, kIntersect_SkClipOp, doAntiAlias); } /** @@ -507,12 +486,12 @@ public: * @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, bool doAntiAlias); - void clipRRect(const SkRRect& rrect, ClipOp op) { + void clipRRect(const SkRRect& rrect, SkClipOp op, bool doAntiAlias); + void clipRRect(const SkRRect& rrect, SkClipOp op) { this->clipRRect(rrect, op, false); } void clipRRect(const SkRRect& rrect, bool doAntiAlias = false) { - this->clipRRect(rrect, kIntersect_Op, doAntiAlias); + this->clipRRect(rrect, kIntersect_SkClipOp, doAntiAlias); } /** @@ -521,12 +500,12 @@ public: * @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, bool doAntiAlias); - void clipPath(const SkPath& path, ClipOp op) { + void clipPath(const SkPath& path, SkClipOp op, bool doAntiAlias); + void clipPath(const SkPath& path, SkClipOp op) { this->clipPath(path, op, false); } void clipPath(const SkPath& path, bool doAntiAlias = false) { - this->clipPath(path, kIntersect_Op, doAntiAlias); + this->clipPath(path, kIntersect_SkClipOp, doAntiAlias); } /** EXPERIMENTAL -- only used for testing @@ -543,7 +522,7 @@ public: @param deviceRgn The region to apply to the current clip @param op The region op to apply to the current clip */ - void clipRegion(const SkRegion& deviceRgn, ClipOp op = kIntersect_Op); + void clipRegion(const SkRegion& deviceRgn, SkClipOp op = kIntersect_SkClipOp); /** Return true if the specified rectangle, after being transformed by the current matrix, would lie completely outside of the current clip. Call @@ -1479,10 +1458,10 @@ protected: kSoft_ClipEdgeStyle }; - virtual void onClipRect(const SkRect& rect, ClipOp, ClipEdgeStyle); - virtual void onClipRRect(const SkRRect& rrect, ClipOp, ClipEdgeStyle); - virtual void onClipPath(const SkPath& path, ClipOp, ClipEdgeStyle); - virtual void onClipRegion(const SkRegion& deviceRgn, ClipOp); + virtual void onClipRect(const SkRect& rect, SkClipOp, ClipEdgeStyle); + virtual void onClipRRect(const SkRRect& rrect, SkClipOp, ClipEdgeStyle); + virtual void onClipPath(const SkPath& path, SkClipOp, ClipEdgeStyle); + virtual void onClipRegion(const SkRegion& deviceRgn, SkClipOp); virtual void onDiscard(); @@ -1741,9 +1720,9 @@ private: class SkCanvasClipVisitor { public: virtual ~SkCanvasClipVisitor(); - virtual void clipRect(const SkRect&, SkCanvas::ClipOp, bool antialias) = 0; - virtual void clipRRect(const SkRRect&, SkCanvas::ClipOp, bool antialias) = 0; - virtual void clipPath(const SkPath&, SkCanvas::ClipOp, bool antialias) = 0; + virtual void clipRect(const SkRect&, SkClipOp, bool antialias) = 0; + virtual void clipRRect(const SkRRect&, SkClipOp, bool antialias) = 0; + virtual void clipPath(const SkPath&, SkClipOp, bool antialias) = 0; }; #endif diff --git a/include/core/SkClipStack.h b/include/core/SkClipStack.h index 7a8eb5ca84..98a3f7698b 100644 --- a/include/core/SkClipStack.h +++ b/include/core/SkClipStack.h @@ -54,21 +54,21 @@ public: static const int kTypeCnt = kLastType + 1; Element() { - this->initCommon(0, SkCanvas::kReplace_Op, false); + this->initCommon(0, kReplace_SkClipOp, false); this->setEmpty(); } Element(const Element&); - Element(const SkRect& rect, SkCanvas::ClipOp op, bool doAA) { + Element(const SkRect& rect, SkClipOp op, bool doAA) { this->initRect(0, rect, op, doAA); } - Element(const SkRRect& rrect, SkCanvas::ClipOp op, bool doAA) { + Element(const SkRRect& rrect, SkClipOp op, bool doAA) { this->initRRect(0, rrect, op, doAA); } - Element(const SkPath& path, SkCanvas::ClipOp op, bool doAA) { + Element(const SkPath& path, SkClipOp op, bool doAA) { this->initPath(0, path, op, doAA); } @@ -94,7 +94,7 @@ public: } //!< Call if getType() is not kEmpty to get the set operation used to combine this element. - SkCanvas::ClipOp getOp() const { return fOp; } + SkClipOp getOp() const { return fOp; } //!< Call to get the element as a path, regardless of its type. void asPath(SkPath* path) const; @@ -110,7 +110,7 @@ public: void invertShapeFillType(); //!< Sets the set operation represented by the element. - void setOp(SkCanvas::ClipOp op) { fOp = op; } + void setOp(SkClipOp op) { fOp = op; } /** The GenID can be used by clip stack clients to cache representations of the clip. The ID corresponds to the set of clip elements up to and including this element within the @@ -202,7 +202,7 @@ public: SkTLazy<SkPath> fPath; SkRRect fRRect; int fSaveCount; // save count of stack when this element was added. - SkCanvas::ClipOp fOp; + SkClipOp fOp; Type fType; bool fDoAA; @@ -226,23 +226,23 @@ public: int fGenID; Element(int saveCount) { - this->initCommon(saveCount, SkCanvas::kReplace_Op, false); + this->initCommon(saveCount, kReplace_SkClipOp, false); this->setEmpty(); } - Element(int saveCount, const SkRRect& rrect, SkCanvas::ClipOp op, bool doAA) { + Element(int saveCount, const SkRRect& rrect, SkClipOp op, bool doAA) { this->initRRect(saveCount, rrect, op, doAA); } - Element(int saveCount, const SkRect& rect, SkCanvas::ClipOp op, bool doAA) { + Element(int saveCount, const SkRect& rect, SkClipOp op, bool doAA) { this->initRect(saveCount, rect, op, doAA); } - Element(int saveCount, const SkPath& path, SkCanvas::ClipOp op, bool doAA) { + Element(int saveCount, const SkPath& path, SkClipOp op, bool doAA) { this->initPath(saveCount, path, op, doAA); } - void initCommon(int saveCount, SkCanvas::ClipOp op, bool doAA) { + void initCommon(int saveCount, SkClipOp op, bool doAA) { fSaveCount = saveCount; fOp = op; fDoAA = doAA; @@ -254,13 +254,13 @@ public: fGenID = kInvalidGenID; } - void initRect(int saveCount, const SkRect& rect, SkCanvas::ClipOp op, bool doAA) { + void initRect(int saveCount, const SkRect& rect, SkClipOp op, bool doAA) { fRRect.setRect(rect); fType = kRect_Type; this->initCommon(saveCount, op, doAA); } - void initRRect(int saveCount, const SkRRect& rrect, SkCanvas::ClipOp op, bool doAA) { + void initRRect(int saveCount, const SkRRect& rrect, SkClipOp op, bool doAA) { SkRRect::Type type = rrect.getType(); fRRect = rrect; if (SkRRect::kRect_Type == type || SkRRect::kEmpty_Type == type) { @@ -271,13 +271,13 @@ public: this->initCommon(saveCount, op, doAA); } - void initPath(int saveCount, const SkPath& path, SkCanvas::ClipOp op, bool doAA); + void initPath(int saveCount, const SkPath& path, SkClipOp op, bool doAA); void setEmpty(); // All Element methods below are only used within SkClipStack.cpp inline void checkEmpty() const; - inline bool canBeIntersectedInPlace(int saveCount, SkCanvas::ClipOp op) const; + inline bool canBeIntersectedInPlace(int saveCount, SkClipOp op) const; /* This method checks to see if two rect clips can be safely merged into one. The issue here is that to be strictly correct all the edges of the resulting rect must have the same anti-aliasing. */ @@ -346,14 +346,14 @@ public: */ bool asPath(SkPath* path) const; - void clipDevRect(const SkIRect& ir, SkCanvas::ClipOp op) { + void clipDevRect(const SkIRect& ir, SkClipOp op) { SkRect r; r.set(ir); this->clipRect(r, SkMatrix::I(), op, false); } - void clipRect(const SkRect&, const SkMatrix& matrix, SkCanvas::ClipOp, bool doAA); - void clipRRect(const SkRRect&, const SkMatrix& matrix, SkCanvas::ClipOp, bool doAA); - void clipPath(const SkPath&, const SkMatrix& matrix, SkCanvas::ClipOp, bool doAA); + void clipRect(const SkRect&, const SkMatrix& matrix, SkClipOp, bool doAA); + void clipRRect(const SkRRect&, const SkMatrix& matrix, SkClipOp, bool doAA); + void clipPath(const SkPath&, const SkMatrix& matrix, SkClipOp, bool doAA); // An optimized version of clipDevRect(emptyRect, kIntersect, ...) void clipEmpty(); @@ -424,7 +424,7 @@ public: * Moves the iterator to the topmost element with the specified RegionOp and returns that * element. If no clip element with that op is found, the first element is returned. */ - const Element* skipToTopmost(SkCanvas::ClipOp op); + const Element* skipToTopmost(SkClipOp op); /** * Restarts the iterator on a clip stack. diff --git a/include/core/SkPictureAnalyzer.h b/include/core/SkPictureAnalyzer.h index 62dac30f01..52db8334d4 100644 --- a/include/core/SkPictureAnalyzer.h +++ b/include/core/SkPictureAnalyzer.h @@ -37,7 +37,7 @@ public: /** * Process an explicit clipPath op. */ - void analyzeClipPath(const SkPath&, SkCanvas::ClipOp, bool doAntiAlias); + void analyzeClipPath(const SkPath&, SkClipOp, bool doAntiAlias); /** * Reset all accumulated stats. diff --git a/include/private/SkRecords.h b/include/private/SkRecords.h index 447764fced..54efab1891 100644 --- a/include/private/SkRecords.h +++ b/include/private/SkRecords.h @@ -192,8 +192,8 @@ RECORD(TranslateZ, 0, SkScalar z); struct ClipOpAndAA { ClipOpAndAA() {} - ClipOpAndAA(SkCanvas::ClipOp op, bool aa) : op(op), aa(aa) {} - SkCanvas::ClipOp op : 31; // This really only needs to be 3, but there's no win today to do so. + ClipOpAndAA(SkClipOp op, bool aa) : op(op), aa(aa) {} + SkClipOp op : 31; // This really only needs to be 3, but there's no win today to do so. unsigned aa : 1; // MSVC won't pack an enum with an bool, so we call this an unsigned. }; static_assert(sizeof(ClipOpAndAA) == 4, "ClipOpAndAASize"); @@ -213,7 +213,7 @@ RECORD(ClipRect, 0, RECORD(ClipRegion, 0, SkIRect devBounds; SkRegion region; - SkCanvas::ClipOp op); + SkClipOp op); // While not strictly required, if you have an SkPaint, it's fastest to put it first. RECORD(DrawArc, kDraw_Tag|kHasPaint_Tag, diff --git a/include/utils/SkDumpCanvas.h b/include/utils/SkDumpCanvas.h index c2152f23d8..c8f977ec10 100644 --- a/include/utils/SkDumpCanvas.h +++ b/include/utils/SkDumpCanvas.h @@ -117,10 +117,10 @@ protected: const uint16_t indices[], int indexCount, const SkPaint&) override; - void onClipRect(const SkRect&, ClipOp, ClipEdgeStyle) override; - void onClipRRect(const SkRRect&, ClipOp, ClipEdgeStyle) override; - void onClipPath(const SkPath&, ClipOp, ClipEdgeStyle) override; - void onClipRegion(const SkRegion&, ClipOp) override; + void onClipRect(const SkRect&, SkClipOp, ClipEdgeStyle) override; + void onClipRRect(const SkRRect&, SkClipOp, ClipEdgeStyle) override; + void onClipPath(const SkPath&, SkClipOp, ClipEdgeStyle) override; + void onClipRegion(const SkRegion&, SkClipOp) override; void onDrawPicture(const SkPicture*, const SkMatrix*, const SkPaint*) override; void onDrawAnnotation(const SkRect&, const char key[], SkData* value) override; diff --git a/include/utils/SkLuaCanvas.h b/include/utils/SkLuaCanvas.h index c03a1f0afc..357ddc81da 100644 --- a/include/utils/SkLuaCanvas.h +++ b/include/utils/SkLuaCanvas.h @@ -63,10 +63,10 @@ protected: const uint16_t indices[], int indexCount, const SkPaint&) override; - void onClipRect(const SkRect&, ClipOp, ClipEdgeStyle) override; - void onClipRRect(const SkRRect&, ClipOp, ClipEdgeStyle) override; - void onClipPath(const SkPath&, ClipOp, ClipEdgeStyle) override; - void onClipRegion(const SkRegion&, ClipOp) override; + void onClipRect(const SkRect&, SkClipOp, ClipEdgeStyle) override; + void onClipRRect(const SkRRect&, SkClipOp, ClipEdgeStyle) override; + void onClipPath(const SkPath&, SkClipOp, ClipEdgeStyle) override; + void onClipRegion(const SkRegion&, SkClipOp) override; void onDrawPicture(const SkPicture*, const SkMatrix*, const SkPaint*) override; diff --git a/include/utils/SkNWayCanvas.h b/include/utils/SkNWayCanvas.h index d8856dad0b..3ed7d4c41a 100644 --- a/include/utils/SkNWayCanvas.h +++ b/include/utils/SkNWayCanvas.h @@ -76,10 +76,10 @@ protected: const uint16_t indices[], int indexCount, const SkPaint&) override; - void onClipRect(const SkRect&, ClipOp, ClipEdgeStyle) override; - void onClipRRect(const SkRRect&, ClipOp, ClipEdgeStyle) override; - void onClipPath(const SkPath&, ClipOp, ClipEdgeStyle) override; - void onClipRegion(const SkRegion&, ClipOp) override; + void onClipRect(const SkRect&, SkClipOp, ClipEdgeStyle) override; + void onClipRRect(const SkRRect&, SkClipOp, ClipEdgeStyle) override; + void onClipPath(const SkPath&, SkClipOp, ClipEdgeStyle) override; + void onClipRegion(const SkRegion&, SkClipOp) override; void onDrawPicture(const SkPicture*, const SkMatrix*, const SkPaint*) override; void onDrawAnnotation(const SkRect&, const char[], SkData*) override; diff --git a/samplecode/SampleApp.cpp b/samplecode/SampleApp.cpp index 776844ca76..1acd975989 100644 --- a/samplecode/SampleApp.cpp +++ b/samplecode/SampleApp.cpp @@ -1370,7 +1370,7 @@ SkCanvas* SampleWindow::beforeChildren(SkCanvas* canvas) { if (fUseClip) { canvas->drawColor(0xFFFF88FF); - canvas->clipPath(fClipPath, SkCanvas::kIntersect_Op, true); + canvas->clipPath(fClipPath, kIntersect_SkClipOp, true); } // Install a flags filter proxy canvas if needed diff --git a/samplecode/SampleClip.cpp b/samplecode/SampleClip.cpp index 984a6e5ba5..82466ba137 100644 --- a/samplecode/SampleClip.cpp +++ b/samplecode/SampleClip.cpp @@ -142,7 +142,7 @@ protected: canvas->save(); for (size_t i = 0; i < SK_ARRAY_COUNT(gProc); ++i) { canvas->save(); - canvas->clipPath(clipPath, SkCanvas::kIntersect_Op, SkToBool(aa)); + canvas->clipPath(clipPath, kIntersect_SkClipOp, SkToBool(aa)); // canvas->drawColor(SK_ColorWHITE); gProc[i](canvas, SkToBool(aa)); canvas->restore(); diff --git a/samplecode/SampleComplexClip.cpp b/samplecode/SampleComplexClip.cpp index 7439d91f7f..ae8a20f6a5 100644 --- a/samplecode/SampleComplexClip.cpp +++ b/samplecode/SampleComplexClip.cpp @@ -79,14 +79,14 @@ protected: canvas->drawPath(clipB, paint); static const struct { - SkCanvas::ClipOp fOp; - const char* fName; + 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(0, SkIntToScalar(40)); diff --git a/samplecode/SampleFatBits.cpp b/samplecode/SampleFatBits.cpp index 82eb25fd70..65c929c71a 100644 --- a/samplecode/SampleFatBits.cpp +++ b/samplecode/SampleFatBits.cpp @@ -258,7 +258,7 @@ void FatBits::drawLine(SkCanvas* canvas, SkPoint pts[]) { fMinSurface->getCanvas()->save(); SkRect r = fClipRect; r.inset(SK_Scalar1/3, SK_Scalar1/3); - fMinSurface->getCanvas()->clipRect(r, SkCanvas::kIntersect_Op, true); + fMinSurface->getCanvas()->clipRect(r, kIntersect_SkClipOp, true); } fMinSurface->getCanvas()->drawLine(pts[0].fX, pts[0].fY, pts[1].fX, pts[1].fY, paint); if (fUseClip) { diff --git a/samplecode/SampleIdentityScale.cpp b/samplecode/SampleIdentityScale.cpp index 8d1bc36991..ae6092ac89 100644 --- a/samplecode/SampleIdentityScale.cpp +++ b/samplecode/SampleIdentityScale.cpp @@ -65,7 +65,7 @@ protected: SkRect r = { 100, 100, 356, 356 }; SkPath clipPath; clipPath.addRoundRect(r, SkIntToScalar(5), SkIntToScalar(5)); - canvas->clipPath(clipPath, SkCanvas::kIntersect_Op, SkToBool(1)); + canvas->clipPath(clipPath, kIntersect_SkClipOp, true); text = "Scaled = 0"; } canvas->drawBitmap( fBM, 100, 100, &paint ); diff --git a/samplecode/SampleLayers.cpp b/samplecode/SampleLayers.cpp index c086eb0480..faf4fde02a 100644 --- a/samplecode/SampleLayers.cpp +++ b/samplecode/SampleLayers.cpp @@ -254,7 +254,7 @@ protected: m.postTranslate(fCenter.x(), fCenter.y()); path.transform(m); - canvas->clipPath(path, SkCanvas::kIntersect_Op, true); + canvas->clipPath(path, kIntersect_SkClipOp, true); const SkRect bounds = path.getBounds(); SkPaint paint; diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp index 2dff8e9f89..430556db7e 100644 --- a/src/core/SkCanvas.cpp +++ b/src/core/SkCanvas.cpp @@ -342,7 +342,7 @@ public: bool next() { if (fMultiDeviceCS && fDevice) { // remove the previous device's bounds - fMultiDeviceCS->clipDevRect(compute_device_bounds(fDevice), SkCanvas::kDifference_Op); + fMultiDeviceCS->clipDevRect(compute_device_bounds(fDevice), kDifference_SkClipOp); } // skip over recs with empty clips @@ -1104,7 +1104,7 @@ bool SkCanvas::clipRectBounds(const SkRect* bounds, SaveLayerFlags saveLayerFlag if (BoundsAffectsClip(saveLayerFlags)) { // Simplify the current clips since they will be applied properly during restore() - fClipStack->clipDevRect(ir, kReplace_Op); + fClipStack->clipDevRect(ir, kReplace_SkClipOp); fMCRec->fRasterClip.setRect(ir); fDeviceClipBounds = qr_clip_bounds(ir); } @@ -1522,13 +1522,13 @@ sk_sp<SkLights> SkCanvas::getLights() const { ////////////////////////////////////////////////////////////////////////////// -void SkCanvas::clipRect(const SkRect& rect, ClipOp op, bool doAA) { +void SkCanvas::clipRect(const SkRect& rect, SkClipOp op, bool doAA) { this->checkForDeferredSave(); ClipEdgeStyle edgeStyle = doAA ? kSoft_ClipEdgeStyle : kHard_ClipEdgeStyle; this->onClipRect(rect, op, edgeStyle); } -void SkCanvas::onClipRect(const SkRect& rect, ClipOp op, ClipEdgeStyle edgeStyle) { +void SkCanvas::onClipRect(const SkRect& rect, SkClipOp op, ClipEdgeStyle edgeStyle) { const bool isAA = kSoft_ClipEdgeStyle == edgeStyle; AutoValidateClip avc(this); fClipStack->clipRect(rect, fMCRec->fMatrix, op, isAA); @@ -1538,7 +1538,7 @@ void SkCanvas::onClipRect(const SkRect& rect, ClipOp op, ClipEdgeStyle edgeStyle fDeviceClipBounds = qr_clip_bounds(fMCRec->fRasterClip.getBounds()); } -void SkCanvas::clipRRect(const SkRRect& rrect, ClipOp op, bool doAA) { +void SkCanvas::clipRRect(const SkRRect& rrect, SkClipOp op, bool doAA) { this->checkForDeferredSave(); ClipEdgeStyle edgeStyle = doAA ? kSoft_ClipEdgeStyle : kHard_ClipEdgeStyle; if (rrect.isRect()) { @@ -1548,7 +1548,7 @@ void SkCanvas::clipRRect(const SkRRect& rrect, ClipOp op, bool doAA) { } } -void SkCanvas::onClipRRect(const SkRRect& rrect, ClipOp op, ClipEdgeStyle edgeStyle) { +void SkCanvas::onClipRRect(const SkRRect& rrect, SkClipOp op, ClipEdgeStyle edgeStyle) { AutoValidateClip avc(this); fDeviceCMDirty = true; @@ -1561,7 +1561,7 @@ void SkCanvas::onClipRRect(const SkRRect& rrect, ClipOp op, ClipEdgeStyle edgeSt return; } -void SkCanvas::clipPath(const SkPath& path, ClipOp op, bool doAA) { +void SkCanvas::clipPath(const SkPath& path, SkClipOp op, bool doAA) { this->checkForDeferredSave(); ClipEdgeStyle edgeStyle = doAA ? kSoft_ClipEdgeStyle : kHard_ClipEdgeStyle; @@ -1586,7 +1586,7 @@ void SkCanvas::clipPath(const SkPath& path, ClipOp op, bool doAA) { this->onClipPath(path, op, edgeStyle); } -void SkCanvas::onClipPath(const SkPath& path, ClipOp op, ClipEdgeStyle edgeStyle) { +void SkCanvas::onClipPath(const SkPath& path, SkClipOp op, ClipEdgeStyle edgeStyle) { AutoValidateClip avc(this); fDeviceCMDirty = true; @@ -1601,19 +1601,19 @@ void SkCanvas::onClipPath(const SkPath& path, ClipOp op, ClipEdgeStyle edgeStyle isAA = getClipStack()->asPath(&tempPath); rasterClipPath = &tempPath; matrix = &SkMatrix::I(); - op = kReplace_Op; + op = kReplace_SkClipOp; } fMCRec->fRasterClip.op(*rasterClipPath, *matrix, this->getTopLayerBounds(), (SkRegion::Op)op, isAA); fDeviceClipBounds = qr_clip_bounds(fMCRec->fRasterClip.getBounds()); } -void SkCanvas::clipRegion(const SkRegion& rgn, ClipOp op) { +void SkCanvas::clipRegion(const SkRegion& rgn, SkClipOp op) { this->checkForDeferredSave(); this->onClipRegion(rgn, op); } -void SkCanvas::onClipRegion(const SkRegion& rgn, ClipOp op) { +void SkCanvas::onClipRegion(const SkRegion& rgn, SkClipOp op) { AutoValidateClip avc(this); fDeviceCMDirty = true; @@ -3383,13 +3383,6 @@ SkCanvas::SaveLayerStrategy SkNoDrawCanvas::getSaveLayerStrategy(const SaveLayer /////////////////////////////////////////////////////////////////////////////// -const SkCanvas::ClipOp SkCanvas::kDifference_Op; -const SkCanvas::ClipOp SkCanvas::kIntersect_Op; -const SkCanvas::ClipOp SkCanvas::kUnion_Op; -const SkCanvas::ClipOp SkCanvas::kXOR_Op; -const SkCanvas::ClipOp SkCanvas::kReverseDifference_Op; -const SkCanvas::ClipOp SkCanvas::kReplace_Op; - static_assert((int)SkRegion::kDifference_Op == (int)kDifference_SkClipOp, ""); static_assert((int)SkRegion::kIntersect_Op == (int)kIntersect_SkClipOp, ""); static_assert((int)SkRegion::kUnion_Op == (int)kUnion_SkClipOp, ""); diff --git a/src/core/SkClipStack.cpp b/src/core/SkClipStack.cpp index f155b49c4f..1a1e85f4c5 100644 --- a/src/core/SkClipStack.cpp +++ b/src/core/SkClipStack.cpp @@ -83,7 +83,7 @@ void SkClipStack::Element::replay(SkCanvasClipVisitor* visitor) const { visitor->clipRect(this->getRect(), this->getOp(), this->isAA()); break; case kEmpty_Type: - visitor->clipRect(kEmptyRect, SkCanvas::kIntersect_Op, false); + visitor->clipRect(kEmptyRect, kIntersect_SkClipOp, false); break; } } @@ -111,7 +111,7 @@ void SkClipStack::Element::invertShapeFillType() { } } -void SkClipStack::Element::initPath(int saveCount, const SkPath& path, SkCanvas::ClipOp op, +void SkClipStack::Element::initPath(int saveCount, const SkPath& path, SkClipOp op, bool doAA) { if (!path.isInverseFillType()) { SkRect r; @@ -176,16 +176,16 @@ void SkClipStack::Element::checkEmpty() const { SkASSERT(!fPath.isValid()); } -bool SkClipStack::Element::canBeIntersectedInPlace(int saveCount, SkCanvas::ClipOp op) const { +bool SkClipStack::Element::canBeIntersectedInPlace(int saveCount, SkClipOp op) const { if (kEmpty_Type == fType && - (SkCanvas::kDifference_Op == op || SkCanvas::kIntersect_Op == op)) { + (kDifference_SkClipOp == op || kIntersect_SkClipOp == op)) { return true; } // Only clips within the same save/restore frame (as captured by // the save count) can be merged return fSaveCount == saveCount && - SkCanvas::kIntersect_Op == op && - (SkCanvas::kIntersect_Op == fOp || SkCanvas::kReplace_Op == fOp); + kIntersect_SkClipOp == op && + (kIntersect_SkClipOp == fOp || kReplace_SkClipOp == fOp); } bool SkClipStack::Element::rectRectIntersectAllowed(const SkRect& newR, bool newAA) const { @@ -399,9 +399,9 @@ void SkClipStack::Element::updateBoundAndGenID(const Element* prior) { fFiniteBound = this->getRect(); fFiniteBoundType = kNormal_BoundsType; - if (SkCanvas::kReplace_Op == fOp || - (SkCanvas::kIntersect_Op == fOp && nullptr == prior) || - (SkCanvas::kIntersect_Op == fOp && prior->fIsIntersectionOfRects && + if (kReplace_SkClipOp == fOp || + (kIntersect_SkClipOp == fOp && nullptr == prior) || + (kIntersect_SkClipOp == fOp && prior->fIsIntersectionOfRects && prior->rectRectIntersectAllowed(this->getRect(), fDoAA))) { fIsIntersectionOfRects = true; } @@ -460,28 +460,28 @@ void SkClipStack::Element::updateBoundAndGenID(const Element* prior) { // Now integrate with clip with the prior clips switch (fOp) { - case SkCanvas::kDifference_Op: + case kDifference_SkClipOp: this->combineBoundsDiff(combination, prevFinite); break; - case SkCanvas::kXOR_Op: + case kXOR_SkClipOp: this->combineBoundsXOR(combination, prevFinite); break; - case SkCanvas::kUnion_Op: + case kUnion_SkClipOp: this->combineBoundsUnion(combination, prevFinite); break; - case SkCanvas::kIntersect_Op: + case kIntersect_SkClipOp: this->combineBoundsIntersection(combination, prevFinite); break; - case SkCanvas::kReverseDifference_Op: + case kReverseDifference_SkClipOp: this->combineBoundsRevDiff(combination, prevFinite); break; - case SkCanvas::kReplace_Op: + case kReplace_SkClipOp: // Replace just ignores everything prior // The current clip's bound information is already filled in // so nothing to do break; default: - SkDebugf("SkCanvas::ClipOp error\n"); + SkDebugf("SkClipOp error\n"); SkASSERT(0); break; } @@ -608,7 +608,7 @@ bool SkClipStack::internalQuickContains(const SkRect& rect) const { Iter iter(*this, Iter::kTop_IterStart); const Element* element = iter.prev(); while (element != nullptr) { - if (SkCanvas::kIntersect_Op != element->getOp() && SkCanvas::kReplace_Op != element->getOp()) + if (kIntersect_SkClipOp != element->getOp() && kReplace_SkClipOp != element->getOp()) return false; if (element->isInverseFilled()) { // Part of 'rect' could be trimmed off by the inverse-filled clip element @@ -620,7 +620,7 @@ bool SkClipStack::internalQuickContains(const SkRect& rect) const { return false; } } - if (SkCanvas::kReplace_Op == element->getOp()) { + if (kReplace_SkClipOp == element->getOp()) { break; } element = iter.prev(); @@ -633,7 +633,7 @@ bool SkClipStack::internalQuickContains(const SkRRect& rrect) const { Iter iter(*this, Iter::kTop_IterStart); const Element* element = iter.prev(); while (element != nullptr) { - if (SkCanvas::kIntersect_Op != element->getOp() && SkCanvas::kReplace_Op != element->getOp()) + if (kIntersect_SkClipOp != element->getOp() && kReplace_SkClipOp != element->getOp()) return false; if (element->isInverseFilled()) { // Part of 'rrect' could be trimmed off by the inverse-filled clip element @@ -645,7 +645,7 @@ bool SkClipStack::internalQuickContains(const SkRRect& rrect) const { return false; } } - if (SkCanvas::kReplace_Op == element->getOp()) { + if (kReplace_SkClipOp == element->getOp()) { break; } element = iter.prev(); @@ -666,8 +666,8 @@ bool SkClipStack::asPath(SkPath *path) const { element->asPath(&operand); } - SkCanvas::ClipOp elementOp = element->getOp(); - if (elementOp == SkCanvas::kReplace_Op) { + SkClipOp elementOp = element->getOp(); + if (elementOp == kReplace_SkClipOp) { *path = operand; } else { Op(*path, operand, (SkPathOp)elementOp, path); @@ -718,7 +718,7 @@ void SkClipStack::pushElement(const Element& element) { } break; } - } else if (SkCanvas::kReplace_Op == element.getOp()) { + } else if (kReplace_SkClipOp == element.getOp()) { this->restoreTo(fSaveCount - 1); prior = (Element*) fDeque.back(); } @@ -727,7 +727,7 @@ void SkClipStack::pushElement(const Element& element) { newElement->updateBoundAndGenID(prior); } -void SkClipStack::clipRRect(const SkRRect& rrect, const SkMatrix& matrix, SkCanvas::ClipOp op, +void SkClipStack::clipRRect(const SkRRect& rrect, const SkMatrix& matrix, SkClipOp op, bool doAA) { SkRRect transformedRRect; if (rrect.transform(matrix, &transformedRRect)) { @@ -741,7 +741,7 @@ void SkClipStack::clipRRect(const SkRRect& rrect, const SkMatrix& matrix, SkCanv this->clipPath(path, matrix, op, doAA); } -void SkClipStack::clipRect(const SkRect& rect, const SkMatrix& matrix, SkCanvas::ClipOp op, +void SkClipStack::clipRect(const SkRect& rect, const SkMatrix& matrix, SkClipOp op, bool doAA) { if (matrix.rectStaysRect()) { SkRect devRect; @@ -756,7 +756,7 @@ void SkClipStack::clipRect(const SkRect& rect, const SkMatrix& matrix, SkCanvas: this->clipPath(path, matrix, op, doAA); } -void SkClipStack::clipPath(const SkPath& path, const SkMatrix& matrix, SkCanvas::ClipOp op, +void SkClipStack::clipPath(const SkPath& path, const SkMatrix& matrix, SkClipOp op, bool doAA) { SkPath devPath; path.transform(matrix, &devPath); @@ -768,7 +768,7 @@ void SkClipStack::clipPath(const SkPath& path, const SkMatrix& matrix, SkCanvas: void SkClipStack::clipEmpty() { Element* element = (Element*) fDeque.back(); - if (element && element->canBeIntersectedInPlace(fSaveCount, SkCanvas::kIntersect_Op)) { + if (element && element->canBeIntersectedInPlace(fSaveCount, kIntersect_SkClipOp)) { element->setEmpty(); } new (fDeque.push_back()) Element(fSaveCount); @@ -794,7 +794,7 @@ const SkClipStack::Element* SkClipStack::Iter::prev() { return (const SkClipStack::Element*)fIter.prev(); } -const SkClipStack::Element* SkClipStack::Iter::skipToTopmost(SkCanvas::ClipOp op) { +const SkClipStack::Element* SkClipStack::Iter::skipToTopmost(SkClipOp op) { if (nullptr == fStack) { return nullptr; @@ -879,13 +879,13 @@ bool SkClipStack::isRRect(const SkRect& bounds, SkRRect* rrect, bool* aa) const back->getType() != SkClipStack::Element::kRRect_Type) { return false; } - if (back->getOp() == SkCanvas::kReplace_Op) { + if (back->getOp() == kReplace_SkClipOp) { *rrect = back->asRRect(); *aa = back->isAA(); return true; } - if (back->getOp() == SkCanvas::kIntersect_Op) { + if (back->getOp() == kIntersect_SkClipOp) { SkRect backBounds; if (!backBounds.intersect(bounds, back->asRRect().rect())) { return false; @@ -894,12 +894,12 @@ bool SkClipStack::isRRect(const SkRect& bounds, SkRRect* rrect, bool* aa) const SkDeque::Iter iter(fDeque, SkDeque::Iter::kBack_IterStart); SkAssertResult(static_cast<const Element*>(iter.prev()) == back); while (const Element* prior = (const Element*)iter.prev()) { - if ((prior->getOp() != SkCanvas::kIntersect_Op && - prior->getOp() != SkCanvas::kReplace_Op) || + if ((prior->getOp() != kIntersect_SkClipOp && + prior->getOp() != kReplace_SkClipOp) || !prior->contains(backBounds)) { return false; } - if (prior->getOp() == SkCanvas::kReplace_Op) { + if (prior->getOp() == kReplace_SkClipOp) { break; } } @@ -951,12 +951,12 @@ void SkClipStack::Element::dump() const { "reverse-difference", "replace", }; - static_assert(0 == SkCanvas::kDifference_Op, "op_str"); - static_assert(1 == SkCanvas::kIntersect_Op, "op_str"); - static_assert(2 == SkCanvas::kUnion_Op, "op_str"); - static_assert(3 == SkCanvas::kXOR_Op, "op_str"); - static_assert(4 == SkCanvas::kReverseDifference_Op, "op_str"); - static_assert(5 == SkCanvas::kReplace_Op, "op_str"); + static_assert(0 == kDifference_SkClipOp, "op_str"); + static_assert(1 == kIntersect_SkClipOp, "op_str"); + static_assert(2 == kUnion_SkClipOp, "op_str"); + static_assert(3 == kXOR_SkClipOp, "op_str"); + static_assert(4 == kReverseDifference_SkClipOp, "op_str"); + static_assert(5 == kReplace_SkClipOp, "op_str"); static_assert(SK_ARRAY_COUNT(kOpStrings) == SkRegion::kOpCnt, "op_str"); SkDebugf("Type: %s, Op: %s, AA: %s, Save Count: %d\n", kTypeStrings[fType], diff --git a/src/core/SkLiteDL.cpp b/src/core/SkLiteDL.cpp index 3f6e54e4af..2548a818e7 100644 --- a/src/core/SkLiteDL.cpp +++ b/src/core/SkLiteDL.cpp @@ -149,34 +149,34 @@ namespace { struct ClipPath final : Op { static const auto kType = Type::ClipPath; - ClipPath(const SkPath& path, SkCanvas::ClipOp op, bool aa) : path(path), op(op), aa(aa) {} - SkPath path; - SkCanvas::ClipOp op; - bool aa; + ClipPath(const SkPath& path, SkClipOp op, bool aa) : path(path), op(op), aa(aa) {} + SkPath path; + SkClipOp op; + bool aa; void draw(SkCanvas* c, const SkMatrix&) { c->clipPath(path, op, aa); } void makeThreadsafe() { make_threadsafe(&path, nullptr); } }; struct ClipRect final : Op { static const auto kType = Type::ClipRect; - ClipRect(const SkRect& rect, SkCanvas::ClipOp op, bool aa) : rect(rect), op(op), aa(aa) {} - SkRect rect; - SkCanvas::ClipOp op; - bool aa; + ClipRect(const SkRect& rect, SkClipOp op, bool aa) : rect(rect), op(op), aa(aa) {} + SkRect rect; + SkClipOp op; + bool aa; void draw(SkCanvas* c, const SkMatrix&) { c->clipRect(rect, op, aa); } }; struct ClipRRect final : Op { static const auto kType = Type::ClipRRect; - ClipRRect(const SkRRect& rrect, SkCanvas::ClipOp op, bool aa) : rrect(rrect), op(op), aa(aa) {} - SkRRect rrect; - SkCanvas::ClipOp op; - bool aa; + ClipRRect(const SkRRect& rrect, SkClipOp op, bool aa) : rrect(rrect), op(op), aa(aa) {} + SkRRect rrect; + SkClipOp op; + bool aa; void draw(SkCanvas* c, const SkMatrix&) { c->clipRRect(rrect, op, aa); } }; struct ClipRegion final : Op { static const auto kType = Type::ClipRegion; - ClipRegion(const SkRegion& region, SkCanvas::ClipOp op) : region(region), op(op) {} - SkRegion region; - SkCanvas::ClipOp op; + ClipRegion(const SkRegion& region, SkClipOp op) : region(region), op(op) {} + SkRegion region; + SkClipOp op; void draw(SkCanvas* c, const SkMatrix&) { c->clipRegion(region, op); } }; @@ -599,16 +599,16 @@ void SkLiteDL::setMatrix(const SkMatrix& matrix) { this->push<SetMatrix>(0, ma void SkLiteDL::translate(SkScalar dx, SkScalar dy) { this->push<Translate>(0, dx, dy); } void SkLiteDL::translateZ(SkScalar dz) { this->push<TranslateZ>(0, dz); } -void SkLiteDL::clipPath(const SkPath& path, SkCanvas::ClipOp op, bool aa) { +void SkLiteDL::clipPath(const SkPath& path, SkClipOp op, bool aa) { this->push<ClipPath>(0, path, op, aa); } -void SkLiteDL::clipRect(const SkRect& rect, SkCanvas::ClipOp op, bool aa) { +void SkLiteDL::clipRect(const SkRect& rect, SkClipOp op, bool aa) { this->push<ClipRect>(0, rect, op, aa); } -void SkLiteDL::clipRRect(const SkRRect& rrect, SkCanvas::ClipOp op, bool aa) { +void SkLiteDL::clipRRect(const SkRRect& rrect, SkClipOp op, bool aa) { this->push<ClipRRect>(0, rrect, op, aa); } -void SkLiteDL::clipRegion(const SkRegion& region, SkCanvas::ClipOp op) { +void SkLiteDL::clipRegion(const SkRegion& region, SkClipOp op) { this->push<ClipRegion>(0, region, op); } diff --git a/src/core/SkLiteDL.h b/src/core/SkLiteDL.h index 43988c053b..330131f41e 100644 --- a/src/core/SkLiteDL.h +++ b/src/core/SkLiteDL.h @@ -43,10 +43,10 @@ public: void translate(SkScalar, SkScalar); void translateZ(SkScalar); - void clipPath (const SkPath&, SkCanvas::ClipOp, bool aa); - void clipRect (const SkRect&, SkCanvas::ClipOp, bool aa); - void clipRRect (const SkRRect&, SkCanvas::ClipOp, bool aa); - void clipRegion(const SkRegion&, SkCanvas::ClipOp); + void clipPath (const SkPath&, SkClipOp, bool aa); + void clipRect (const SkRect&, SkClipOp, bool aa); + void clipRRect (const SkRRect&, SkClipOp, bool aa); + void clipRegion(const SkRegion&, SkClipOp); void drawPaint (const SkPaint&); void drawPath (const SkPath&, const SkPaint&); diff --git a/src/core/SkLiteRecorder.cpp b/src/core/SkLiteRecorder.cpp index b26547a462..9f7ae39e05 100644 --- a/src/core/SkLiteRecorder.cpp +++ b/src/core/SkLiteRecorder.cpp @@ -40,19 +40,19 @@ void SkLiteRecorder::didConcat (const SkMatrix& matrix) { fDL-> concat(mat void SkLiteRecorder::didSetMatrix(const SkMatrix& matrix) { fDL->setMatrix(matrix); } void SkLiteRecorder::didTranslate(SkScalar dx, SkScalar dy) { fDL->translate(dx, dy); } -void SkLiteRecorder::onClipRect(const SkRect& rect, ClipOp op, ClipEdgeStyle style) { +void SkLiteRecorder::onClipRect(const SkRect& rect, SkClipOp op, ClipEdgeStyle style) { fDL->clipRect(rect, op, style==kSoft_ClipEdgeStyle); this->INHERITED::onClipRect(rect, op, style); } -void SkLiteRecorder::onClipRRect(const SkRRect& rrect, ClipOp op, ClipEdgeStyle style) { +void SkLiteRecorder::onClipRRect(const SkRRect& rrect, SkClipOp op, ClipEdgeStyle style) { fDL->clipRRect(rrect, op, style==kSoft_ClipEdgeStyle); this->INHERITED::onClipRRect(rrect, op, style); } -void SkLiteRecorder::onClipPath(const SkPath& path, ClipOp op, ClipEdgeStyle style) { +void SkLiteRecorder::onClipPath(const SkPath& path, SkClipOp op, ClipEdgeStyle style) { fDL->clipPath(path, op, style==kSoft_ClipEdgeStyle); this->INHERITED::onClipPath(path, op, style); } -void SkLiteRecorder::onClipRegion(const SkRegion& region, ClipOp op) { +void SkLiteRecorder::onClipRegion(const SkRegion& region, SkClipOp op) { fDL->clipRegion(region, op); this->INHERITED::onClipRegion(region, op); } diff --git a/src/core/SkLiteRecorder.h b/src/core/SkLiteRecorder.h index 4ffd132862..ad8f26435f 100644 --- a/src/core/SkLiteRecorder.h +++ b/src/core/SkLiteRecorder.h @@ -31,10 +31,10 @@ public: void didSetMatrix(const SkMatrix&) override; void didTranslate(SkScalar, SkScalar) override; - void onClipRect (const SkRect&, ClipOp, ClipEdgeStyle) override; - void onClipRRect (const SkRRect&, ClipOp, ClipEdgeStyle) override; - void onClipPath (const SkPath&, ClipOp, ClipEdgeStyle) override; - void onClipRegion(const SkRegion&, ClipOp) override; + void onClipRect (const SkRect&, SkClipOp, ClipEdgeStyle) override; + void onClipRRect (const SkRRect&, SkClipOp, ClipEdgeStyle) override; + void onClipPath (const SkPath&, SkClipOp, ClipEdgeStyle) override; + void onClipRegion(const SkRegion&, SkClipOp) override; void onDrawPaint (const SkPaint&) override; void onDrawPath (const SkPath&, const SkPaint&) override; diff --git a/src/core/SkPictureAnalyzer.cpp b/src/core/SkPictureAnalyzer.cpp index a7a4d94496..62c27e15a1 100644 --- a/src/core/SkPictureAnalyzer.cpp +++ b/src/core/SkPictureAnalyzer.cpp @@ -38,7 +38,7 @@ void SkPictureGpuAnalyzer::analyzePicture(const SkPicture* picture) { fNumSlowPaths += picture->numSlowPaths(); } -void SkPictureGpuAnalyzer::analyzeClipPath(const SkPath& path, SkCanvas::ClipOp op, bool doAntiAlias) { +void SkPictureGpuAnalyzer::analyzeClipPath(const SkPath& path, SkClipOp op, bool doAntiAlias) { const SkRecords::ClipPath clipOp = { SkIRect::MakeEmpty(), // Willie don't care. path, diff --git a/src/core/SkPictureFlat.h b/src/core/SkPictureFlat.h index beb2dd8338..d5263ca80b 100644 --- a/src/core/SkPictureFlat.h +++ b/src/core/SkPictureFlat.h @@ -128,13 +128,13 @@ enum SaveLayerRecFlatFlags { // clipparams are packed in 5 bits // doAA:1 | clipOp:4 -static inline uint32_t ClipParams_pack(SkCanvas::ClipOp op, bool doAA) { +static inline uint32_t ClipParams_pack(SkClipOp op, bool doAA) { unsigned doAABit = doAA ? 1 : 0; return (doAABit << 4) | op; } -static inline SkCanvas::ClipOp ClipParams_unpackRegionOp(uint32_t packed) { - return (SkCanvas::ClipOp)(packed & 0xF); +static inline SkClipOp ClipParams_unpackRegionOp(uint32_t packed) { + return (SkClipOp)(packed & 0xF); } static inline bool ClipParams_unpackDoAA(uint32_t packed) { diff --git a/src/core/SkPicturePlayback.cpp b/src/core/SkPicturePlayback.cpp index 0b3dd0e8fd..85e5c03cad 100644 --- a/src/core/SkPicturePlayback.cpp +++ b/src/core/SkPicturePlayback.cpp @@ -136,7 +136,7 @@ void SkPicturePlayback::handleOp(SkReadBuffer* reader, case CLIP_PATH: { const SkPath& path = fPictureData->getPath(reader); uint32_t packed = reader->readInt(); - SkCanvas::ClipOp clipOp = ClipParams_unpackRegionOp(packed); + SkClipOp clipOp = ClipParams_unpackRegionOp(packed); bool doAA = ClipParams_unpackDoAA(packed); size_t offsetToRestore = reader->readInt(); BREAK_ON_READ_ERROR(reader); @@ -151,7 +151,7 @@ void SkPicturePlayback::handleOp(SkReadBuffer* reader, SkRegion region; reader->readRegion(®ion); uint32_t packed = reader->readInt(); - SkCanvas::ClipOp clipOp = ClipParams_unpackRegionOp(packed); + SkClipOp clipOp = ClipParams_unpackRegionOp(packed); size_t offsetToRestore = reader->readInt(); BREAK_ON_READ_ERROR(reader); @@ -165,7 +165,7 @@ void SkPicturePlayback::handleOp(SkReadBuffer* reader, SkRect rect; reader->readRect(&rect); uint32_t packed = reader->readInt(); - SkCanvas::ClipOp clipOp = ClipParams_unpackRegionOp(packed); + SkClipOp clipOp = ClipParams_unpackRegionOp(packed); bool doAA = ClipParams_unpackDoAA(packed); size_t offsetToRestore = reader->readInt(); BREAK_ON_READ_ERROR(reader); @@ -180,7 +180,7 @@ void SkPicturePlayback::handleOp(SkReadBuffer* reader, SkRRect rrect; reader->readRRect(&rrect); uint32_t packed = reader->readInt(); - SkCanvas::ClipOp clipOp = ClipParams_unpackRegionOp(packed); + SkClipOp clipOp = ClipParams_unpackRegionOp(packed); bool doAA = ClipParams_unpackDoAA(packed); size_t offsetToRestore = reader->readInt(); BREAK_ON_READ_ERROR(reader); diff --git a/src/core/SkPictureRecord.cpp b/src/core/SkPictureRecord.cpp index 086eb8dacb..a0ac76d7a6 100644 --- a/src/core/SkPictureRecord.cpp +++ b/src/core/SkPictureRecord.cpp @@ -230,18 +230,18 @@ void SkPictureRecord::didTranslateZ(SkScalar z) { #endif } -static bool clipOpExpands(SkCanvas::ClipOp op) { +static bool clipOpExpands(SkClipOp op) { switch (op) { - case SkCanvas::kUnion_Op: - case SkCanvas::kXOR_Op: - case SkCanvas::kReverseDifference_Op: - case SkCanvas::kReplace_Op: + case kUnion_SkClipOp: + case kXOR_SkClipOp: + case kReverseDifference_SkClipOp: + case kReplace_SkClipOp: return true; - case SkCanvas::kIntersect_Op: - case SkCanvas::kDifference_Op: + case kIntersect_SkClipOp: + case kDifference_SkClipOp: return false; default: - SkDEBUGFAIL("unknown region op"); + SkDEBUGFAIL("unknown clipop"); return false; } } @@ -279,7 +279,7 @@ void SkPictureRecord::endRecording() { this->restoreToCount(fInitialSaveCount); } -size_t SkPictureRecord::recordRestoreOffsetPlaceholder(ClipOp op) { +size_t SkPictureRecord::recordRestoreOffsetPlaceholder(SkClipOp op) { if (fRestoreOffsetStack.isEmpty()) { return -1; } @@ -309,12 +309,12 @@ size_t SkPictureRecord::recordRestoreOffsetPlaceholder(ClipOp op) { return offset; } -void SkPictureRecord::onClipRect(const SkRect& rect, SkCanvas::ClipOp op, ClipEdgeStyle edgeStyle) { +void SkPictureRecord::onClipRect(const SkRect& rect, SkClipOp op, ClipEdgeStyle edgeStyle) { this->recordClipRect(rect, op, kSoft_ClipEdgeStyle == edgeStyle); this->INHERITED::onClipRect(rect, op, edgeStyle); } -size_t SkPictureRecord::recordClipRect(const SkRect& rect, SkCanvas::ClipOp op, bool doAA) { +size_t SkPictureRecord::recordClipRect(const SkRect& rect, SkClipOp op, bool doAA) { // id + rect + clip params size_t size = 1 * kUInt32Size + sizeof(rect) + 1 * kUInt32Size; // recordRestoreOffsetPlaceholder doesn't always write an offset @@ -331,12 +331,12 @@ size_t SkPictureRecord::recordClipRect(const SkRect& rect, SkCanvas::ClipOp op, return offset; } -void SkPictureRecord::onClipRRect(const SkRRect& rrect, SkCanvas::ClipOp op, ClipEdgeStyle edgeStyle) { +void SkPictureRecord::onClipRRect(const SkRRect& rrect, SkClipOp op, ClipEdgeStyle edgeStyle) { this->recordClipRRect(rrect, op, kSoft_ClipEdgeStyle == edgeStyle); this->INHERITED::onClipRRect(rrect, op, edgeStyle); } -size_t SkPictureRecord::recordClipRRect(const SkRRect& rrect, SkCanvas::ClipOp op, bool doAA) { +size_t SkPictureRecord::recordClipRRect(const SkRRect& rrect, SkClipOp op, bool doAA) { // op + rrect + clip params size_t size = 1 * kUInt32Size + SkRRect::kSizeInMemory + 1 * kUInt32Size; // recordRestoreOffsetPlaceholder doesn't always write an offset @@ -352,13 +352,13 @@ size_t SkPictureRecord::recordClipRRect(const SkRRect& rrect, SkCanvas::ClipOp o return offset; } -void SkPictureRecord::onClipPath(const SkPath& path, SkCanvas::ClipOp op, ClipEdgeStyle edgeStyle) { +void SkPictureRecord::onClipPath(const SkPath& path, SkClipOp op, ClipEdgeStyle edgeStyle) { int pathID = this->addPathToHeap(path); this->recordClipPath(pathID, op, kSoft_ClipEdgeStyle == edgeStyle); this->INHERITED::onClipPath(path, op, edgeStyle); } -size_t SkPictureRecord::recordClipPath(int pathID, SkCanvas::ClipOp op, bool doAA) { +size_t SkPictureRecord::recordClipPath(int pathID, SkClipOp op, bool doAA) { // op + path index + clip params size_t size = 3 * kUInt32Size; // recordRestoreOffsetPlaceholder doesn't always write an offset @@ -374,12 +374,12 @@ size_t SkPictureRecord::recordClipPath(int pathID, SkCanvas::ClipOp op, bool doA return offset; } -void SkPictureRecord::onClipRegion(const SkRegion& region, ClipOp op) { +void SkPictureRecord::onClipRegion(const SkRegion& region, SkClipOp op) { this->recordClipRegion(region, op); this->INHERITED::onClipRegion(region, op); } -size_t SkPictureRecord::recordClipRegion(const SkRegion& region, ClipOp op) { +size_t SkPictureRecord::recordClipRegion(const SkRegion& region, SkClipOp op) { // op + clip params + region size_t size = 2 * kUInt32Size + region.writeToMemory(nullptr); // recordRestoreOffsetPlaceholder doesn't always write an offset diff --git a/src/core/SkPictureRecord.h b/src/core/SkPictureRecord.h index ca858a64eb..9339d12ba5 100644 --- a/src/core/SkPictureRecord.h +++ b/src/core/SkPictureRecord.h @@ -76,7 +76,7 @@ protected: private: void handleOptimization(int opt); - size_t recordRestoreOffsetPlaceholder(SkCanvas::ClipOp); + size_t recordRestoreOffsetPlaceholder(SkClipOp); void fillRestoreOffsetPlaceholdersForCurrentStackLevel(uint32_t restoreOffset); SkTDArray<int32_t> fRestoreOffsetStack; @@ -204,10 +204,10 @@ protected: const uint16_t indices[], int indexCount, const SkPaint&) override; - void onClipRect(const SkRect&, ClipOp, ClipEdgeStyle) override; - void onClipRRect(const SkRRect&, ClipOp, ClipEdgeStyle) override; - void onClipPath(const SkPath&, ClipOp, ClipEdgeStyle) override; - void onClipRegion(const SkRegion&, ClipOp) override; + void onClipRect(const SkRect&, SkClipOp, ClipEdgeStyle) override; + void onClipRRect(const SkRRect&, SkClipOp, ClipEdgeStyle) override; + void onClipPath(const SkPath&, SkClipOp, ClipEdgeStyle) override; + void onClipRegion(const SkRegion&, SkClipOp) override; void onDrawPicture(const SkPicture*, const SkMatrix*, const SkPaint*) override; @@ -230,10 +230,10 @@ protected: void recordConcat(const SkMatrix& matrix); void recordTranslate(const SkMatrix& matrix); void recordScale(const SkMatrix& matrix); - size_t recordClipRect(const SkRect& rect, SkCanvas::ClipOp op, bool doAA); - size_t recordClipRRect(const SkRRect& rrect, SkCanvas::ClipOp op, bool doAA); - size_t recordClipPath(int pathID, SkCanvas::ClipOp op, bool doAA); - size_t recordClipRegion(const SkRegion& region, SkCanvas::ClipOp op); + size_t recordClipRect(const SkRect& rect, SkClipOp op, bool doAA); + size_t recordClipRRect(const SkRRect& rrect, SkClipOp op, bool doAA); + size_t recordClipPath(int pathID, SkClipOp op, bool doAA); + size_t recordClipRegion(const SkRegion& region, SkClipOp op); void recordSave(); void recordSaveLayer(const SaveLayerRec&); void recordRestore(bool fillInSkips = true); diff --git a/src/core/SkRecorder.cpp b/src/core/SkRecorder.cpp index 4c56d99f45..f4c6b50f08 100644 --- a/src/core/SkRecorder.cpp +++ b/src/core/SkRecorder.cpp @@ -404,25 +404,25 @@ void SkRecorder::didTranslateZ(SkScalar z) { #endif } -void SkRecorder::onClipRect(const SkRect& rect, ClipOp op, ClipEdgeStyle edgeStyle) { +void SkRecorder::onClipRect(const SkRect& rect, SkClipOp op, ClipEdgeStyle edgeStyle) { INHERITED(onClipRect, rect, op, edgeStyle); SkRecords::ClipOpAndAA opAA(op, kSoft_ClipEdgeStyle == edgeStyle); APPEND(ClipRect, this->devBounds(), rect, opAA); } -void SkRecorder::onClipRRect(const SkRRect& rrect, ClipOp op, ClipEdgeStyle edgeStyle) { +void SkRecorder::onClipRRect(const SkRRect& rrect, SkClipOp op, ClipEdgeStyle edgeStyle) { INHERITED(onClipRRect, rrect, op, edgeStyle); SkRecords::ClipOpAndAA opAA(op, kSoft_ClipEdgeStyle == edgeStyle); APPEND(ClipRRect, this->devBounds(), rrect, opAA); } -void SkRecorder::onClipPath(const SkPath& path, ClipOp op, ClipEdgeStyle edgeStyle) { +void SkRecorder::onClipPath(const SkPath& path, SkClipOp op, ClipEdgeStyle edgeStyle) { INHERITED(onClipPath, path, op, edgeStyle); SkRecords::ClipOpAndAA opAA(op, kSoft_ClipEdgeStyle == edgeStyle); APPEND(ClipPath, this->devBounds(), path, opAA); } -void SkRecorder::onClipRegion(const SkRegion& deviceRgn, ClipOp op) { +void SkRecorder::onClipRegion(const SkRegion& deviceRgn, SkClipOp op) { INHERITED(onClipRegion, deviceRgn, op); APPEND(ClipRegion, this->devBounds(), deviceRgn, op); } diff --git a/src/core/SkRecorder.h b/src/core/SkRecorder.h index c93ee63430..c8100761dd 100644 --- a/src/core/SkRecorder.h +++ b/src/core/SkRecorder.h @@ -132,10 +132,10 @@ public: void onDrawAtlas(const SkImage*, const SkRSXform[], const SkRect[], const SkColor[], int count, SkBlendMode, const SkRect* cull, const SkPaint*) override; - void onClipRect(const SkRect& rect, ClipOp, ClipEdgeStyle) override; - void onClipRRect(const SkRRect& rrect, ClipOp, ClipEdgeStyle) override; - void onClipPath(const SkPath& path, ClipOp, ClipEdgeStyle) override; - void onClipRegion(const SkRegion& deviceRgn, ClipOp) override; + void onClipRect(const SkRect& rect, SkClipOp, ClipEdgeStyle) override; + void onClipRRect(const SkRRect& rrect, SkClipOp, ClipEdgeStyle) override; + void onClipPath(const SkPath& path, SkClipOp, ClipEdgeStyle) override; + void onClipRegion(const SkRegion& deviceRgn, SkClipOp) override; void onDrawPicture(const SkPicture*, const SkMatrix*, const SkPaint*) override; diff --git a/src/effects/SkXfermodeImageFilter.cpp b/src/effects/SkXfermodeImageFilter.cpp index 0987266bbc..82d5156a28 100644 --- a/src/effects/SkXfermodeImageFilter.cpp +++ b/src/effects/SkXfermodeImageFilter.cpp @@ -195,7 +195,7 @@ void SkXfermodeImageFilter_Base::drawForeground(SkCanvas* canvas, SkSpecialImage } SkAutoCanvasRestore acr(canvas, true); - canvas->clipRect(SkRect::Make(fgBounds), SkCanvas::kDifference_Op); + canvas->clipRect(SkRect::Make(fgBounds), kDifference_SkClipOp); paint.setColor(0); canvas->drawPaint(paint); } diff --git a/src/gpu/GrClipStackClip.cpp b/src/gpu/GrClipStackClip.cpp index 548f5b7edc..13e602418d 100644 --- a/src/gpu/GrClipStackClip.cpp +++ b/src/gpu/GrClipStackClip.cpp @@ -167,10 +167,10 @@ bool GrClipStackClip::UseSWOnlyPath(GrContext* context, for (ElementList::Iter iter(reducedClip.elements()); iter.get(); iter.next()) { const Element* element = iter.get(); - SkCanvas::ClipOp op = element->getOp(); + SkClipOp op = element->getOp(); bool invert = element->isInverseFilled(); bool needsStencil = invert || - SkCanvas::kIntersect_Op == op || SkCanvas::kReverseDifference_Op == op; + kIntersect_SkClipOp == op || kReverseDifference_SkClipOp == op; if (PathNeedsSWRenderer(context, hasUserStencilSettings, renderTargetContext, translate, element, nullptr, needsStencil)) { @@ -191,7 +191,7 @@ static bool get_analytic_clip_processor(const ElementList& elements, SkSTArray<kMaxAnalyticElements, sk_sp<GrFragmentProcessor>> fps; ElementList::Iter iter(elements); while (iter.get()) { - SkCanvas::ClipOp op = iter.get()->getOp(); + SkClipOp op = iter.get()->getOp(); bool invert; bool skip = false; switch (op) { @@ -449,14 +449,14 @@ sk_sp<GrTexture> GrClipStackClip::CreateSoftwareClipMask(GrTextureProvider* texP for (ElementList::Iter iter(reducedClip.elements()); iter.get(); iter.next()) { const Element* element = iter.get(); - SkCanvas::ClipOp op = element->getOp(); + SkClipOp op = element->getOp(); - if (SkCanvas::kIntersect_Op == op || SkCanvas::kReverseDifference_Op == op) { + if (kIntersect_SkClipOp == op || kReverseDifference_SkClipOp == op) { // Intersect and reverse difference require modifying pixels outside of the geometry // that is being "drawn". In both cases we erase all the pixels outside of the geometry // but leave the pixels inside the geometry alone. For reverse difference we invert all // the pixels before clearing the ones outside the geometry. - if (SkCanvas::kReverseDifference_Op == op) { + if (kReverseDifference_SkClipOp == op) { SkRect temp = SkRect::Make(reducedClip.ibounds()); // invert the entire scene helper.drawRect(temp, SkRegion::kXOR_Op, false, 0xFF); diff --git a/src/gpu/GrReducedClip.cpp b/src/gpu/GrReducedClip.cpp index a82048b2f9..c5d764d3b7 100644 --- a/src/gpu/GrReducedClip.cpp +++ b/src/gpu/GrReducedClip.cpp @@ -75,7 +75,7 @@ GrReducedClip::GrReducedClip(const SkClipStack& stack, const SkRect& queryBounds fHasIBounds = true; // Implement the clip with an AA rect element. - fElements.addToHead(stackBounds, SkCanvas::kReplace_Op, true/*doAA*/); + fElements.addToHead(stackBounds, kReplace_SkClipOp, true/*doAA*/); fElementsGenID = stack.getTopmostGenID(); fRequiresAA = true; @@ -147,7 +147,7 @@ void GrReducedClip::walkStack(const SkClipStack& stack, const SkRect& queryBound bool isFlip = false; // does this op just flip the in/out state of every point in the bounds switch (element->getOp()) { - case SkCanvas::kDifference_Op: + case kDifference_SkClipOp: // check if the shape subtracted either contains the entire bounds (and makes // the clip empty) or is outside the bounds and therefore can be skipped. if (element->isInverseFilled()) { @@ -173,7 +173,7 @@ void GrReducedClip::walkStack(const SkClipStack& stack, const SkRect& queryBound emsmallens = true; } break; - case SkCanvas::kIntersect_Op: + case kIntersect_SkClipOp: // check if the shape intersected contains the entire bounds and therefore can // be skipped or it is outside the entire bounds and therefore makes the clip // empty. @@ -206,7 +206,7 @@ void GrReducedClip::walkStack(const SkClipStack& stack, const SkRect& queryBound emsmallens = true; } break; - case SkCanvas::kUnion_Op: + case kUnion_SkClipOp: // If the union-ed shape contains the entire bounds then after this element // the bounds is entirely inside the clip. If the union-ed shape is outside the // bounds then this op can be skipped. @@ -229,7 +229,7 @@ void GrReducedClip::walkStack(const SkClipStack& stack, const SkRect& queryBound embiggens = true; } break; - case SkCanvas::kXOR_Op: + case kXOR_SkClipOp: // If the bounds is entirely inside the shape being xor-ed then the effect is // to flip the inside/outside state of every point in the bounds. We may be // able to take advantage of this in the forward pass. If the xor-ed shape @@ -251,7 +251,7 @@ void GrReducedClip::walkStack(const SkClipStack& stack, const SkRect& queryBound emsmallens = embiggens = true; } break; - case SkCanvas::kReverseDifference_Op: + case kReverseDifference_SkClipOp: // When the bounds is entirely within the rev-diff shape then this behaves like xor // and reverses every point inside the bounds. If the shape is completely outside // the bounds then we know after this element is applied that the bounds will be @@ -276,7 +276,7 @@ void GrReducedClip::walkStack(const SkClipStack& stack, const SkRect& queryBound } break; - case SkCanvas::kReplace_Op: + case kReplace_SkClipOp: // Replace will always terminate our walk. We will either begin the forward walk // at the replace op or detect here than the shape is either completely inside // or completely outside the bounds. In this latter case it can be skipped by @@ -326,9 +326,9 @@ void GrReducedClip::walkStack(const SkClipStack& stack, const SkRect& queryBound // if it is a flip, change it to a bounds-filling rect if (isFlip) { - SkASSERT(SkCanvas::kXOR_Op == element->getOp() || - SkCanvas::kReverseDifference_Op == element->getOp()); - fElements.addToHead(SkRect::Make(fIBounds), SkCanvas::kReverseDifference_Op, false); + SkASSERT(kXOR_SkClipOp == element->getOp() || + kReverseDifference_SkClipOp == element->getOp()); + fElements.addToHead(SkRect::Make(fIBounds), kReverseDifference_SkClipOp, false); } else { Element* newElement = fElements.addToHead(*element); if (newElement->isAA()) { @@ -337,11 +337,11 @@ void GrReducedClip::walkStack(const SkClipStack& stack, const SkRect& queryBound // Intersecting an inverse shape is the same as differencing the non-inverse shape. // Replacing with an inverse shape is the same as setting initialState=kAllIn and // differencing the non-inverse shape. - bool isReplace = SkCanvas::kReplace_Op == newElement->getOp(); + bool isReplace = kReplace_SkClipOp == newElement->getOp(); if (newElement->isInverseFilled() && - (SkCanvas::kIntersect_Op == newElement->getOp() || isReplace)) { + (kIntersect_SkClipOp == newElement->getOp() || isReplace)) { newElement->invertShapeFillType(); - newElement->setOp(SkCanvas::kDifference_Op); + newElement->setOp(kDifference_SkClipOp); if (isReplace) { SkASSERT(InitialTriState::kAllOut == initialTriState); initialTriState = InitialTriState::kAllIn; @@ -360,36 +360,36 @@ void GrReducedClip::walkStack(const SkClipStack& stack, const SkRect& queryBound while (element) { bool skippable = false; switch (element->getOp()) { - case SkCanvas::kDifference_Op: + case kDifference_SkClipOp: // subtracting from the empty set yields the empty set. skippable = InitialTriState::kAllOut == initialTriState; break; - case SkCanvas::kIntersect_Op: + case kIntersect_SkClipOp: // intersecting with the empty set yields the empty set if (InitialTriState::kAllOut == initialTriState) { skippable = true; } else { // We can clear to zero and then simply draw the clip element. initialTriState = InitialTriState::kAllOut; - element->setOp(SkCanvas::kReplace_Op); + element->setOp(kReplace_SkClipOp); } break; - case SkCanvas::kUnion_Op: + case kUnion_SkClipOp: if (InitialTriState::kAllIn == initialTriState) { // unioning the infinite plane with anything is a no-op. skippable = true; } else { // unioning the empty set with a shape is the shape. - element->setOp(SkCanvas::kReplace_Op); + element->setOp(kReplace_SkClipOp); } break; - case SkCanvas::kXOR_Op: + case kXOR_SkClipOp: if (InitialTriState::kAllOut == initialTriState) { // xor could be changed to diff in the kAllIn case, not sure it's a win. - element->setOp(SkCanvas::kReplace_Op); + element->setOp(kReplace_SkClipOp); } break; - case SkCanvas::kReverseDifference_Op: + case kReverseDifference_SkClipOp: if (InitialTriState::kAllIn == initialTriState) { // subtracting the whole plane will yield the empty set. skippable = true; @@ -402,11 +402,11 @@ void GrReducedClip::walkStack(const SkClipStack& stack, const SkRect& queryBound if (skippable) { initialTriState = InitialTriState::kAllIn; } else { - element->setOp(SkCanvas::kReplace_Op); + element->setOp(kReplace_SkClipOp); } } break; - case SkCanvas::kReplace_Op: + case kReplace_SkClipOp: skippable = false; // we would have skipped it in the backwards walk if we // could've. break; @@ -431,12 +431,12 @@ void GrReducedClip::walkStack(const SkClipStack& stack, const SkRect& queryBound fInitialState = static_cast<GrReducedClip::InitialState>(initialTriState); } -static bool element_is_pure_subtract(SkCanvas::ClipOp op) { +static bool element_is_pure_subtract(SkClipOp op) { SkASSERT(op >= 0); - return op <= SkCanvas::kIntersect_Op; + return op <= kIntersect_SkClipOp; - GR_STATIC_ASSERT(0 == SkCanvas::kDifference_Op); - GR_STATIC_ASSERT(1 == SkCanvas::kIntersect_Op); + GR_STATIC_ASSERT(0 == kDifference_SkClipOp); + GR_STATIC_ASSERT(1 == kIntersect_SkClipOp); } void GrReducedClip::addInteriorWindowRectangles(int maxWindowRectangles) { @@ -446,7 +446,7 @@ void GrReducedClip::addInteriorWindowRectangles(int maxWindowRectangles) { ElementList::Iter iter(fElements, ElementList::Iter::kTail_IterStart); for (; iter.get() && element_is_pure_subtract(iter.get()->getOp()); iter.prev()) { const Element* element = iter.get(); - if (SkCanvas::kDifference_Op != element->getOp()) { + if (kDifference_SkClipOp != element->getOp()) { continue; } diff --git a/src/pdf/SkPDFCanvas.cpp b/src/pdf/SkPDFCanvas.cpp index c7e39259ce..d946f48197 100644 --- a/src/pdf/SkPDFCanvas.cpp +++ b/src/pdf/SkPDFCanvas.cpp @@ -19,15 +19,15 @@ SkPDFCanvas::~SkPDFCanvas() {} * we intercept all clip calls to ensure that the clip stays BW (i.e. never antialiased), since * an antialiased clip won't build a SkRegion (it builds SkAAClip). */ -void SkPDFCanvas::onClipRect(const SkRect& rect, ClipOp op, ClipEdgeStyle edgeStyle) { +void SkPDFCanvas::onClipRect(const SkRect& rect, SkClipOp op, ClipEdgeStyle edgeStyle) { this->INHERITED::onClipRect(rect, op, kHard_ClipEdgeStyle); } -void SkPDFCanvas::onClipRRect(const SkRRect& rrect, ClipOp op, ClipEdgeStyle edgeStyle) { +void SkPDFCanvas::onClipRRect(const SkRRect& rrect, SkClipOp op, ClipEdgeStyle edgeStyle) { this->INHERITED::onClipRRect(rrect, op, kHard_ClipEdgeStyle); } -void SkPDFCanvas::onClipPath(const SkPath& path, ClipOp op, ClipEdgeStyle edgeStyle) { +void SkPDFCanvas::onClipPath(const SkPath& path, SkClipOp op, ClipEdgeStyle edgeStyle) { this->INHERITED::onClipPath(path, op, kHard_ClipEdgeStyle); } diff --git a/src/pdf/SkPDFCanvas.h b/src/pdf/SkPDFCanvas.h index ead13c34a5..7c4d26f714 100644 --- a/src/pdf/SkPDFCanvas.h +++ b/src/pdf/SkPDFCanvas.h @@ -17,9 +17,9 @@ public: ~SkPDFCanvas(); protected: - void onClipRect(const SkRect&, ClipOp, ClipEdgeStyle) override; - void onClipRRect(const SkRRect&, ClipOp, ClipEdgeStyle) override; - void onClipPath(const SkPath&, ClipOp, ClipEdgeStyle) override; + void onClipRect(const SkRect&, SkClipOp, ClipEdgeStyle) override; + void onClipRRect(const SkRRect&, SkClipOp, ClipEdgeStyle) override; + void onClipPath(const SkPath&, SkClipOp, ClipEdgeStyle) override; void onDrawBitmapNine(const SkBitmap&, const SkIRect&, const SkRect&, const SkPaint*) override; diff --git a/src/pdf/SkPDFDevice.cpp b/src/pdf/SkPDFDevice.cpp index 9a70f68c31..7d7196bfe8 100644 --- a/src/pdf/SkPDFDevice.cpp +++ b/src/pdf/SkPDFDevice.cpp @@ -198,9 +198,9 @@ static_assert(SkRegion::kXOR_Op == (int)kXOR_SkPathOp, "region_pathop_mismatch") static_assert(SkRegion::kReverseDifference_Op == (int)kReverseDifference_SkPathOp, "region_pathop_mismatch"); -static SkPathOp region_op_to_pathops_op(SkCanvas::ClipOp op) { +static SkPathOp region_op_to_pathops_op(SkClipOp op) { SkASSERT(op >= 0); - SkASSERT(op <= SkCanvas::kReverseDifference_Op); + SkASSERT(op <= kReverseDifference_SkClipOp); return (SkPathOp)op; } @@ -231,7 +231,7 @@ static bool get_clip_stack_path(const SkMatrix& transform, } entryPath.transform(transform); - if (SkCanvas::kReplace_Op == clipEntry->getOp()) { + if (kReplace_SkClipOp == clipEntry->getOp()) { *outClipPath = entryPath; } else { SkPathOp op = region_op_to_pathops_op(clipEntry->getOp()); @@ -1762,7 +1762,7 @@ SkPDFDevice::ContentEntry* SkPDFDevice::setUpContentEntry(const SkClipStack* cli synthesizedClipStack = fExistingClipStack; SkPath clipPath; clipRegion.getBoundaryPath(&clipPath); - synthesizedClipStack.clipPath(clipPath, SkMatrix::I(), SkCanvas::kReplace_Op, false); + synthesizedClipStack.clipPath(clipPath, SkMatrix::I(), kReplace_SkClipOp, false); clipStack = &synthesizedClipStack; } } diff --git a/src/pipe/SkPipeCanvas.cpp b/src/pipe/SkPipeCanvas.cpp index 1614bbd6b8..33b58a4165 100644 --- a/src/pipe/SkPipeCanvas.cpp +++ b/src/pipe/SkPipeCanvas.cpp @@ -309,21 +309,21 @@ void SkPipeCanvas::didSetMatrix(const SkMatrix& matrix) { this->INHERITED::didSetMatrix(matrix); } -void SkPipeCanvas::onClipRect(const SkRect& rect, ClipOp op, ClipEdgeStyle edgeStyle) { +void SkPipeCanvas::onClipRect(const SkRect& rect, SkClipOp op, ClipEdgeStyle edgeStyle) { fStream->write32(pack_verb(SkPipeVerb::kClipRect, ((unsigned)op << 1) | edgeStyle)); fStream->write(&rect, 4 * sizeof(SkScalar)); this->INHERITED::onClipRect(rect, op, edgeStyle); } -void SkPipeCanvas::onClipRRect(const SkRRect& rrect, ClipOp op, ClipEdgeStyle edgeStyle) { +void SkPipeCanvas::onClipRRect(const SkRRect& rrect, SkClipOp op, ClipEdgeStyle edgeStyle) { fStream->write32(pack_verb(SkPipeVerb::kClipRRect, ((unsigned)op << 1) | edgeStyle)); write_rrect(fStream, rrect); this->INHERITED::onClipRRect(rrect, op, edgeStyle); } -void SkPipeCanvas::onClipPath(const SkPath& path, ClipOp op, ClipEdgeStyle edgeStyle) { +void SkPipeCanvas::onClipPath(const SkPath& path, SkClipOp op, ClipEdgeStyle edgeStyle) { SkPipeWriter writer(this); writer.write32(pack_verb(SkPipeVerb::kClipPath, ((unsigned)op << 1) | edgeStyle)); writer.writePath(path); @@ -331,7 +331,7 @@ void SkPipeCanvas::onClipPath(const SkPath& path, ClipOp op, ClipEdgeStyle edgeS this->INHERITED::onClipPath(path, op, edgeStyle); } -void SkPipeCanvas::onClipRegion(const SkRegion& deviceRgn, ClipOp op) { +void SkPipeCanvas::onClipRegion(const SkRegion& deviceRgn, SkClipOp op) { SkPipeWriter writer(this); writer.write32(pack_verb(SkPipeVerb::kClipRegion, (unsigned)op << 1)); writer.writeRegion(deviceRgn); diff --git a/src/pipe/SkPipeCanvas.h b/src/pipe/SkPipeCanvas.h index e7b99bdd93..a506da4ece 100644 --- a/src/pipe/SkPipeCanvas.h +++ b/src/pipe/SkPipeCanvas.h @@ -142,10 +142,10 @@ protected: const uint16_t indices[], int indexCount, const SkPaint&) override; - void onClipRect(const SkRect&, ClipOp, ClipEdgeStyle) override; - void onClipRRect(const SkRRect&, ClipOp, ClipEdgeStyle) override; - void onClipPath(const SkPath&, ClipOp, ClipEdgeStyle) override; - void onClipRegion(const SkRegion&, ClipOp) override; + void onClipRect(const SkRect&, SkClipOp, ClipEdgeStyle) override; + void onClipRRect(const SkRRect&, SkClipOp, ClipEdgeStyle) override; + void onClipPath(const SkPath&, SkClipOp, ClipEdgeStyle) override; + void onClipRegion(const SkRegion&, SkClipOp) override; void onDrawPicture(const SkPicture*, const SkMatrix*, const SkPaint*) override; void onDrawAnnotation(const SkRect&, const char[], SkData*) override; diff --git a/src/pipe/SkPipeReader.cpp b/src/pipe/SkPipeReader.cpp index 2039bf2b3a..6310b15bae 100644 --- a/src/pipe/SkPipeReader.cpp +++ b/src/pipe/SkPipeReader.cpp @@ -271,21 +271,21 @@ static void concat_handler(SkPipeReader& reader, uint32_t packedVerb, SkCanvas* static void clipRect_handler(SkPipeReader& reader, uint32_t packedVerb, SkCanvas* canvas) { SkASSERT(SkPipeVerb::kClipRect == unpack_verb(packedVerb)); - SkCanvas::ClipOp op = (SkCanvas::ClipOp)(unpack_verb_extra(packedVerb) >> 1); + SkClipOp op = (SkClipOp)(unpack_verb_extra(packedVerb) >> 1); bool isAA = unpack_verb_extra(packedVerb) & 1; canvas->clipRect(*skip<SkRect>(reader), op, isAA); } static void clipRRect_handler(SkPipeReader& reader, uint32_t packedVerb, SkCanvas* canvas) { SkASSERT(SkPipeVerb::kClipRRect == unpack_verb(packedVerb)); - SkCanvas::ClipOp op = (SkCanvas::ClipOp)(unpack_verb_extra(packedVerb) >> 1); + SkClipOp op = (SkClipOp)(unpack_verb_extra(packedVerb) >> 1); bool isAA = unpack_verb_extra(packedVerb) & 1; canvas->clipRRect(read_rrect(reader), op, isAA); } static void clipPath_handler(SkPipeReader& reader, uint32_t packedVerb, SkCanvas* canvas) { SkASSERT(SkPipeVerb::kClipPath == unpack_verb(packedVerb)); - SkCanvas::ClipOp op = (SkCanvas::ClipOp)(unpack_verb_extra(packedVerb) >> 1); + SkClipOp op = (SkClipOp)(unpack_verb_extra(packedVerb) >> 1); bool isAA = unpack_verb_extra(packedVerb) & 1; SkPath path; reader.readPath(&path); @@ -294,7 +294,7 @@ static void clipPath_handler(SkPipeReader& reader, uint32_t packedVerb, SkCanvas static void clipRegion_handler(SkPipeReader& reader, uint32_t packedVerb, SkCanvas* canvas) { SkASSERT(SkPipeVerb::kClipRegion == unpack_verb(packedVerb)); - SkCanvas::ClipOp op = (SkCanvas::ClipOp)(unpack_verb_extra(packedVerb) >> 1); + SkClipOp op = (SkClipOp)(unpack_verb_extra(packedVerb) >> 1); SkRegion region; reader.readRegion(®ion); canvas->clipRegion(region, op); diff --git a/src/svg/SkSVGDevice.cpp b/src/svg/SkSVGDevice.cpp index b9f1424e6e..b8f8938a17 100644 --- a/src/svg/SkSVGDevice.cpp +++ b/src/svg/SkSVGDevice.cpp @@ -731,7 +731,7 @@ void SkSVGDevice::drawBitmapRect(const SkDraw& draw, const SkBitmap& bm, const S SkClipStack adjustedClipStack; if (srcOrNull && *srcOrNull != SkRect::Make(bm.bounds())) { adjustedClipStack = *draw.fClipStack; - adjustedClipStack.clipRect(dst, *draw.fMatrix, SkCanvas::kIntersect_Op, + adjustedClipStack.clipRect(dst, *draw.fMatrix, kIntersect_SkClipOp, paint.isAntiAlias()); adjustedDraw.fClipStack = &adjustedClipStack; } diff --git a/src/utils/SkCanvasStack.cpp b/src/utils/SkCanvasStack.cpp index 8e4bd37540..48cc2588a7 100644 --- a/src/utils/SkCanvasStack.cpp +++ b/src/utils/SkCanvasStack.cpp @@ -77,22 +77,22 @@ void SkCanvasStack::didSetMatrix(const SkMatrix& matrix) { this->SkCanvas::didSetMatrix(matrix); } -void SkCanvasStack::onClipRect(const SkRect& r, ClipOp op, ClipEdgeStyle edgeStyle) { +void SkCanvasStack::onClipRect(const SkRect& r, SkClipOp op, ClipEdgeStyle edgeStyle) { this->INHERITED::onClipRect(r, op, edgeStyle); this->clipToZOrderedBounds(); } -void SkCanvasStack::onClipRRect(const SkRRect& rr, ClipOp op, ClipEdgeStyle edgeStyle) { +void SkCanvasStack::onClipRRect(const SkRRect& rr, SkClipOp op, ClipEdgeStyle edgeStyle) { this->INHERITED::onClipRRect(rr, op, edgeStyle); this->clipToZOrderedBounds(); } -void SkCanvasStack::onClipPath(const SkPath& p, ClipOp op, ClipEdgeStyle edgeStyle) { +void SkCanvasStack::onClipPath(const SkPath& p, SkClipOp op, ClipEdgeStyle edgeStyle) { this->INHERITED::onClipPath(p, op, edgeStyle); this->clipToZOrderedBounds(); } -void SkCanvasStack::onClipRegion(const SkRegion& deviceRgn, ClipOp op) { +void SkCanvasStack::onClipRegion(const SkRegion& deviceRgn, SkClipOp op) { SkASSERT(fList.count() == fCanvasData.count()); for (int i = 0; i < fList.count(); ++i) { SkRegion tempRegion; diff --git a/src/utils/SkCanvasStack.h b/src/utils/SkCanvasStack.h index 0e6e4b6381..73a3386c0f 100644 --- a/src/utils/SkCanvasStack.h +++ b/src/utils/SkCanvasStack.h @@ -37,10 +37,10 @@ public: protected: void didSetMatrix(const SkMatrix&) override; - void onClipRect(const SkRect&, ClipOp, ClipEdgeStyle) override; - void onClipRRect(const SkRRect&, ClipOp, ClipEdgeStyle) override; - void onClipPath(const SkPath&, ClipOp, ClipEdgeStyle) override; - void onClipRegion(const SkRegion&, ClipOp) override; + void onClipRect(const SkRect&, SkClipOp, ClipEdgeStyle) override; + void onClipRRect(const SkRRect&, SkClipOp, ClipEdgeStyle) override; + void onClipPath(const SkPath&, SkClipOp, ClipEdgeStyle) override; + void onClipRegion(const SkRegion&, SkClipOp) override; private: void clipToZOrderedBounds(); diff --git a/src/utils/SkCanvasStateUtils.cpp b/src/utils/SkCanvasStateUtils.cpp index d31eaa632c..19917273c7 100644 --- a/src/utils/SkCanvasStateUtils.cpp +++ b/src/utils/SkCanvasStateUtils.cpp @@ -135,15 +135,15 @@ public: bool failed() { return fFailed; } // ClipVisitor - void clipRect(const SkRect& rect, SkCanvas::ClipOp op, bool antialias) override { + void clipRect(const SkRect& rect, SkClipOp op, bool antialias) override { fFailed |= antialias; } - void clipRRect(const SkRRect& rrect, SkCanvas::ClipOp op, bool antialias) override { + void clipRRect(const SkRRect& rrect, SkClipOp op, bool antialias) override { fFailed |= antialias; } - void clipPath(const SkPath&, SkCanvas::ClipOp, bool antialias) override { + void clipPath(const SkPath&, SkClipOp, bool antialias) override { fFailed |= antialias; } @@ -275,7 +275,7 @@ static void setup_canvas_from_MC_state(const SkMCState& state, SkCanvas* canvas) } canvas->setMatrix(matrix); - canvas->clipRegion(clip, SkCanvas::kReplace_Op); + canvas->clipRegion(clip, kReplace_SkClipOp); } static std::unique_ptr<SkCanvas> diff --git a/src/utils/SkDeferredCanvas.cpp b/src/utils/SkDeferredCanvas.cpp index aad8199864..601f9c9a7a 100644 --- a/src/utils/SkDeferredCanvas.cpp +++ b/src/utils/SkDeferredCanvas.cpp @@ -111,7 +111,7 @@ void SkDeferredCanvas::emit(const Rec& rec) { case kClipRect_Type: fCanvas->clipRect(rec.fData.fBounds); this->INHERITED::onClipRect(rec.fData.fBounds, - kIntersect_Op, kHard_ClipEdgeStyle); + kIntersect_SkClipOp, kHard_ClipEdgeStyle); break; case kTrans_Type: case kScaleTrans_Type: { @@ -284,8 +284,8 @@ void SkDeferredCanvas::didSetMatrix(const SkMatrix& matrix) { this->INHERITED::didSetMatrix(matrix); } -void SkDeferredCanvas::onClipRect(const SkRect& rect, ClipOp op, ClipEdgeStyle edgeStyle) { - if (kIntersect_Op == op) { +void SkDeferredCanvas::onClipRect(const SkRect& rect, SkClipOp op, ClipEdgeStyle edgeStyle) { + if (kIntersect_SkClipOp == op) { this->push_cliprect(rect); } else { this->flush_all(); @@ -294,19 +294,19 @@ void SkDeferredCanvas::onClipRect(const SkRect& rect, ClipOp op, ClipEdgeStyle e } } -void SkDeferredCanvas::onClipRRect(const SkRRect& rrect, ClipOp op, ClipEdgeStyle edgeStyle) { +void SkDeferredCanvas::onClipRRect(const SkRRect& rrect, SkClipOp op, ClipEdgeStyle edgeStyle) { this->flush_all(); fCanvas->clipRRect(rrect, op, kSoft_ClipEdgeStyle == edgeStyle); this->INHERITED::onClipRRect(rrect, op, edgeStyle); } -void SkDeferredCanvas::onClipPath(const SkPath& path, ClipOp op, ClipEdgeStyle edgeStyle) { +void SkDeferredCanvas::onClipPath(const SkPath& path, SkClipOp op, ClipEdgeStyle edgeStyle) { this->flush_all(); fCanvas->clipPath(path, op, kSoft_ClipEdgeStyle == edgeStyle); this->INHERITED::onClipPath(path, op, edgeStyle); } -void SkDeferredCanvas::onClipRegion(const SkRegion& deviceRgn, ClipOp op) { +void SkDeferredCanvas::onClipRegion(const SkRegion& deviceRgn, SkClipOp op) { this->flush_all(); fCanvas->clipRegion(deviceRgn, op); this->INHERITED::onClipRegion(deviceRgn, op); diff --git a/src/utils/SkDeferredCanvas.h b/src/utils/SkDeferredCanvas.h index 2549540943..af48b20872 100644 --- a/src/utils/SkDeferredCanvas.h +++ b/src/utils/SkDeferredCanvas.h @@ -94,10 +94,10 @@ protected: const SkRect rects[], const SkColor colors[], int count, SkBlendMode, const SkRect* cull, const SkPaint* paint) override; - void onClipRect(const SkRect&, ClipOp, ClipEdgeStyle) override; - void onClipRRect(const SkRRect&, ClipOp, ClipEdgeStyle) override; - void onClipPath(const SkPath&, ClipOp, ClipEdgeStyle) override; - void onClipRegion(const SkRegion&, ClipOp) override; + void onClipRect(const SkRect&, SkClipOp, ClipEdgeStyle) override; + void onClipRRect(const SkRRect&, SkClipOp, ClipEdgeStyle) override; + void onClipPath(const SkPath&, SkClipOp, ClipEdgeStyle) override; + void onClipRegion(const SkRegion&, SkClipOp) override; void onDrawDrawable(SkDrawable*, const SkMatrix*) override; void onDrawPicture(const SkPicture*, const SkMatrix*, const SkPaint*) override; diff --git a/src/utils/SkDumpCanvas.cpp b/src/utils/SkDumpCanvas.cpp index 9542c9e0ae..658da8185e 100644 --- a/src/utils/SkDumpCanvas.cpp +++ b/src/utils/SkDumpCanvas.cpp @@ -104,7 +104,7 @@ static void toString(const SkPath& path, SkString* str) { } } -static const char* toString(SkCanvas::ClipOp op) { +static const char* toString(SkClipOp op) { static const char* gOpNames[] = { "DIFF", "SECT", "UNION", "XOR", "RDIFF", "REPLACE" }; @@ -257,7 +257,7 @@ const char* SkDumpCanvas::EdgeStyleToAAString(ClipEdgeStyle edgeStyle) { return kSoft_ClipEdgeStyle == edgeStyle ? "AA" : "BW"; } -void SkDumpCanvas::onClipRect(const SkRect& rect, ClipOp op, ClipEdgeStyle edgeStyle) { +void SkDumpCanvas::onClipRect(const SkRect& rect, SkClipOp op, ClipEdgeStyle edgeStyle) { SkString str; toString(rect, &str); this->dump(kClip_Verb, nullptr, "clipRect(%s %s %s)", str.c_str(), toString(op), @@ -265,7 +265,7 @@ void SkDumpCanvas::onClipRect(const SkRect& rect, ClipOp op, ClipEdgeStyle edgeS this->INHERITED::onClipRect(rect, op, edgeStyle); } -void SkDumpCanvas::onClipRRect(const SkRRect& rrect, ClipOp op, ClipEdgeStyle edgeStyle) { +void SkDumpCanvas::onClipRRect(const SkRRect& rrect, SkClipOp op, ClipEdgeStyle edgeStyle) { SkString str; toString(rrect, &str); this->dump(kClip_Verb, nullptr, "clipRRect(%s %s %s)", str.c_str(), toString(op), @@ -273,7 +273,7 @@ void SkDumpCanvas::onClipRRect(const SkRRect& rrect, ClipOp op, ClipEdgeStyle ed this->INHERITED::onClipRRect(rrect, op, edgeStyle); } -void SkDumpCanvas::onClipPath(const SkPath& path, ClipOp op, ClipEdgeStyle edgeStyle) { +void SkDumpCanvas::onClipPath(const SkPath& path, SkClipOp op, ClipEdgeStyle edgeStyle) { SkString str; toString(path, &str); this->dump(kClip_Verb, nullptr, "clipPath(%s %s %s)", str.c_str(), toString(op), @@ -281,11 +281,10 @@ void SkDumpCanvas::onClipPath(const SkPath& path, ClipOp op, ClipEdgeStyle edgeS this->INHERITED::onClipPath(path, op, edgeStyle); } -void SkDumpCanvas::onClipRegion(const SkRegion& deviceRgn, ClipOp op) { +void SkDumpCanvas::onClipRegion(const SkRegion& deviceRgn, SkClipOp op) { SkString str; toString(deviceRgn, &str); - this->dump(kClip_Verb, nullptr, "clipRegion(%s %s)", str.c_str(), - toString(op)); + this->dump(kClip_Verb, nullptr, "clipRegion(%s %s)", str.c_str(), toString(op)); this->INHERITED::onClipRegion(deviceRgn, op); } diff --git a/src/utils/SkLuaCanvas.cpp b/src/utils/SkLuaCanvas.cpp index 3949df5b30..70f701f547 100644 --- a/src/utils/SkLuaCanvas.cpp +++ b/src/utils/SkLuaCanvas.cpp @@ -135,28 +135,28 @@ void SkLuaCanvas::didSetMatrix(const SkMatrix& matrix) { this->INHERITED::didSetMatrix(matrix); } -void SkLuaCanvas::onClipRect(const SkRect& r, ClipOp op, ClipEdgeStyle edgeStyle) { +void SkLuaCanvas::onClipRect(const SkRect& r, SkClipOp op, ClipEdgeStyle edgeStyle) { AUTO_LUA("clipRect"); lua.pushRect(r, "rect"); lua.pushBool(kSoft_ClipEdgeStyle == edgeStyle, "aa"); this->INHERITED::onClipRect(r, op, edgeStyle); } -void SkLuaCanvas::onClipRRect(const SkRRect& rrect, ClipOp op, ClipEdgeStyle edgeStyle) { +void SkLuaCanvas::onClipRRect(const SkRRect& rrect, SkClipOp op, ClipEdgeStyle edgeStyle) { AUTO_LUA("clipRRect"); lua.pushRRect(rrect, "rrect"); lua.pushBool(kSoft_ClipEdgeStyle == edgeStyle, "aa"); this->INHERITED::onClipRRect(rrect, op, edgeStyle); } -void SkLuaCanvas::onClipPath(const SkPath& path, ClipOp op, ClipEdgeStyle edgeStyle) { +void SkLuaCanvas::onClipPath(const SkPath& path, SkClipOp op, ClipEdgeStyle edgeStyle) { AUTO_LUA("clipPath"); lua.pushPath(path, "path"); lua.pushBool(kSoft_ClipEdgeStyle == edgeStyle, "aa"); this->INHERITED::onClipPath(path, op, edgeStyle); } -void SkLuaCanvas::onClipRegion(const SkRegion& deviceRgn, ClipOp op) { +void SkLuaCanvas::onClipRegion(const SkRegion& deviceRgn, SkClipOp op) { AUTO_LUA("clipRegion"); this->INHERITED::onClipRegion(deviceRgn, op); } diff --git a/src/utils/SkNWayCanvas.cpp b/src/utils/SkNWayCanvas.cpp index 3e814d4944..4f51d85f4f 100644 --- a/src/utils/SkNWayCanvas.cpp +++ b/src/utils/SkNWayCanvas.cpp @@ -96,7 +96,7 @@ void SkNWayCanvas::didSetMatrix(const SkMatrix& matrix) { this->INHERITED::didSetMatrix(matrix); } -void SkNWayCanvas::onClipRect(const SkRect& rect, ClipOp op, ClipEdgeStyle edgeStyle) { +void SkNWayCanvas::onClipRect(const SkRect& rect, SkClipOp op, ClipEdgeStyle edgeStyle) { Iter iter(fList); while (iter.next()) { iter->clipRect(rect, op, kSoft_ClipEdgeStyle == edgeStyle); @@ -104,7 +104,7 @@ void SkNWayCanvas::onClipRect(const SkRect& rect, ClipOp op, ClipEdgeStyle edgeS this->INHERITED::onClipRect(rect, op, edgeStyle); } -void SkNWayCanvas::onClipRRect(const SkRRect& rrect, ClipOp op, ClipEdgeStyle edgeStyle) { +void SkNWayCanvas::onClipRRect(const SkRRect& rrect, SkClipOp op, ClipEdgeStyle edgeStyle) { Iter iter(fList); while (iter.next()) { iter->clipRRect(rrect, op, kSoft_ClipEdgeStyle == edgeStyle); @@ -112,7 +112,7 @@ void SkNWayCanvas::onClipRRect(const SkRRect& rrect, ClipOp op, ClipEdgeStyle ed this->INHERITED::onClipRRect(rrect, op, edgeStyle); } -void SkNWayCanvas::onClipPath(const SkPath& path, ClipOp op, ClipEdgeStyle edgeStyle) { +void SkNWayCanvas::onClipPath(const SkPath& path, SkClipOp op, ClipEdgeStyle edgeStyle) { Iter iter(fList); while (iter.next()) { iter->clipPath(path, op, kSoft_ClipEdgeStyle == edgeStyle); @@ -120,7 +120,7 @@ void SkNWayCanvas::onClipPath(const SkPath& path, ClipOp op, ClipEdgeStyle edgeS this->INHERITED::onClipPath(path, op, edgeStyle); } -void SkNWayCanvas::onClipRegion(const SkRegion& deviceRgn, ClipOp op) { +void SkNWayCanvas::onClipRegion(const SkRegion& deviceRgn, SkClipOp op) { Iter iter(fList); while (iter.next()) { iter->clipRegion(deviceRgn, op); diff --git a/tests/CanvasStateHelpers.cpp b/tests/CanvasStateHelpers.cpp index 98b5d231be..1547d2f8e0 100644 --- a/tests/CanvasStateHelpers.cpp +++ b/tests/CanvasStateHelpers.cpp @@ -44,7 +44,7 @@ void complex_clips_draw(SkCanvas* canvas, int32_t left, int32_t top, canvas->drawColor(SK_ColorBLUE); canvas->restore(); - canvas->clipRegion(localRegion, (SkCanvas::ClipOp) clipOp); + canvas->clipRegion(localRegion, (SkClipOp) clipOp); canvas->drawColor(SK_ColorBLUE); } diff --git a/tests/CanvasStateTest.cpp b/tests/CanvasStateTest.cpp index 2c7c5905ef..a35fc080d2 100644 --- a/tests/CanvasStateTest.cpp +++ b/tests/CanvasStateTest.cpp @@ -299,7 +299,7 @@ DEF_TEST(CanvasState_test_soft_clips, reporter) { SkRRect roundRect; roundRect.setOval(SkRect::MakeWH(5, 5)); - canvas.clipRRect(roundRect, SkCanvas::kIntersect_Op, true); + canvas.clipRRect(roundRect, kIntersect_SkClipOp, true); SkCanvasState* state = SkCanvasStateUtils::CaptureCanvasState(&canvas); REPORTER_ASSERT(reporter, !state); diff --git a/tests/CanvasTest.cpp b/tests/CanvasTest.cpp index f460ab6e3b..bb34cb657c 100644 --- a/tests/CanvasTest.cpp +++ b/tests/CanvasTest.cpp @@ -173,13 +173,13 @@ class Canvas2CanvasClipVisitor : public SkCanvas::ClipVisitor { public: Canvas2CanvasClipVisitor(SkCanvas* target) : fTarget(target) {} - void clipRect(const SkRect& r, SkCanvas::ClipOp op, bool aa) override { + void clipRect(const SkRect& r, SkClipOp op, bool aa) override { fTarget->clipRect(r, op, aa); } - void clipRRect(const SkRRect& r, SkCanvas::ClipOp op, bool aa) override { + void clipRRect(const SkRRect& r, SkClipOp op, bool aa) override { fTarget->clipRRect(r, op, aa); } - void clipPath(const SkPath& p, SkCanvas::ClipOp op, bool aa) override { + void clipPath(const SkPath& p, SkClipOp op, bool aa) override { fTarget->clipPath(p, op, aa); } @@ -299,7 +299,7 @@ SIMPLE_TEST_STEP(Concat, concat(d.fMatrix)); SIMPLE_TEST_STEP(SetMatrix, setMatrix(d.fMatrix)); SIMPLE_TEST_STEP(ClipRect, clipRect(d.fRect)); SIMPLE_TEST_STEP(ClipPath, clipPath(d.fPath)); -SIMPLE_TEST_STEP(ClipRegion, clipRegion(d.fRegion, SkCanvas::kReplace_Op)); +SIMPLE_TEST_STEP(ClipRegion, clipRegion(d.fRegion, kReplace_SkClipOp)); SIMPLE_TEST_STEP(Clear, clear(d.fColor)); /////////////////////////////////////////////////////////////////////////////// diff --git a/tests/ClipBoundsTest.cpp b/tests/ClipBoundsTest.cpp index fd3e191ee6..e8aae38994 100644 --- a/tests/ClipBoundsTest.cpp +++ b/tests/ClipBoundsTest.cpp @@ -26,7 +26,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GrClipBounds, reporter, ctxInfo) { // create a clip stack that will (trivially) reduce to a single rect that // is larger than the screen SkClipStack stack; - stack.clipRect(clipRect, SkMatrix::I(), SkCanvas::kReplace_Op, false); + stack.clipRect(clipRect, SkMatrix::I(), kReplace_SkClipOp, false); bool isIntersectionOfRects = true; SkRect devStackBounds; diff --git a/tests/ClipStackTest.cpp b/tests/ClipStackTest.cpp index 247acb0658..bb5cc4ad9e 100644 --- a/tests/ClipStackTest.cpp +++ b/tests/ClipStackTest.cpp @@ -33,21 +33,21 @@ static void test_assign_and_comparison(skiatest::Reporter* reporter) { p.lineTo(7, 8); p.lineTo(5, 9); p.close(); - s.clipPath(p, SkMatrix::I(), SkCanvas::kIntersect_Op, doAA); + s.clipPath(p, SkMatrix::I(), kIntersect_SkClipOp, doAA); s.save(); REPORTER_ASSERT(reporter, 2 == s.getSaveCount()); SkRect r = SkRect::MakeLTRB(1, 2, 3, 4); - s.clipRect(r, SkMatrix::I(), SkCanvas::kIntersect_Op, doAA); + s.clipRect(r, SkMatrix::I(), kIntersect_SkClipOp, doAA); r = SkRect::MakeLTRB(10, 11, 12, 13); - s.clipRect(r, SkMatrix::I(), SkCanvas::kIntersect_Op, doAA); + s.clipRect(r, SkMatrix::I(), kIntersect_SkClipOp, doAA); s.save(); REPORTER_ASSERT(reporter, 3 == s.getSaveCount()); r = SkRect::MakeLTRB(14, 15, 16, 17); - s.clipRect(r, SkMatrix::I(), SkCanvas::kUnion_Op, doAA); + s.clipRect(r, SkMatrix::I(), kUnion_SkClipOp, doAA); // Test that assignment works. SkClipStack copy = s; @@ -62,7 +62,7 @@ static void test_assign_and_comparison(skiatest::Reporter* reporter) { s.save(); REPORTER_ASSERT(reporter, 3 == s.getSaveCount()); r = SkRect::MakeLTRB(14, 15, 16, 17); - s.clipRect(r, SkMatrix::I(), SkCanvas::kUnion_Op, doAA); + s.clipRect(r, SkMatrix::I(), kUnion_SkClipOp, doAA); REPORTER_ASSERT(reporter, s == copy); // Test that a different op on one level triggers not equal. @@ -71,7 +71,7 @@ static void test_assign_and_comparison(skiatest::Reporter* reporter) { s.save(); REPORTER_ASSERT(reporter, 3 == s.getSaveCount()); r = SkRect::MakeLTRB(14, 15, 16, 17); - s.clipRect(r, SkMatrix::I(), SkCanvas::kIntersect_Op, doAA); + s.clipRect(r, SkMatrix::I(), kIntersect_SkClipOp, doAA); REPORTER_ASSERT(reporter, s != copy); // Test that version constructed with rect-path rather than a rect is still considered equal. @@ -79,7 +79,7 @@ static void test_assign_and_comparison(skiatest::Reporter* reporter) { s.save(); SkPath rp; rp.addRect(r); - s.clipPath(rp, SkMatrix::I(), SkCanvas::kUnion_Op, doAA); + s.clipPath(rp, SkMatrix::I(), kUnion_SkClipOp, doAA); REPORTER_ASSERT(reporter, s == copy); // Test that different rects triggers not equal. @@ -89,7 +89,7 @@ static void test_assign_and_comparison(skiatest::Reporter* reporter) { REPORTER_ASSERT(reporter, 3 == s.getSaveCount()); r = SkRect::MakeLTRB(24, 25, 26, 27); - s.clipRect(r, SkMatrix::I(), SkCanvas::kUnion_Op, doAA); + s.clipRect(r, SkMatrix::I(), kUnion_SkClipOp, doAA); REPORTER_ASSERT(reporter, s != copy); // Sanity check @@ -112,7 +112,7 @@ static void test_assign_and_comparison(skiatest::Reporter* reporter) { REPORTER_ASSERT(reporter, 1 == s.getSaveCount()); p.addRect(r); - s.clipPath(p, SkMatrix::I(), SkCanvas::kIntersect_Op, doAA); + s.clipPath(p, SkMatrix::I(), kIntersect_SkClipOp, doAA); REPORTER_ASSERT(reporter, s != copy); } @@ -140,7 +140,7 @@ static void test_iterators(skiatest::Reporter* reporter) { for (size_t i = 0; i < SK_ARRAY_COUNT(gRects); i++) { // the union op will prevent these from being fused together - stack.clipRect(gRects[i], SkMatrix::I(), SkCanvas::kUnion_Op, false); + stack.clipRect(gRects[i], SkMatrix::I(), kUnion_SkClipOp, false); } assert_count(reporter, stack, 4); @@ -181,7 +181,7 @@ static void test_iterators(skiatest::Reporter* reporter) { SkClipStack::Iter iter(stack, SkClipStack::Iter::kBottom_IterStart); - element = iter.skipToTopmost(SkCanvas::kUnion_Op); + element = iter.skipToTopmost(kUnion_SkClipOp); REPORTER_ASSERT(reporter, SkClipStack::Element::kRect_Type == element->getType()); REPORTER_ASSERT(reporter, element->getRect() == gRects[3]); } @@ -220,12 +220,12 @@ static void test_bounds(skiatest::Reporter* reporter, SkClipStack::Element::Type { 10, 10, 50, 50 }, }; - static const SkCanvas::ClipOp gOps[] = { - SkCanvas::kIntersect_Op, - SkCanvas::kDifference_Op, - SkCanvas::kUnion_Op, - SkCanvas::kXOR_Op, - SkCanvas::kReverseDifference_Op + static const SkClipOp gOps[] = { + kIntersect_SkClipOp, + kDifference_SkClipOp, + kUnion_SkClipOp, + kXOR_SkClipOp, + kReverseDifference_SkClipOp }; SkRect rectA, rectB; @@ -265,15 +265,15 @@ static void test_bounds(skiatest::Reporter* reporter, SkClipStack::Element::Type SkDEBUGFAIL("Don't call this with kEmpty."); break; case SkClipStack::Element::kRect_Type: - stack.clipRect(rectA, SkMatrix::I(), SkCanvas::kIntersect_Op, false); + stack.clipRect(rectA, SkMatrix::I(), kIntersect_SkClipOp, false); stack.clipRect(rectB, SkMatrix::I(), gOps[op], false); break; case SkClipStack::Element::kRRect_Type: - stack.clipRRect(rrectA, SkMatrix::I(), SkCanvas::kIntersect_Op, false); + stack.clipRRect(rrectA, SkMatrix::I(), kIntersect_SkClipOp, false); stack.clipRRect(rrectB, SkMatrix::I(), gOps[op], false); break; case SkClipStack::Element::kPath_Type: - stack.clipPath(pathA, SkMatrix::I(), SkCanvas::kIntersect_Op, false); + stack.clipPath(pathA, SkMatrix::I(), kIntersect_SkClipOp, false); stack.clipPath(pathB, SkMatrix::I(), gOps[op], false); break; } @@ -286,7 +286,7 @@ static void test_bounds(skiatest::Reporter* reporter, SkClipStack::Element::Type if (SkClipStack::Element::kRect_Type == primType) { REPORTER_ASSERT(reporter, isIntersectionOfRects == - (gOps[op] == SkCanvas::kIntersect_Op)); + (gOps[op] == kIntersect_SkClipOp)); } else { REPORTER_ASSERT(reporter, !isIntersectionOfRects); } @@ -334,8 +334,8 @@ static void test_isWideOpen(skiatest::Reporter* reporter) { clipB.addRoundRect(rectB, SkIntToScalar(5), SkIntToScalar(5)); clipB.setFillType(SkPath::kInverseEvenOdd_FillType); - stack.clipPath(clipA, SkMatrix::I(), SkCanvas::kReplace_Op, false); - stack.clipPath(clipB, SkMatrix::I(), SkCanvas::kUnion_Op, false); + stack.clipPath(clipA, SkMatrix::I(), kReplace_SkClipOp, false); + stack.clipPath(clipB, SkMatrix::I(), kUnion_SkClipOp, false); REPORTER_ASSERT(reporter, stack.isWideOpen()); REPORTER_ASSERT(reporter, SkClipStack::kWideOpenGenID == stack.getTopmostGenID()); @@ -345,7 +345,7 @@ static void test_isWideOpen(skiatest::Reporter* reporter) { { SkClipStack stack; - stack.clipRect(rectA, SkMatrix::I(), SkCanvas::kUnion_Op, false); + stack.clipRect(rectA, SkMatrix::I(), kUnion_SkClipOp, false); REPORTER_ASSERT(reporter, stack.isWideOpen()); REPORTER_ASSERT(reporter, SkClipStack::kWideOpenGenID == stack.getTopmostGenID()); @@ -358,7 +358,7 @@ static void test_isWideOpen(skiatest::Reporter* reporter) { SkRect emptyRect; emptyRect.setEmpty(); - stack.clipRect(emptyRect, SkMatrix::I(), SkCanvas::kDifference_Op, false); + stack.clipRect(emptyRect, SkMatrix::I(), kDifference_SkClipOp, false); REPORTER_ASSERT(reporter, stack.isWideOpen()); REPORTER_ASSERT(reporter, SkClipStack::kWideOpenGenID == stack.getTopmostGenID()); @@ -370,7 +370,7 @@ static void test_isWideOpen(skiatest::Reporter* reporter) { stack.save(); - stack.clipRect(rectA, SkMatrix::I(), SkCanvas::kReplace_Op, false); + stack.clipRect(rectA, SkMatrix::I(), kReplace_SkClipOp, false); REPORTER_ASSERT(reporter, !stack.isWideOpen()); REPORTER_ASSERT(reporter, SkClipStack::kWideOpenGenID != stack.getTopmostGenID()); @@ -404,7 +404,7 @@ static void test_rect_inverse_fill(skiatest::Reporter* reporter) { path.addRect(rect); path.toggleInverseFillType(); SkClipStack stack; - stack.clipPath(path, SkMatrix::I(), SkCanvas::kIntersect_Op, false); + stack.clipPath(path, SkMatrix::I(), kIntersect_SkClipOp, false); SkRect bounds; SkClipStack::BoundsType boundsType; @@ -426,9 +426,9 @@ static void test_rect_replace(skiatest::Reporter* reporter) { { SkClipStack stack; REPORTER_ASSERT(reporter, 0 == count(stack)); - stack.clipRect(rect, SkMatrix::I(), SkCanvas::kReplace_Op, false); + stack.clipRect(rect, SkMatrix::I(), kReplace_SkClipOp, false); REPORTER_ASSERT(reporter, 1 == count(stack)); - stack.clipRect(rect, SkMatrix::I(), SkCanvas::kReplace_Op, false); + stack.clipRect(rect, SkMatrix::I(), kReplace_SkClipOp, false); REPORTER_ASSERT(reporter, 1 == count(stack)); } @@ -437,9 +437,9 @@ static void test_rect_replace(skiatest::Reporter* reporter) { { SkClipStack stack; REPORTER_ASSERT(reporter, 0 == count(stack)); - stack.clipRect(rect, SkMatrix::I(), SkCanvas::kReplace_Op, true); + stack.clipRect(rect, SkMatrix::I(), kReplace_SkClipOp, true); REPORTER_ASSERT(reporter, 1 == count(stack)); - stack.clipRect(rect, SkMatrix::I(), SkCanvas::kReplace_Op, true); + stack.clipRect(rect, SkMatrix::I(), kReplace_SkClipOp, true); REPORTER_ASSERT(reporter, 1 == count(stack)); } @@ -448,23 +448,23 @@ static void test_rect_replace(skiatest::Reporter* reporter) { { SkClipStack stack; REPORTER_ASSERT(reporter, 0 == count(stack)); - stack.clipRect(rect, SkMatrix::I(), SkCanvas::kReplace_Op, false); + stack.clipRect(rect, SkMatrix::I(), kReplace_SkClipOp, false); REPORTER_ASSERT(reporter, 1 == count(stack)); - stack.clipRect(rect, SkMatrix::I(), SkCanvas::kReplace_Op, true); + stack.clipRect(rect, SkMatrix::I(), kReplace_SkClipOp, true); REPORTER_ASSERT(reporter, 1 == count(stack)); - stack.clipRect(rect, SkMatrix::I(), SkCanvas::kReplace_Op, false); + stack.clipRect(rect, SkMatrix::I(), kReplace_SkClipOp, false); REPORTER_ASSERT(reporter, 1 == count(stack)); } // Make sure replace clip rects don't collapse too much. { SkClipStack stack; - stack.clipRect(rect, SkMatrix::I(), SkCanvas::kReplace_Op, false); - stack.clipRect(rect2, SkMatrix::I(), SkCanvas::kIntersect_Op, false); + stack.clipRect(rect, SkMatrix::I(), kReplace_SkClipOp, false); + stack.clipRect(rect2, SkMatrix::I(), kIntersect_SkClipOp, false); REPORTER_ASSERT(reporter, 1 == count(stack)); stack.save(); - stack.clipRect(rect, SkMatrix::I(), SkCanvas::kReplace_Op, false); + stack.clipRect(rect, SkMatrix::I(), kReplace_SkClipOp, false); REPORTER_ASSERT(reporter, 2 == count(stack)); stack.getBounds(&bound, &type, &isIntersectionOfRects); REPORTER_ASSERT(reporter, bound == rect); @@ -472,16 +472,16 @@ static void test_rect_replace(skiatest::Reporter* reporter) { REPORTER_ASSERT(reporter, 1 == count(stack)); stack.save(); - stack.clipRect(rect, SkMatrix::I(), SkCanvas::kReplace_Op, false); - stack.clipRect(rect, SkMatrix::I(), SkCanvas::kReplace_Op, false); + stack.clipRect(rect, SkMatrix::I(), kReplace_SkClipOp, false); + stack.clipRect(rect, SkMatrix::I(), kReplace_SkClipOp, false); REPORTER_ASSERT(reporter, 2 == count(stack)); stack.restore(); REPORTER_ASSERT(reporter, 1 == count(stack)); stack.save(); - stack.clipRect(rect, SkMatrix::I(), SkCanvas::kReplace_Op, false); - stack.clipRect(rect2, SkMatrix::I(), SkCanvas::kIntersect_Op, false); - stack.clipRect(rect, SkMatrix::I(), SkCanvas::kReplace_Op, false); + stack.clipRect(rect, SkMatrix::I(), kReplace_SkClipOp, false); + stack.clipRect(rect2, SkMatrix::I(), kIntersect_SkClipOp, false); + stack.clipRect(rect, SkMatrix::I(), kReplace_SkClipOp, false); REPORTER_ASSERT(reporter, 2 == count(stack)); stack.restore(); REPORTER_ASSERT(reporter, 1 == count(stack)); @@ -498,18 +498,18 @@ static void test_path_replace(skiatest::Reporter* reporter) { { SkClipStack stack; REPORTER_ASSERT(reporter, 0 == count(stack)); - stack.clipPath(path, SkMatrix::I(), SkCanvas::kReplace_Op, false); + stack.clipPath(path, SkMatrix::I(), kReplace_SkClipOp, false); REPORTER_ASSERT(reporter, 1 == count(stack)); - stack.clipPath(path, SkMatrix::I(), SkCanvas::kReplace_Op, false); + stack.clipPath(path, SkMatrix::I(), kReplace_SkClipOp, false); REPORTER_ASSERT(reporter, 1 == count(stack)); } // Replacing rect with path. { SkClipStack stack; - stack.clipRect(rect, SkMatrix::I(), SkCanvas::kReplace_Op, true); + stack.clipRect(rect, SkMatrix::I(), kReplace_SkClipOp, true); REPORTER_ASSERT(reporter, 1 == count(stack)); - stack.clipPath(path, SkMatrix::I(), SkCanvas::kReplace_Op, true); + stack.clipPath(path, SkMatrix::I(), kReplace_SkClipOp, true); REPORTER_ASSERT(reporter, 1 == count(stack)); } } @@ -532,9 +532,9 @@ static void test_rect_merging(skiatest::Reporter* reporter) { { SkClipStack stack; - stack.clipRect(overlapLeft, SkMatrix::I(), SkCanvas::kReplace_Op, false); + stack.clipRect(overlapLeft, SkMatrix::I(), kReplace_SkClipOp, false); - stack.clipRect(overlapRight, SkMatrix::I(), SkCanvas::kIntersect_Op, false); + stack.clipRect(overlapRight, SkMatrix::I(), kIntersect_SkClipOp, false); REPORTER_ASSERT(reporter, 1 == count(stack)); @@ -547,9 +547,9 @@ static void test_rect_merging(skiatest::Reporter* reporter) { { SkClipStack stack; - stack.clipRect(overlapLeft, SkMatrix::I(), SkCanvas::kReplace_Op, true); + stack.clipRect(overlapLeft, SkMatrix::I(), kReplace_SkClipOp, true); - stack.clipRect(overlapRight, SkMatrix::I(), SkCanvas::kIntersect_Op, true); + stack.clipRect(overlapRight, SkMatrix::I(), kIntersect_SkClipOp, true); REPORTER_ASSERT(reporter, 1 == count(stack)); @@ -562,9 +562,9 @@ static void test_rect_merging(skiatest::Reporter* reporter) { { SkClipStack stack; - stack.clipRect(overlapLeft, SkMatrix::I(), SkCanvas::kReplace_Op, true); + stack.clipRect(overlapLeft, SkMatrix::I(), kReplace_SkClipOp, true); - stack.clipRect(overlapRight, SkMatrix::I(), SkCanvas::kIntersect_Op, false); + stack.clipRect(overlapRight, SkMatrix::I(), kIntersect_SkClipOp, false); REPORTER_ASSERT(reporter, 2 == count(stack)); @@ -577,9 +577,9 @@ static void test_rect_merging(skiatest::Reporter* reporter) { { SkClipStack stack; - stack.clipRect(nestedParent, SkMatrix::I(), SkCanvas::kReplace_Op, true); + stack.clipRect(nestedParent, SkMatrix::I(), kReplace_SkClipOp, true); - stack.clipRect(nestedChild, SkMatrix::I(), SkCanvas::kIntersect_Op, false); + stack.clipRect(nestedChild, SkMatrix::I(), kIntersect_SkClipOp, false); REPORTER_ASSERT(reporter, 1 == count(stack)); @@ -592,9 +592,9 @@ static void test_rect_merging(skiatest::Reporter* reporter) { { SkClipStack stack; - stack.clipRect(nestedParent, SkMatrix::I(), SkCanvas::kReplace_Op, false); + stack.clipRect(nestedParent, SkMatrix::I(), kReplace_SkClipOp, false); - stack.clipRect(nestedChild, SkMatrix::I(), SkCanvas::kIntersect_Op, true); + stack.clipRect(nestedChild, SkMatrix::I(), kIntersect_SkClipOp, true); REPORTER_ASSERT(reporter, 1 == count(stack)); @@ -607,9 +607,9 @@ static void test_rect_merging(skiatest::Reporter* reporter) { { SkClipStack stack; - stack.clipRect(nestedChild, SkMatrix::I(), SkCanvas::kReplace_Op, false); + stack.clipRect(nestedChild, SkMatrix::I(), kReplace_SkClipOp, false); - stack.clipRect(nestedParent, SkMatrix::I(), SkCanvas::kIntersect_Op, true); + stack.clipRect(nestedParent, SkMatrix::I(), kIntersect_SkClipOp, true); REPORTER_ASSERT(reporter, 2 == count(stack)); @@ -637,32 +637,32 @@ static void test_quickContains(skiatest::Reporter* reporter) { { SkClipStack stack; - stack.clipRect(outsideRect, SkMatrix::I(), SkCanvas::kDifference_Op, false); - // return false because quickContains currently does not care for kDifference_Op + stack.clipRect(outsideRect, SkMatrix::I(), kDifference_SkClipOp, false); + // return false because quickContains currently does not care for kDifference_SkClipOp REPORTER_ASSERT(reporter, false == stack.quickContains(testRect)); } // Replace Op tests { SkClipStack stack; - stack.clipRect(outsideRect, SkMatrix::I(), SkCanvas::kReplace_Op, false); + stack.clipRect(outsideRect, SkMatrix::I(), kReplace_SkClipOp, false); REPORTER_ASSERT(reporter, true == stack.quickContains(testRect)); } { SkClipStack stack; - stack.clipRect(insideRect, SkMatrix::I(), SkCanvas::kIntersect_Op, false); + stack.clipRect(insideRect, SkMatrix::I(), kIntersect_SkClipOp, false); stack.save(); // To prevent in-place substitution by replace OP - stack.clipRect(outsideRect, SkMatrix::I(), SkCanvas::kReplace_Op, false); + stack.clipRect(outsideRect, SkMatrix::I(), kReplace_SkClipOp, false); REPORTER_ASSERT(reporter, true == stack.quickContains(testRect)); stack.restore(); } { SkClipStack stack; - stack.clipRect(outsideRect, SkMatrix::I(), SkCanvas::kIntersect_Op, false); + stack.clipRect(outsideRect, SkMatrix::I(), kIntersect_SkClipOp, false); stack.save(); // To prevent in-place substitution by replace OP - stack.clipRect(insideRect, SkMatrix::I(), SkCanvas::kReplace_Op, false); + stack.clipRect(insideRect, SkMatrix::I(), kReplace_SkClipOp, false); REPORTER_ASSERT(reporter, false == stack.quickContains(testRect)); stack.restore(); } @@ -670,59 +670,59 @@ static void test_quickContains(skiatest::Reporter* reporter) { // Verify proper traversal of multi-element clip { SkClipStack stack; - stack.clipRect(insideRect, SkMatrix::I(), SkCanvas::kIntersect_Op, false); + stack.clipRect(insideRect, SkMatrix::I(), kIntersect_SkClipOp, false); // Use a path for second clip to prevent in-place intersection - stack.clipPath(outsideCircle, SkMatrix::I(), SkCanvas::kIntersect_Op, false); + stack.clipPath(outsideCircle, SkMatrix::I(), kIntersect_SkClipOp, false); REPORTER_ASSERT(reporter, false == stack.quickContains(testRect)); } // Intersect Op tests with rectangles { SkClipStack stack; - stack.clipRect(outsideRect, SkMatrix::I(), SkCanvas::kIntersect_Op, false); + stack.clipRect(outsideRect, SkMatrix::I(), kIntersect_SkClipOp, false); REPORTER_ASSERT(reporter, true == stack.quickContains(testRect)); } { SkClipStack stack; - stack.clipRect(insideRect, SkMatrix::I(), SkCanvas::kIntersect_Op, false); + stack.clipRect(insideRect, SkMatrix::I(), kIntersect_SkClipOp, false); REPORTER_ASSERT(reporter, false == stack.quickContains(testRect)); } { SkClipStack stack; - stack.clipRect(intersectingRect, SkMatrix::I(), SkCanvas::kIntersect_Op, false); + stack.clipRect(intersectingRect, SkMatrix::I(), kIntersect_SkClipOp, false); REPORTER_ASSERT(reporter, false == stack.quickContains(testRect)); } { SkClipStack stack; - stack.clipRect(nonIntersectingRect, SkMatrix::I(), SkCanvas::kIntersect_Op, false); + stack.clipRect(nonIntersectingRect, SkMatrix::I(), kIntersect_SkClipOp, false); REPORTER_ASSERT(reporter, false == stack.quickContains(testRect)); } // Intersect Op tests with circle paths { SkClipStack stack; - stack.clipPath(outsideCircle, SkMatrix::I(), SkCanvas::kIntersect_Op, false); + stack.clipPath(outsideCircle, SkMatrix::I(), kIntersect_SkClipOp, false); REPORTER_ASSERT(reporter, true == stack.quickContains(testRect)); } { SkClipStack stack; - stack.clipPath(insideCircle, SkMatrix::I(), SkCanvas::kIntersect_Op, false); + stack.clipPath(insideCircle, SkMatrix::I(), kIntersect_SkClipOp, false); REPORTER_ASSERT(reporter, false == stack.quickContains(testRect)); } { SkClipStack stack; - stack.clipPath(intersectingCircle, SkMatrix::I(), SkCanvas::kIntersect_Op, false); + stack.clipPath(intersectingCircle, SkMatrix::I(), kIntersect_SkClipOp, false); REPORTER_ASSERT(reporter, false == stack.quickContains(testRect)); } { SkClipStack stack; - stack.clipPath(nonIntersectingCircle, SkMatrix::I(), SkCanvas::kIntersect_Op, false); + stack.clipPath(nonIntersectingCircle, SkMatrix::I(), kIntersect_SkClipOp, false); REPORTER_ASSERT(reporter, false == stack.quickContains(testRect)); } @@ -732,7 +732,7 @@ static void test_quickContains(skiatest::Reporter* reporter) { SkPath path; path.addRect(outsideRect); path.toggleInverseFillType(); - stack.clipPath(path, SkMatrix::I(), SkCanvas::kIntersect_Op, false); + stack.clipPath(path, SkMatrix::I(), kIntersect_SkClipOp, false); REPORTER_ASSERT(reporter, false == stack.quickContains(testRect)); } @@ -741,7 +741,7 @@ static void test_quickContains(skiatest::Reporter* reporter) { SkPath path; path.addRect(insideRect); path.toggleInverseFillType(); - stack.clipPath(path, SkMatrix::I(), SkCanvas::kIntersect_Op, false); + stack.clipPath(path, SkMatrix::I(), kIntersect_SkClipOp, false); REPORTER_ASSERT(reporter, false == stack.quickContains(testRect)); } @@ -750,7 +750,7 @@ static void test_quickContains(skiatest::Reporter* reporter) { SkPath path; path.addRect(intersectingRect); path.toggleInverseFillType(); - stack.clipPath(path, SkMatrix::I(), SkCanvas::kIntersect_Op, false); + stack.clipPath(path, SkMatrix::I(), kIntersect_SkClipOp, false); REPORTER_ASSERT(reporter, false == stack.quickContains(testRect)); } @@ -759,7 +759,7 @@ static void test_quickContains(skiatest::Reporter* reporter) { SkPath path; path.addRect(nonIntersectingRect); path.toggleInverseFillType(); - stack.clipPath(path, SkMatrix::I(), SkCanvas::kIntersect_Op, false); + stack.clipPath(path, SkMatrix::I(), kIntersect_SkClipOp, false); REPORTER_ASSERT(reporter, true == stack.quickContains(testRect)); } @@ -768,7 +768,7 @@ static void test_quickContains(skiatest::Reporter* reporter) { SkClipStack stack; SkPath path = outsideCircle; path.toggleInverseFillType(); - stack.clipPath(path, SkMatrix::I(), SkCanvas::kIntersect_Op, false); + stack.clipPath(path, SkMatrix::I(), kIntersect_SkClipOp, false); REPORTER_ASSERT(reporter, false == stack.quickContains(testRect)); } @@ -776,7 +776,7 @@ static void test_quickContains(skiatest::Reporter* reporter) { SkClipStack stack; SkPath path = insideCircle; path.toggleInverseFillType(); - stack.clipPath(path, SkMatrix::I(), SkCanvas::kIntersect_Op, false); + stack.clipPath(path, SkMatrix::I(), kIntersect_SkClipOp, false); REPORTER_ASSERT(reporter, false == stack.quickContains(testRect)); } @@ -784,7 +784,7 @@ static void test_quickContains(skiatest::Reporter* reporter) { SkClipStack stack; SkPath path = intersectingCircle; path.toggleInverseFillType(); - stack.clipPath(path, SkMatrix::I(), SkCanvas::kIntersect_Op, false); + stack.clipPath(path, SkMatrix::I(), kIntersect_SkClipOp, false); REPORTER_ASSERT(reporter, false == stack.quickContains(testRect)); } @@ -792,7 +792,7 @@ static void test_quickContains(skiatest::Reporter* reporter) { SkClipStack stack; SkPath path = nonIntersectingCircle; path.toggleInverseFillType(); - stack.clipPath(path, SkMatrix::I(), SkCanvas::kIntersect_Op, false); + stack.clipPath(path, SkMatrix::I(), kIntersect_SkClipOp, false); REPORTER_ASSERT(reporter, true == stack.quickContains(testRect)); } } @@ -820,12 +820,12 @@ static void set_region_to_stack(const SkClipStack& stack, const SkIRect& bounds, static void test_invfill_diff_bug(skiatest::Reporter* reporter) { SkClipStack stack; - stack.clipRect({10, 10, 20, 20}, SkMatrix::I(), SkCanvas::kIntersect_Op, false); + stack.clipRect({10, 10, 20, 20}, SkMatrix::I(), kIntersect_SkClipOp, false); SkPath path; path.addRect({30, 10, 40, 20}); path.setFillType(SkPath::kInverseWinding_FillType); - stack.clipPath(path, SkMatrix::I(), SkCanvas::kDifference_Op, false); + stack.clipPath(path, SkMatrix::I(), kDifference_SkClipOp, false); REPORTER_ASSERT(reporter, SkClipStack::kEmptyGenID == stack.getTopmostGenID()); @@ -851,11 +851,11 @@ static void test_invfill_diff_bug(skiatest::Reporter* reporter) { // reduced stack. typedef void (*AddElementFunc) (const SkRect& rect, bool invert, - SkCanvas::ClipOp op, + SkClipOp op, SkClipStack* stack, bool doAA); -static void add_round_rect(const SkRect& rect, bool invert, SkCanvas::ClipOp op, SkClipStack* stack, +static void add_round_rect(const SkRect& rect, bool invert, SkClipOp op, SkClipStack* stack, bool doAA) { SkScalar rx = rect.width() / 10; SkScalar ry = rect.height() / 20; @@ -871,7 +871,7 @@ static void add_round_rect(const SkRect& rect, bool invert, SkCanvas::ClipOp op, } }; -static void add_rect(const SkRect& rect, bool invert, SkCanvas::ClipOp op, SkClipStack* stack, +static void add_rect(const SkRect& rect, bool invert, SkClipOp op, SkClipStack* stack, bool doAA) { if (invert) { SkPath path; @@ -883,7 +883,7 @@ static void add_rect(const SkRect& rect, bool invert, SkCanvas::ClipOp op, SkCli } }; -static void add_oval(const SkRect& rect, bool invert, SkCanvas::ClipOp op, SkClipStack* stack, +static void add_oval(const SkRect& rect, bool invert, SkClipOp op, SkClipStack* stack, bool doAA) { SkPath path; path.addOval(rect); @@ -929,13 +929,13 @@ static void test_reduced_clip_stack(skiatest::Reporter* reporter) { static const SkScalar kMinElemSizeFrac = SK_Scalar1 / 5; static const SkScalar kMaxElemSizeFrac = SK_Scalar1; - static const SkCanvas::ClipOp kOps[] = { - SkCanvas::kDifference_Op, - SkCanvas::kIntersect_Op, - SkCanvas::kUnion_Op, - SkCanvas::kXOR_Op, - SkCanvas::kReverseDifference_Op, - SkCanvas::kReplace_Op, + static const SkClipOp kOps[] = { + kDifference_SkClipOp, + kIntersect_SkClipOp, + kUnion_SkClipOp, + kXOR_SkClipOp, + kReverseDifference_SkClipOp, + kReplace_SkClipOp, }; // Replace operations short-circuit the optimizer. We want to make sure that we test this code @@ -965,8 +965,8 @@ static void test_reduced_clip_stack(skiatest::Reporter* reporter) { int numElems = r.nextRangeU(kMinElemsPerTest, kMaxElemsPerTest); bool doAA = r.nextBiasedBool(kFractionAntialiased); for (int e = 0; e < numElems; ++e) { - SkCanvas::ClipOp op = kOps[r.nextULessThan(SK_ARRAY_COUNT(kOps))]; - if (op == SkCanvas::kReplace_Op) { + SkClipOp op = kOps[r.nextULessThan(SK_ARRAY_COUNT(kOps))]; + if (op == kReplace_SkClipOp) { if (r.nextU() % kReplaceDiv) { --e; continue; @@ -1051,8 +1051,8 @@ static void test_reduced_clip_stack(skiatest::Reporter* reporter) { SkIRect ibounds = reduced->hasIBounds() ? reduced->ibounds() : kIBounds; // GrReducedClipStack assumes that the final result is clipped to the returned bounds - reducedStack.clipDevRect(ibounds, SkCanvas::kIntersect_Op); - stack.clipDevRect(ibounds, SkCanvas::kIntersect_Op); + reducedStack.clipDevRect(ibounds, kIntersect_SkClipOp); + stack.clipDevRect(ibounds, kIntersect_SkClipOp); // convert both the original stack and reduced stack to SkRegions and see if they're equal SkRegion region; @@ -1076,10 +1076,10 @@ static void test_reduced_clip_stack(skiatest::Reporter* reporter) { static void test_reduced_clip_stack_genid(skiatest::Reporter* reporter) { { SkClipStack stack; - stack.clipRect(SkRect::MakeXYWH(0, 0, 100, 100), SkMatrix::I(), SkCanvas::kReplace_Op, + stack.clipRect(SkRect::MakeXYWH(0, 0, 100, 100), SkMatrix::I(), kReplace_SkClipOp, true); stack.clipRect(SkRect::MakeXYWH(0, 0, SkScalar(50.3), SkScalar(50.3)), SkMatrix::I(), - SkCanvas::kReplace_Op, true); + kReplace_SkClipOp, true); SkRect bounds = SkRect::MakeXYWH(0, 0, 100, 100); SkAlignedSTStorage<1, GrReducedClip> storage; @@ -1101,16 +1101,16 @@ static void test_reduced_clip_stack_genid(skiatest::Reporter* reporter) { // C D stack.clipRect(SkRect::MakeXYWH(0, 0, SkScalar(25.3), SkScalar(25.3)), SkMatrix::I(), - SkCanvas::kReplace_Op, true); + kReplace_SkClipOp, true); int32_t genIDA = stack.getTopmostGenID(); stack.clipRect(SkRect::MakeXYWH(50, 0, SkScalar(25.3), SkScalar(25.3)), SkMatrix::I(), - SkCanvas::kUnion_Op, true); + kUnion_SkClipOp, true); int32_t genIDB = stack.getTopmostGenID(); stack.clipRect(SkRect::MakeXYWH(0, 50, SkScalar(25.3), SkScalar(25.3)), SkMatrix::I(), - SkCanvas::kUnion_Op, true); + kUnion_SkClipOp, true); int32_t genIDC = stack.getTopmostGenID(); stack.clipRect(SkRect::MakeXYWH(50, 50, SkScalar(25.3), SkScalar(25.3)), SkMatrix::I(), - SkCanvas::kUnion_Op, true); + kUnion_SkClipOp, true); int32_t genIDD = stack.getTopmostGenID(); @@ -1189,8 +1189,8 @@ static void test_reduced_clip_stack_genid(skiatest::Reporter* reporter) { static void test_reduced_clip_stack_no_aa_crash(skiatest::Reporter* reporter) { SkClipStack stack; - stack.clipDevRect(SkIRect::MakeXYWH(0, 0, 100, 100), SkCanvas::kReplace_Op); - stack.clipDevRect(SkIRect::MakeXYWH(0, 0, 50, 50), SkCanvas::kReplace_Op); + stack.clipDevRect(SkIRect::MakeXYWH(0, 0, 100, 100), kReplace_SkClipOp); + stack.clipDevRect(SkIRect::MakeXYWH(0, 0, 50, 50), kReplace_SkClipOp); SkRect bounds = SkRect::MakeXYWH(0, 0, 100, 100); // At the time, this would crash. @@ -1290,7 +1290,7 @@ static void test_reduced_clip_stack_aa(skiatest::Reporter* reporter) { // Pixel-aligned rect (iior=true). name.printf("Pixel-aligned rect test, iter %i", i); SkClipStack stack; - stack.clipRect(alignedRect, SkMatrix::I(), SkCanvas::kIntersect_Op, true); + stack.clipRect(alignedRect, SkMatrix::I(), kIntersect_SkClipOp, true); test_aa_query(reporter, name, stack, m, {IL, IT, IR, IB}, ClipMethod::kIgnoreClip); test_aa_query(reporter, name, stack, m, {IL, IT-1, IR, IT}, ClipMethod::kSkipDraw); test_aa_query(reporter, name, stack, m, {IL, IT-2, IR, IB}, ClipMethod::kScissor); @@ -1298,7 +1298,7 @@ static void test_reduced_clip_stack_aa(skiatest::Reporter* reporter) { // Rect (iior=true). name.printf("Rect test, iter %i", i); stack.reset(); - stack.clipRect(rect, SkMatrix::I(), SkCanvas::kIntersect_Op, true); + stack.clipRect(rect, SkMatrix::I(), kIntersect_SkClipOp, true); test_aa_query(reporter, name, stack, m, {L, T, R, B}, ClipMethod::kIgnoreClip); test_aa_query(reporter, name, stack, m, {L-.1f, T, L, B}, ClipMethod::kSkipDraw); test_aa_query(reporter, name, stack, m, {L-.1f, T, L+.1f, B}, ClipMethod::kAAElements, 1); @@ -1306,7 +1306,7 @@ static void test_reduced_clip_stack_aa(skiatest::Reporter* reporter) { // Difference rect (iior=false, inside-out bounds). name.printf("Difference rect test, iter %i", i); stack.reset(); - stack.clipRect(rect, SkMatrix::I(), SkCanvas::kDifference_Op, true); + stack.clipRect(rect, SkMatrix::I(), kDifference_SkClipOp, true); test_aa_query(reporter, name, stack, m, {L, T, R, B}, ClipMethod::kSkipDraw); test_aa_query(reporter, name, stack, m, {L, T-.1f, R, T}, ClipMethod::kIgnoreClip); test_aa_query(reporter, name, stack, m, {L, T-.1f, R, T+.1f}, ClipMethod::kAAElements, 1); @@ -1314,8 +1314,8 @@ static void test_reduced_clip_stack_aa(skiatest::Reporter* reporter) { // Complex clip (iior=false, normal bounds). name.printf("Complex clip test, iter %i", i); stack.reset(); - stack.clipRect(rect, SkMatrix::I(), SkCanvas::kIntersect_Op, true); - stack.clipRect(innerRect, SkMatrix::I(), SkCanvas::kXOR_Op, true); + stack.clipRect(rect, SkMatrix::I(), kIntersect_SkClipOp, true); + stack.clipRect(innerRect, SkMatrix::I(), kXOR_SkClipOp, true); test_aa_query(reporter, name, stack, m, {l, t, r, b}, ClipMethod::kSkipDraw); test_aa_query(reporter, name, stack, m, {r-.1f, t, R, b}, ClipMethod::kAAElements, 1); test_aa_query(reporter, name, stack, m, {r-.1f, t, R+.1f, b}, ClipMethod::kAAElements, 2); @@ -1326,8 +1326,8 @@ static void test_reduced_clip_stack_aa(skiatest::Reporter* reporter) { // Complex clip where outer rect is pixel aligned (iior=false, normal bounds). name.printf("Aligned Complex clip test, iter %i", i); stack.reset(); - stack.clipRect(alignedRect, SkMatrix::I(), SkCanvas::kIntersect_Op, true); - stack.clipRect(innerRect, SkMatrix::I(), SkCanvas::kXOR_Op, true); + stack.clipRect(alignedRect, SkMatrix::I(), kIntersect_SkClipOp, true); + stack.clipRect(innerRect, SkMatrix::I(), kXOR_SkClipOp, true); test_aa_query(reporter, name, stack, m, {l, t, r, b}, ClipMethod::kSkipDraw); test_aa_query(reporter, name, stack, m, {l, b-.1f, r, IB}, ClipMethod::kAAElements, 1); test_aa_query(reporter, name, stack, m, {l, b-.1f, r, IB+.1f}, ClipMethod::kAAElements, 1); @@ -1368,7 +1368,7 @@ DEF_TEST(ClipStack, reporter) { { 0, 0, 75, 75 } }; for (size_t i = 0; i < SK_ARRAY_COUNT(gRects); i++) { - stack.clipDevRect(gRects[i], SkCanvas::kIntersect_Op); + stack.clipDevRect(gRects[i], kIntersect_SkClipOp); } // all of the above rects should have been intersected, leaving only 1 rect @@ -1379,7 +1379,7 @@ DEF_TEST(ClipStack, reporter) { REPORTER_ASSERT(reporter, element); REPORTER_ASSERT(reporter, SkClipStack::Element::kRect_Type == element->getType()); - REPORTER_ASSERT(reporter, SkCanvas::kIntersect_Op == element->getOp()); + REPORTER_ASSERT(reporter, kIntersect_SkClipOp == element->getOp()); REPORTER_ASSERT(reporter, element->getRect() == answer); // now check that we only had one in our iterator REPORTER_ASSERT(reporter, !iter.next()); diff --git a/tests/GrShapeTest.cpp b/tests/GrShapeTest.cpp index fc426857e1..f13e6b3310 100644 --- a/tests/GrShapeTest.cpp +++ b/tests/GrShapeTest.cpp @@ -52,7 +52,7 @@ static bool test_bounds_by_rasterizing(const SkPath& path, const SkRect& bounds) SkMatrix matrix; matrix.setRectToRect(bounds, clip, SkMatrix::kFill_ScaleToFit); clip.outset(SkIntToScalar(kTol), SkIntToScalar(kTol)); - surface->getCanvas()->clipRect(clip, SkCanvas::kDifference_Op); + surface->getCanvas()->clipRect(clip, kDifference_SkClipOp); surface->getCanvas()->concat(matrix); SkPaint whitePaint; whitePaint.setColor(SK_ColorWHITE); diff --git a/tests/PictureTest.cpp b/tests/PictureTest.cpp index 8fdf92a8e8..d47165eaf2 100644 --- a/tests/PictureTest.cpp +++ b/tests/PictureTest.cpp @@ -287,7 +287,7 @@ static void test_gpu_veto(skiatest::Reporter* reporter) { for (int i = 0; i < 50; ++i) { canvas->clipPath(convexClip); canvas->clipPath(concaveClip); - canvas->clipPath(convexClip, SkCanvas::kIntersect_Op, true); + canvas->clipPath(convexClip, kIntersect_SkClipOp, true); canvas->drawRect(SkRect::MakeWH(100, 100), SkPaint()); } } @@ -299,7 +299,7 @@ static void test_gpu_veto(skiatest::Reporter* reporter) { { const SkPath concaveClip = make_concave_path(); for (int i = 0; i < 50; ++i) { - canvas->clipPath(concaveClip, SkCanvas::kIntersect_Op, true); + canvas->clipPath(concaveClip, kIntersect_SkClipOp, true); canvas->drawRect(SkRect::MakeWH(100, 100), SkPaint()); } } @@ -398,7 +398,7 @@ static void create_imbalance(SkCanvas* canvas) { SkRect clipRect = SkRect::MakeWH(2, 2); SkRect drawRect = SkRect::MakeWH(10, 10); canvas->save(); - canvas->clipRect(clipRect, SkCanvas::kReplace_Op); + canvas->clipRect(clipRect, kReplace_SkClipOp); canvas->translate(1.0f, 1.0f); SkPaint p; p.setColor(SK_ColorGREEN); @@ -664,7 +664,7 @@ static void test_clip_bound_opt(skiatest::Reporter* reporter) { { SkCanvas* canvas = recorder.beginRecording(10, 10); canvas->clipPath(path); - canvas->clipPath(invPath, SkCanvas::kUnion_Op); + canvas->clipPath(invPath, kUnion_SkClipOp); bool nonEmpty = canvas->getClipDeviceBounds(&clipBounds); REPORTER_ASSERT(reporter, true == nonEmpty); REPORTER_ASSERT(reporter, 0 == clipBounds.fLeft); @@ -674,7 +674,7 @@ static void test_clip_bound_opt(skiatest::Reporter* reporter) { } { SkCanvas* canvas = recorder.beginRecording(10, 10); - canvas->clipPath(path, SkCanvas::kDifference_Op); + canvas->clipPath(path, kDifference_SkClipOp); bool nonEmpty = canvas->getClipDeviceBounds(&clipBounds); REPORTER_ASSERT(reporter, true == nonEmpty); REPORTER_ASSERT(reporter, 0 == clipBounds.fLeft); @@ -684,7 +684,7 @@ static void test_clip_bound_opt(skiatest::Reporter* reporter) { } { SkCanvas* canvas = recorder.beginRecording(10, 10); - canvas->clipPath(path, SkCanvas::kReverseDifference_Op); + canvas->clipPath(path, kReverseDifference_SkClipOp); bool nonEmpty = canvas->getClipDeviceBounds(&clipBounds); // True clip is actually empty in this case, but the best // determination we can make using only bounds as input is that the @@ -697,8 +697,8 @@ static void test_clip_bound_opt(skiatest::Reporter* reporter) { } { SkCanvas* canvas = recorder.beginRecording(10, 10); - canvas->clipPath(path, SkCanvas::kIntersect_Op); - canvas->clipPath(path2, SkCanvas::kXOR_Op); + canvas->clipPath(path, kIntersect_SkClipOp); + canvas->clipPath(path2, kXOR_SkClipOp); bool nonEmpty = canvas->getClipDeviceBounds(&clipBounds); REPORTER_ASSERT(reporter, true == nonEmpty); REPORTER_ASSERT(reporter, 6 == clipBounds.fLeft); @@ -746,22 +746,22 @@ public: , fClipCount(0){ } - void onClipRect(const SkRect& r, ClipOp op, ClipEdgeStyle edgeStyle) override { + void onClipRect(const SkRect& r, SkClipOp op, ClipEdgeStyle edgeStyle) override { fClipCount += 1; this->INHERITED::onClipRect(r, op, edgeStyle); } - void onClipRRect(const SkRRect& rrect, ClipOp op, ClipEdgeStyle edgeStyle)override { + void onClipRRect(const SkRRect& rrect, SkClipOp op, ClipEdgeStyle edgeStyle)override { fClipCount += 1; this->INHERITED::onClipRRect(rrect, op, edgeStyle); } - void onClipPath(const SkPath& path, ClipOp op, ClipEdgeStyle edgeStyle) override { + void onClipPath(const SkPath& path, SkClipOp op, ClipEdgeStyle edgeStyle) override { fClipCount += 1; this->INHERITED::onClipPath(path, op, edgeStyle); } - void onClipRegion(const SkRegion& deviceRgn, ClipOp op) override { + void onClipRegion(const SkRegion& deviceRgn, SkClipOp op) override { fClipCount += 1; this->INHERITED::onClipRegion(deviceRgn, op); } @@ -778,9 +778,9 @@ static void test_clip_expansion(skiatest::Reporter* reporter) { SkPictureRecorder recorder; SkCanvas* canvas = recorder.beginRecording(10, 10); - canvas->clipRect(SkRect::MakeEmpty(), SkCanvas::kReplace_Op); + canvas->clipRect(SkRect::MakeEmpty(), kReplace_SkClipOp); // The following expanding clip should not be skipped. - canvas->clipRect(SkRect::MakeXYWH(4, 4, 3, 3), SkCanvas::kUnion_Op); + canvas->clipRect(SkRect::MakeXYWH(4, 4, 3, 3), kUnion_SkClipOp); // Draw something so the optimizer doesn't just fold the world. SkPaint p; p.setColor(SK_ColorBLUE); @@ -1134,14 +1134,14 @@ DEF_TEST(PictureGpuAnalyzer, r) { const SkPath convexClip = make_convex_path(); const SkPath concaveClip = make_concave_path(); for (int i = 0; i < 50; ++i) { - analyzer.analyzeClipPath(convexClip, SkCanvas::kIntersect_Op, false); - analyzer.analyzeClipPath(convexClip, SkCanvas::kIntersect_Op, true); - analyzer.analyzeClipPath(concaveClip, SkCanvas::kIntersect_Op, false); + analyzer.analyzeClipPath(convexClip, kIntersect_SkClipOp, false); + analyzer.analyzeClipPath(convexClip, kIntersect_SkClipOp, true); + analyzer.analyzeClipPath(concaveClip, kIntersect_SkClipOp, false); } REPORTER_ASSERT(r, analyzer.suitableForGpuRasterization()); for (int i = 0; i < 50; ++i) { - analyzer.analyzeClipPath(concaveClip, SkCanvas::kIntersect_Op, true); + analyzer.analyzeClipPath(concaveClip, kIntersect_SkClipOp, true); } REPORTER_ASSERT(r, !analyzer.suitableForGpuRasterization()); } diff --git a/tests/ReadPixelsTest.cpp b/tests/ReadPixelsTest.cpp index 1550c6d8dd..71cd8f5fc9 100644 --- a/tests/ReadPixelsTest.cpp +++ b/tests/ReadPixelsTest.cpp @@ -111,7 +111,7 @@ static SkBitmap make_src_bitmap() { static void fill_src_canvas(SkCanvas* canvas) { canvas->save(); canvas->setMatrix(SkMatrix::I()); - canvas->clipRect(DEV_RECT_S, SkCanvas::kReplace_Op); + canvas->clipRect(DEV_RECT_S, kReplace_SkClipOp); SkPaint paint; paint.setBlendMode(SkBlendMode::kSrc); canvas->drawBitmap(make_src_bitmap(), 0, 0, &paint); diff --git a/tests/SkLiteDLTest.cpp b/tests/SkLiteDLTest.cpp index f3fccc8542..96046ccc8a 100644 --- a/tests/SkLiteDLTest.cpp +++ b/tests/SkLiteDLTest.cpp @@ -13,7 +13,7 @@ DEF_TEST(SkLiteDL_basics, r) { sk_sp<SkLiteDL> p { SkLiteDL::New({2,2,3,3}) }; p->save(); - p->clipRect(SkRect{2,3,4,5}, SkCanvas::kIntersect_Op, true); + p->clipRect(SkRect{2,3,4,5}, kIntersect_SkClipOp, true); p->drawRect(SkRect{0,0,9,9}, SkPaint{}); p->restore(); } @@ -27,7 +27,7 @@ DEF_TEST(SkLiteRecorder, r) { rec.reset(p.get()); c->save(); - c->clipRect(SkRect{2,3,4,5}, SkCanvas::kIntersect_Op, true); + c->clipRect(SkRect{2,3,4,5}, kIntersect_SkClipOp, true); c->drawRect(SkRect{0,0,9,9}, SkPaint{}); c->restore(); } diff --git a/tests/WritePixelsTest.cpp b/tests/WritePixelsTest.cpp index 7916040dbc..2937e0ef00 100644 --- a/tests/WritePixelsTest.cpp +++ b/tests/WritePixelsTest.cpp @@ -120,7 +120,7 @@ static void fill_canvas(SkCanvas* canvas) { } canvas->save(); canvas->setMatrix(SkMatrix::I()); - canvas->clipRect(DEV_RECT_S, SkCanvas::kReplace_Op); + canvas->clipRect(DEV_RECT_S, kReplace_SkClipOp); SkPaint paint; paint.setBlendMode(SkBlendMode::kSrc); canvas->drawBitmap(bmp, 0, 0, &paint); diff --git a/tools/android/SkAndroidSDKCanvas.cpp b/tools/android/SkAndroidSDKCanvas.cpp index 85a3e989ce..27a0235eda 100644 --- a/tools/android/SkAndroidSDKCanvas.cpp +++ b/tools/android/SkAndroidSDKCanvas.cpp @@ -341,25 +341,19 @@ void SkAndroidSDKCanvas::didSetMatrix(const SkMatrix& m) { fProxyTarget->setMatrix(m); } -void SkAndroidSDKCanvas::onClipRect(const SkRect& rect, - ClipOp op, - ClipEdgeStyle style) { +void SkAndroidSDKCanvas::onClipRect(const SkRect& rect, SkClipOp op, ClipEdgeStyle style) { fProxyTarget->clipRect(rect, op, style); } -void SkAndroidSDKCanvas::onClipRRect(const SkRRect& rrect, - ClipOp op, - ClipEdgeStyle style) { +void SkAndroidSDKCanvas::onClipRRect(const SkRRect& rrect, SkClipOp op, ClipEdgeStyle style) { fProxyTarget->clipRRect(rrect, op, style); } -void SkAndroidSDKCanvas::onClipPath(const SkPath& path, - ClipOp op, - ClipEdgeStyle style) { +void SkAndroidSDKCanvas::onClipPath(const SkPath& path, SkClipOp op, ClipEdgeStyle style) { fProxyTarget->clipPath(path, op, style); } -void SkAndroidSDKCanvas::onClipRegion(const SkRegion& region, ClipOp op) { +void SkAndroidSDKCanvas::onClipRegion(const SkRegion& region, SkClipOp op) { fProxyTarget->clipRegion(region, op); } diff --git a/tools/android/SkAndroidSDKCanvas.h b/tools/android/SkAndroidSDKCanvas.h index ca92ea4067..97d9cdb78d 100644 --- a/tools/android/SkAndroidSDKCanvas.h +++ b/tools/android/SkAndroidSDKCanvas.h @@ -100,10 +100,10 @@ protected: void didRestore() override; void didConcat(const SkMatrix&) override; void didSetMatrix(const SkMatrix&) override; - void onClipRect(const SkRect&, ClipOp, ClipEdgeStyle) override; - void onClipRRect(const SkRRect&, ClipOp, ClipEdgeStyle) override; - void onClipPath(const SkPath&, ClipOp, ClipEdgeStyle) override; - void onClipRegion(const SkRegion&, ClipOp) override; + void onClipRect(const SkRect&, SkClipOp, ClipEdgeStyle) override; + void onClipRRect(const SkRRect&, SkClipOp, ClipEdgeStyle) override; + void onClipPath(const SkPath&, SkClipOp, ClipEdgeStyle) override; + void onClipRegion(const SkRegion&, SkClipOp) override; void onDiscard() override; protected: diff --git a/tools/debugger/SkDebugCanvas.cpp b/tools/debugger/SkDebugCanvas.cpp index eaf72c3c35..b02ab59ee8 100644 --- a/tools/debugger/SkDebugCanvas.cpp +++ b/tools/debugger/SkDebugCanvas.cpp @@ -105,7 +105,7 @@ SkDebugCanvas::SkDebugCanvas(int width, int height) SkASSERT(!large.roundOut().isEmpty()); #endif // call the base class' version to avoid adding a draw command - this->INHERITED::onClipRect(large, kReplace_Op, kHard_ClipEdgeStyle); + this->INHERITED::onClipRect(large, kReplace_SkClipOp, kHard_ClipEdgeStyle); } SkDebugCanvas::~SkDebugCanvas() { @@ -153,21 +153,21 @@ class SkDebugClipVisitor : public SkCanvas::ClipVisitor { public: SkDebugClipVisitor(SkCanvas* canvas) : fCanvas(canvas) {} - void clipRect(const SkRect& r, SkCanvas::ClipOp, bool doAA) override { + void clipRect(const SkRect& r, SkClipOp, bool doAA) override { SkPaint p; p.setColor(SK_ColorRED); p.setStyle(SkPaint::kStroke_Style); p.setAntiAlias(doAA); fCanvas->drawRect(r, p); } - void clipRRect(const SkRRect& rr, SkCanvas::ClipOp, bool doAA) override { + void clipRRect(const SkRRect& rr, SkClipOp, bool doAA) override { SkPaint p; p.setColor(SK_ColorGREEN); p.setStyle(SkPaint::kStroke_Style); p.setAntiAlias(doAA); fCanvas->drawRRect(rr, p); } - void clipPath(const SkPath& path, SkCanvas::ClipOp, bool doAA) override { + void clipPath(const SkPath& path, SkClipOp, bool doAA) override { SkPaint p; p.setColor(SK_ColorBLUE); p.setStyle(SkPaint::kStroke_Style); @@ -220,7 +220,7 @@ void SkDebugCanvas::drawTo(SkCanvas* canvas, int index, int m) { canvas->clear(SK_ColorWHITE); canvas->resetMatrix(); if (!windowRect.isEmpty()) { - canvas->clipRect(windowRect, SkCanvas::kReplace_Op); + canvas->clipRect(windowRect, kReplace_SkClipOp); } this->applyUserTransform(canvas); @@ -280,7 +280,7 @@ void SkDebugCanvas::drawTo(SkCanvas* canvas, int index, int m) { canvas->save(); #define LARGE_COORD 1000000000 canvas->clipRect(SkRect::MakeLTRB(-LARGE_COORD, -LARGE_COORD, LARGE_COORD, LARGE_COORD), - SkCanvas::kReverseDifference_Op); + kReverseDifference_SkClipOp); SkPaint clipPaint; clipPaint.setColor(fClipVizColor); canvas->drawPaint(clipPaint); @@ -295,7 +295,7 @@ void SkDebugCanvas::drawTo(SkCanvas* canvas, int index, int m) { if (!windowRect.isEmpty()) { SkRect r = windowRect; r.outset(SK_Scalar1, SK_Scalar1); - canvas->clipRect(r, SkCanvas::kReplace_Op); + canvas->clipRect(r, kReplace_SkClipOp); } // visualize existing clips SkDebugClipVisitor visitor(canvas); @@ -316,9 +316,9 @@ void SkDebugCanvas::drawTo(SkCanvas* canvas, int index, int m) { if (type != SkClipStack::Element::kEmpty_Type) { element->asPath(&operand); } - SkCanvas::ClipOp elementOp = element->getOp(); + SkClipOp elementOp = element->getOp(); this->addClipStackData(devPath, operand, elementOp); - if (elementOp == SkCanvas::kReplace_Op) { + if (elementOp == kReplace_SkClipOp) { devPath = operand; } else { Op(devPath, operand, (SkPathOp) elementOp, &devPath); @@ -515,19 +515,19 @@ void SkDebugCanvas::overrideTexFiltering(bool overrideTexFiltering, SkFilterQual fFilterQuality = quality; } -void SkDebugCanvas::onClipPath(const SkPath& path, ClipOp op, ClipEdgeStyle edgeStyle) { +void SkDebugCanvas::onClipPath(const SkPath& path, SkClipOp op, ClipEdgeStyle edgeStyle) { this->addDrawCommand(new SkClipPathCommand(path, op, kSoft_ClipEdgeStyle == edgeStyle)); } -void SkDebugCanvas::onClipRect(const SkRect& rect, ClipOp op, ClipEdgeStyle edgeStyle) { +void SkDebugCanvas::onClipRect(const SkRect& rect, SkClipOp op, ClipEdgeStyle edgeStyle) { this->addDrawCommand(new SkClipRectCommand(rect, op, kSoft_ClipEdgeStyle == edgeStyle)); } -void SkDebugCanvas::onClipRRect(const SkRRect& rrect, ClipOp op, ClipEdgeStyle edgeStyle) { +void SkDebugCanvas::onClipRRect(const SkRRect& rrect, SkClipOp op, ClipEdgeStyle edgeStyle) { this->addDrawCommand(new SkClipRRectCommand(rrect, op, kSoft_ClipEdgeStyle == edgeStyle)); } -void SkDebugCanvas::onClipRegion(const SkRegion& region, ClipOp op) { +void SkDebugCanvas::onClipRegion(const SkRegion& region, SkClipOp op) { this->addDrawCommand(new SkClipRegionCommand(region, op)); } @@ -800,8 +800,8 @@ void SkDebugCanvas::addPathData(const SkPath& path, const char* pathName) { } void SkDebugCanvas::addClipStackData(const SkPath& devPath, const SkPath& operand, - SkCanvas::ClipOp elementOp) { - if (elementOp == SkCanvas::kReplace_Op) { + SkClipOp elementOp) { + if (elementOp == kReplace_SkClipOp) { if (!lastClipStackData(devPath)) { fSaveDevPath = operand; } diff --git a/tools/debugger/SkDebugCanvas.h b/tools/debugger/SkDebugCanvas.h index 6e7086e6ce..b9ef693a0b 100644 --- a/tools/debugger/SkDebugCanvas.h +++ b/tools/debugger/SkDebugCanvas.h @@ -248,10 +248,10 @@ protected: const SkPaint*, SrcRectConstraint) override; void onDrawBitmapNine(const SkBitmap&, const SkIRect& center, const SkRect& dst, const SkPaint*) override; - void onClipRect(const SkRect&, ClipOp, ClipEdgeStyle) override; - void onClipRRect(const SkRRect&, ClipOp, ClipEdgeStyle) override; - void onClipPath(const SkPath&, ClipOp, ClipEdgeStyle) override; - void onClipRegion(const SkRegion& region, ClipOp) override; + void onClipRect(const SkRect&, SkClipOp, ClipEdgeStyle) override; + void onClipRRect(const SkRRect&, SkClipOp, ClipEdgeStyle) override; + void onClipPath(const SkPath&, SkClipOp, ClipEdgeStyle) override; + void onClipRegion(const SkRegion& region, SkClipOp) override; void onDrawPicture(const SkPicture*, const SkMatrix*, const SkPaint*) override; @@ -308,7 +308,7 @@ private: void resetClipStackData() { fClipStackData.reset(); fCalledAddStackData = false; } - void addClipStackData(const SkPath& devPath, const SkPath& operand, ClipOp elementOp); + void addClipStackData(const SkPath& devPath, const SkPath& operand, SkClipOp elementOp); void addPathData(const SkPath& path, const char* pathName); bool lastClipStackData(const SkPath& devPath); void outputConicPoints(const SkPoint* pts, SkScalar weight); diff --git a/tools/debugger/SkDrawCommand.cpp b/tools/debugger/SkDrawCommand.cpp index c8eaf98851..6cec6eb6b1 100644 --- a/tools/debugger/SkDrawCommand.cpp +++ b/tools/debugger/SkDrawCommand.cpp @@ -584,19 +584,19 @@ Json::Value SkDrawCommand::MakeJsonRegion(const SkRegion& region) { return Json::Value("<unimplemented>"); } -static Json::Value make_json_regionop(SkCanvas::ClipOp op) { +static Json::Value make_json_regionop(SkClipOp op) { switch (op) { - case SkCanvas::kDifference_Op: + case kDifference_SkClipOp: return Json::Value(SKDEBUGCANVAS_REGIONOP_DIFFERENCE); - case SkCanvas::kIntersect_Op: + case kIntersect_SkClipOp: return Json::Value(SKDEBUGCANVAS_REGIONOP_INTERSECT); - case SkCanvas::kUnion_Op: + case kUnion_SkClipOp: return Json::Value(SKDEBUGCANVAS_REGIONOP_UNION); - case SkCanvas::kXOR_Op: + case kXOR_SkClipOp: return Json::Value(SKDEBUGCANVAS_REGIONOP_XOR); - case SkCanvas::kReverseDifference_Op: + case kReverseDifference_SkClipOp: return Json::Value(SKDEBUGCANVAS_REGIONOP_REVERSE_DIFFERENCE); - case SkCanvas::kReplace_Op: + case kReplace_SkClipOp: return Json::Value(SKDEBUGCANVAS_REGIONOP_REPLACE); default: SkASSERT(false); @@ -1592,28 +1592,28 @@ static void extract_json_path(Json::Value& path, SkPath* result) { } } -SkCanvas::ClipOp get_json_clipop(Json::Value& jsonOp) { +SkClipOp get_json_clipop(Json::Value& jsonOp) { const char* op = jsonOp.asCString(); if (!strcmp(op, SKDEBUGCANVAS_REGIONOP_DIFFERENCE)) { - return SkCanvas::kDifference_Op; + return kDifference_SkClipOp; } else if (!strcmp(op, SKDEBUGCANVAS_REGIONOP_INTERSECT)) { - return SkCanvas::kIntersect_Op; + return kIntersect_SkClipOp; } else if (!strcmp(op, SKDEBUGCANVAS_REGIONOP_UNION)) { - return SkCanvas::kUnion_Op; + return kUnion_SkClipOp; } else if (!strcmp(op, SKDEBUGCANVAS_REGIONOP_XOR)) { - return SkCanvas::kXOR_Op; + return kXOR_SkClipOp; } else if (!strcmp(op, SKDEBUGCANVAS_REGIONOP_REVERSE_DIFFERENCE)) { - return SkCanvas::kReverseDifference_Op; + return kReverseDifference_SkClipOp; } else if (!strcmp(op, SKDEBUGCANVAS_REGIONOP_REPLACE)) { - return SkCanvas::kReplace_Op; + return kReplace_SkClipOp; } SkASSERT(false); - return SkCanvas::kIntersect_Op; + return kIntersect_SkClipOp; } SkClearCommand::SkClearCommand(SkColor color) : INHERITED(kDrawClear_OpType) { @@ -1636,7 +1636,7 @@ Json::Value SkClearCommand::toJSON(UrlDataManager& urlDataManager) const { return new SkClearCommand(get_json_color(color)); } -SkClipPathCommand::SkClipPathCommand(const SkPath& path, SkCanvas::ClipOp op, bool doAA) +SkClipPathCommand::SkClipPathCommand(const SkPath& path, SkClipOp op, bool doAA) : INHERITED(kClipPath_OpType) { fPath = path; fOp = op; @@ -1672,7 +1672,7 @@ SkClipPathCommand* SkClipPathCommand::fromJSON(Json::Value& command, command[SKDEBUGCANVAS_ATTRIBUTE_ANTIALIAS].asBool()); } -SkClipRegionCommand::SkClipRegionCommand(const SkRegion& region, SkCanvas::ClipOp op) +SkClipRegionCommand::SkClipRegionCommand(const SkRegion& region, SkClipOp op) : INHERITED(kClipRegion_OpType) { fRegion = region; fOp = op; @@ -1698,7 +1698,7 @@ SkClipRegionCommand* SkClipRegionCommand::fromJSON(Json::Value& command, return nullptr; } -SkClipRectCommand::SkClipRectCommand(const SkRect& rect, SkCanvas::ClipOp op, bool doAA) +SkClipRectCommand::SkClipRectCommand(const SkRect& rect, SkClipOp op, bool doAA) : INHERITED(kClipRect_OpType) { fRect = rect; fOp = op; @@ -1733,7 +1733,7 @@ SkClipRectCommand* SkClipRectCommand::fromJSON(Json::Value& command, command[SKDEBUGCANVAS_ATTRIBUTE_ANTIALIAS].asBool()); } -SkClipRRectCommand::SkClipRRectCommand(const SkRRect& rrect, SkCanvas::ClipOp op, bool doAA) +SkClipRRectCommand::SkClipRRectCommand(const SkRRect& rrect, SkClipOp op, bool doAA) : INHERITED(kClipRRect_OpType) { fRRect = rrect; fOp = op; diff --git a/tools/debugger/SkDrawCommand.h b/tools/debugger/SkDrawCommand.h index 144c6c560e..880c2aa086 100644 --- a/tools/debugger/SkDrawCommand.h +++ b/tools/debugger/SkDrawCommand.h @@ -173,69 +173,69 @@ private: class SkClipPathCommand : public SkDrawCommand { public: - SkClipPathCommand(const SkPath& path, SkCanvas::ClipOp op, bool doAA); + SkClipPathCommand(const SkPath& path, SkClipOp op, bool doAA); void execute(SkCanvas* canvas) const override; bool render(SkCanvas* canvas) const override; Json::Value toJSON(UrlDataManager& urlDataManager) const override; static SkClipPathCommand* fromJSON(Json::Value& command, UrlDataManager& urlDataManager); private: - SkPath fPath; - SkCanvas::ClipOp fOp; - bool fDoAA; + SkPath fPath; + SkClipOp fOp; + bool fDoAA; typedef SkDrawCommand INHERITED; }; class SkClipRegionCommand : public SkDrawCommand { public: - SkClipRegionCommand(const SkRegion& region, SkCanvas::ClipOp op); + SkClipRegionCommand(const SkRegion& region, SkClipOp op); void execute(SkCanvas* canvas) const override; Json::Value toJSON(UrlDataManager& urlDataManager) const override; static SkClipRegionCommand* fromJSON(Json::Value& command, UrlDataManager& urlDataManager); private: - SkRegion fRegion; - SkCanvas::ClipOp fOp; + SkRegion fRegion; + SkClipOp fOp; typedef SkDrawCommand INHERITED; }; class SkClipRectCommand : public SkDrawCommand { public: - SkClipRectCommand(const SkRect& rect, SkCanvas::ClipOp op, bool doAA); + SkClipRectCommand(const SkRect& rect, SkClipOp op, bool doAA); void execute(SkCanvas* canvas) const override; Json::Value toJSON(UrlDataManager& urlDataManager) const override; static SkClipRectCommand* fromJSON(Json::Value& command, UrlDataManager& urlDataManager); const SkRect& rect() const { return fRect; } - SkCanvas::ClipOp op() const { return fOp; } + SkClipOp op() const { return fOp; } bool doAA() const { return fDoAA; } private: - SkRect fRect; - SkCanvas::ClipOp fOp; - bool fDoAA; + SkRect fRect; + SkClipOp fOp; + bool fDoAA; typedef SkDrawCommand INHERITED; }; class SkClipRRectCommand : public SkDrawCommand { public: - SkClipRRectCommand(const SkRRect& rrect, SkCanvas::ClipOp op, bool doAA); + SkClipRRectCommand(const SkRRect& rrect, SkClipOp op, bool doAA); void execute(SkCanvas* canvas) const override; bool render(SkCanvas* canvas) const override; Json::Value toJSON(UrlDataManager& urlDataManager) const override; static SkClipRRectCommand* fromJSON(Json::Value& command, UrlDataManager& urlDataManager); const SkRRect& rrect() const { return fRRect; } - SkCanvas::ClipOp op() const { return fOp; } + SkClipOp op() const { return fOp; } bool doAA() const { return fDoAA; } private: - SkRRect fRRect; - SkCanvas::ClipOp fOp; - bool fDoAA; + SkRRect fRRect; + SkClipOp fOp; + bool fDoAA; typedef SkDrawCommand INHERITED; }; diff --git a/tools/debugger/SkObjectParser.cpp b/tools/debugger/SkObjectParser.cpp index 5f0e5f8aa9..8e3f2390c0 100644 --- a/tools/debugger/SkObjectParser.cpp +++ b/tools/debugger/SkObjectParser.cpp @@ -313,19 +313,19 @@ SkString* SkObjectParser::RRectToString(const SkRRect& rrect, const char* title) return mRRect; } -SkString* SkObjectParser::ClipOpToString(SkCanvas::ClipOp op) { +SkString* SkObjectParser::ClipOpToString(SkClipOp op) { SkString* mOp = new SkString("SkRegion::Op: "); - if (op == SkCanvas::kDifference_Op) { + if (op == kDifference_SkClipOp) { mOp->append("kDifference_Op"); - } else if (op == SkCanvas::kIntersect_Op) { + } else if (op == kIntersect_SkClipOp) { mOp->append("kIntersect_Op"); - } else if (op == SkCanvas::kUnion_Op) { + } else if (op == kUnion_SkClipOp) { mOp->append("kUnion_Op"); - } else if (op == SkCanvas::kXOR_Op) { + } else if (op == kXOR_SkClipOp) { mOp->append("kXOR_Op"); - } else if (op == SkCanvas::kReverseDifference_Op) { + } else if (op == kReverseDifference_SkClipOp) { mOp->append("kReverseDifference_Op"); - } else if (op == SkCanvas::kReplace_Op) { + } else if (op == kReplace_SkClipOp) { mOp->append("kReplace_Op"); } else { mOp->append("Unknown Type"); diff --git a/tools/debugger/SkObjectParser.h b/tools/debugger/SkObjectParser.h index 11baf12ec0..48051792cb 100644 --- a/tools/debugger/SkObjectParser.h +++ b/tools/debugger/SkObjectParser.h @@ -101,7 +101,7 @@ public: Returns a string representation of the SkRegion enum. @param op SkRegion::op enum */ - static SkString* ClipOpToString(SkCanvas::ClipOp op); + static SkString* ClipOpToString(SkClipOp op); /** Returns a string representation of the SkRegion. |