abstract name of clipping ops, to transtion to a more restricted set
SkRegion::Op --> SkCanvas::ClipOp (alias) --> SkClipOp
pre-CL needed in chrome : https://codereview.chromium.org/2355583002/
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2355483002
Review-Url: https://codereview.chromium.org/2355483002
diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp
index 31af0a1..f492ccb 100644
--- a/src/core/SkCanvas.cpp
+++ b/src/core/SkCanvas.cpp
@@ -342,8 +342,7 @@
bool next() {
if (fMultiDeviceCS && fDevice) {
// remove the previous device's bounds
- fMultiDeviceCS->clipDevRect(compute_device_bounds(fDevice),
- SkRegion::kDifference_Op);
+ fMultiDeviceCS->clipDevRect(compute_device_bounds(fDevice), SkCanvas::kDifference_Op);
}
// skip over recs with empty clips
@@ -1108,7 +1107,7 @@
if (BoundsAffectsClip(saveLayerFlags)) {
// Simplify the current clips since they will be applied properly during restore()
- fClipStack->clipDevRect(ir, SkRegion::kReplace_Op);
+ fClipStack->clipDevRect(ir, kReplace_Op);
fMCRec->fRasterClip.setRect(ir);
fDeviceClipBounds = qr_clip_bounds(ir);
}
@@ -1540,7 +1539,7 @@
//////////////////////////////////////////////////////////////////////////////
-void SkCanvas::clipRect(const SkRect& rect, SkRegion::Op op, bool doAA) {
+void SkCanvas::clipRect(const SkRect& rect, ClipOp op, bool doAA) {
if (!fAllowSoftClip) {
doAA = false;
}
@@ -1550,17 +1549,14 @@
this->onClipRect(rect, op, edgeStyle);
}
-void SkCanvas::onClipRect(const SkRect& rect, SkRegion::Op op, ClipEdgeStyle edgeStyle) {
+void SkCanvas::onClipRect(const SkRect& rect, ClipOp op, ClipEdgeStyle edgeStyle) {
const bool isScaleTrans = fMCRec->fMatrix.isScaleTranslate();
SkRect devR;
if (isScaleTrans) {
fMCRec->fMatrix.mapRectScaleTranslate(&devR, rect);
}
- if (SkRegion::kIntersect_Op == op &&
- kHard_ClipEdgeStyle == edgeStyle
- && isScaleTrans)
- {
+ if (kIntersect_Op == op && kHard_ClipEdgeStyle == edgeStyle && isScaleTrans) {
if (devR.round().contains(fMCRec->fRasterClip.getBounds())) {
#if 0
SkDebugf("------- ignored clipRect [%g %g %g %g]\n",
@@ -1577,7 +1573,7 @@
if (isScaleTrans) {
const bool isAA = kSoft_ClipEdgeStyle == edgeStyle;
fClipStack->clipDevRect(devR, op, isAA);
- fMCRec->fRasterClip.op(devR, this->getTopLayerBounds(), op, isAA);
+ fMCRec->fRasterClip.op(devR, this->getTopLayerBounds(), (SkRegion::Op)op, isAA);
} else {
// since we're rotated or some such thing, we convert the rect to a path
// and clip against that, since it can handle any matrix. However, to
@@ -1593,7 +1589,7 @@
fDeviceClipBounds = qr_clip_bounds(fMCRec->fRasterClip.getBounds());
}
-void SkCanvas::clipRRect(const SkRRect& rrect, SkRegion::Op op, bool doAA) {
+void SkCanvas::clipRRect(const SkRRect& rrect, ClipOp op, bool doAA) {
this->checkForDeferredSave();
ClipEdgeStyle edgeStyle = doAA ? kSoft_ClipEdgeStyle : kHard_ClipEdgeStyle;
if (rrect.isRect()) {
@@ -1603,7 +1599,7 @@
}
}
-void SkCanvas::onClipRRect(const SkRRect& rrect, SkRegion::Op op, ClipEdgeStyle edgeStyle) {
+void SkCanvas::onClipRRect(const SkRRect& rrect, ClipOp op, ClipEdgeStyle edgeStyle) {
SkRRect transformedRRect;
if (rrect.transform(fMCRec->fMatrix, &transformedRRect)) {
AutoValidateClip avc(this);
@@ -1615,7 +1611,7 @@
fClipStack->clipDevRRect(transformedRRect, op, kSoft_ClipEdgeStyle == edgeStyle);
- fMCRec->fRasterClip.op(transformedRRect, this->getTopLayerBounds(), op,
+ fMCRec->fRasterClip.op(transformedRRect, this->getTopLayerBounds(), (SkRegion::Op)op,
kSoft_ClipEdgeStyle == edgeStyle);
fDeviceClipBounds = qr_clip_bounds(fMCRec->fRasterClip.getBounds());
return;
@@ -1628,7 +1624,7 @@
this->SkCanvas::onClipPath(path, op, edgeStyle);
}
-void SkCanvas::clipPath(const SkPath& path, SkRegion::Op op, bool doAA) {
+void SkCanvas::clipPath(const SkPath& path, ClipOp op, bool doAA) {
this->checkForDeferredSave();
ClipEdgeStyle edgeStyle = doAA ? kSoft_ClipEdgeStyle : kHard_ClipEdgeStyle;
@@ -1653,7 +1649,7 @@
this->onClipPath(path, op, edgeStyle);
}
-void SkCanvas::onClipPath(const SkPath& path, SkRegion::Op op, ClipEdgeStyle edgeStyle) {
+void SkCanvas::onClipPath(const SkPath& path, ClipOp op, ClipEdgeStyle edgeStyle) {
AutoValidateClip avc(this);
fDeviceCMDirty = true;
@@ -1688,19 +1684,19 @@
edgeStyle = kSoft_ClipEdgeStyle;
}
- op = SkRegion::kReplace_Op;
+ op = kReplace_Op;
}
- fMCRec->fRasterClip.op(devPath, this->getTopLayerBounds(), op, edgeStyle);
+ fMCRec->fRasterClip.op(devPath, this->getTopLayerBounds(), (SkRegion::Op)op, edgeStyle);
fDeviceClipBounds = qr_clip_bounds(fMCRec->fRasterClip.getBounds());
}
-void SkCanvas::clipRegion(const SkRegion& rgn, SkRegion::Op op) {
+void SkCanvas::clipRegion(const SkRegion& rgn, ClipOp op) {
this->checkForDeferredSave();
this->onClipRegion(rgn, op);
}
-void SkCanvas::onClipRegion(const SkRegion& rgn, SkRegion::Op op) {
+void SkCanvas::onClipRegion(const SkRegion& rgn, ClipOp op) {
AutoValidateClip avc(this);
fDeviceCMDirty = true;
@@ -1709,7 +1705,7 @@
// we have to ignore it, and use the region directly?
fClipStack->clipDevRect(rgn.getBounds(), op);
- fMCRec->fRasterClip.op(rgn, op);
+ fMCRec->fRasterClip.op(rgn, (SkRegion::Op)op);
fDeviceClipBounds = qr_clip_bounds(fMCRec->fRasterClip.getBounds());
}
@@ -1732,7 +1728,7 @@
switch (element->getType()) {
case SkClipStack::Element::kRect_Type:
element->getRect().round(&ir);
- tmpClip.op(ir, element->getOp());
+ tmpClip.op(ir, (SkRegion::Op)element->getOp());
break;
case SkClipStack::Element::kEmpty_Type:
tmpClip.setEmpty();
@@ -1740,7 +1736,8 @@
default: {
SkPath path;
element->asPath(&path);
- tmpClip.op(path, this->getTopLayerBounds(), element->getOp(), element->isAA());
+ tmpClip.op(path, this->getTopLayerBounds(), (SkRegion::Op)element->getOp(),
+ element->isAA());
break;
}
}
@@ -3451,3 +3448,19 @@
return this->makeSurface(info, props).release();
}
#endif
+
+/////////////////////////////////
+
+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, "");
+static_assert((int)SkRegion::kXOR_Op == (int)kXOR_SkClipOp, "");
+static_assert((int)SkRegion::kReverseDifference_Op == (int)kReverseDifference_SkClipOp, "");
+static_assert((int)SkRegion::kReplace_Op == (int)kReplace_SkClipOp, "");
diff --git a/src/core/SkClipStack.cpp b/src/core/SkClipStack.cpp
index 30f5a46..0019077 100644
--- a/src/core/SkClipStack.cpp
+++ b/src/core/SkClipStack.cpp
@@ -83,7 +83,7 @@
visitor->clipRect(this->getRect(), this->getOp(), this->isAA());
break;
case kEmpty_Type:
- visitor->clipRect(kEmptyRect, SkRegion::kIntersect_Op, false);
+ visitor->clipRect(kEmptyRect, SkCanvas::kIntersect_Op, false);
break;
}
}
@@ -111,7 +111,7 @@
}
}
-void SkClipStack::Element::initPath(int saveCount, const SkPath& path, SkRegion::Op op,
+void SkClipStack::Element::initPath(int saveCount, const SkPath& path, SkCanvas::ClipOp op,
bool doAA) {
if (!path.isInverseFillType()) {
SkRect r;
@@ -176,16 +176,16 @@
SkASSERT(!fPath.isValid());
}
-bool SkClipStack::Element::canBeIntersectedInPlace(int saveCount, SkRegion::Op op) const {
+bool SkClipStack::Element::canBeIntersectedInPlace(int saveCount, SkCanvas::ClipOp op) const {
if (kEmpty_Type == fType &&
- (SkRegion::kDifference_Op == op || SkRegion::kIntersect_Op == op)) {
+ (SkCanvas::kDifference_Op == op || SkCanvas::kIntersect_Op == op)) {
return true;
}
// Only clips within the same save/restore frame (as captured by
// the save count) can be merged
return fSaveCount == saveCount &&
- SkRegion::kIntersect_Op == op &&
- (SkRegion::kIntersect_Op == fOp || SkRegion::kReplace_Op == fOp);
+ SkCanvas::kIntersect_Op == op &&
+ (SkCanvas::kIntersect_Op == fOp || SkCanvas::kReplace_Op == fOp);
}
bool SkClipStack::Element::rectRectIntersectAllowed(const SkRect& newR, bool newAA) const {
@@ -399,9 +399,9 @@
fFiniteBound = this->getRect();
fFiniteBoundType = kNormal_BoundsType;
- if (SkRegion::kReplace_Op == fOp ||
- (SkRegion::kIntersect_Op == fOp && nullptr == prior) ||
- (SkRegion::kIntersect_Op == fOp && prior->fIsIntersectionOfRects &&
+ if (SkCanvas::kReplace_Op == fOp ||
+ (SkCanvas::kIntersect_Op == fOp && nullptr == prior) ||
+ (SkCanvas::kIntersect_Op == fOp && prior->fIsIntersectionOfRects &&
prior->rectRectIntersectAllowed(this->getRect(), fDoAA))) {
fIsIntersectionOfRects = true;
}
@@ -460,28 +460,28 @@
// Now integrate with clip with the prior clips
switch (fOp) {
- case SkRegion::kDifference_Op:
+ case SkCanvas::kDifference_Op:
this->combineBoundsDiff(combination, prevFinite);
break;
- case SkRegion::kXOR_Op:
+ case SkCanvas::kXOR_Op:
this->combineBoundsXOR(combination, prevFinite);
break;
- case SkRegion::kUnion_Op:
+ case SkCanvas::kUnion_Op:
this->combineBoundsUnion(combination, prevFinite);
break;
- case SkRegion::kIntersect_Op:
+ case SkCanvas::kIntersect_Op:
this->combineBoundsIntersection(combination, prevFinite);
break;
- case SkRegion::kReverseDifference_Op:
+ case SkCanvas::kReverseDifference_Op:
this->combineBoundsRevDiff(combination, prevFinite);
break;
- case SkRegion::kReplace_Op:
+ case SkCanvas::kReplace_Op:
// Replace just ignores everything prior
// The current clip's bound information is already filled in
// so nothing to do
break;
default:
- SkDebugf("SkRegion::Op error\n");
+ SkDebugf("SkCanvas::ClipOp error\n");
SkASSERT(0);
break;
}
@@ -507,7 +507,7 @@
: fDeque(sizeof(Element), kDefaultElementAllocCnt)
, fSaveCount(0) {
if (!r.isEmpty()) {
- this->clipDevRect(r, SkRegion::kReplace_Op, false);
+ this->clipDevRect(r, SkCanvas::kReplace_Op, false);
}
}
@@ -517,7 +517,7 @@
if (!r.isEmpty()) {
SkRect temp;
temp.set(r);
- this->clipDevRect(temp, SkRegion::kReplace_Op, false);
+ this->clipDevRect(temp, SkCanvas::kReplace_Op, false);
}
}
@@ -626,7 +626,7 @@
Iter iter(*this, Iter::kTop_IterStart);
const Element* element = iter.prev();
while (element != nullptr) {
- if (SkRegion::kIntersect_Op != element->getOp() && SkRegion::kReplace_Op != element->getOp())
+ if (SkCanvas::kIntersect_Op != element->getOp() && SkCanvas::kReplace_Op != element->getOp())
return false;
if (element->isInverseFilled()) {
// Part of 'rect' could be trimmed off by the inverse-filled clip element
@@ -638,7 +638,7 @@
return false;
}
}
- if (SkRegion::kReplace_Op == element->getOp()) {
+ if (SkCanvas::kReplace_Op == element->getOp()) {
break;
}
element = iter.prev();
@@ -651,7 +651,7 @@
Iter iter(*this, Iter::kTop_IterStart);
const Element* element = iter.prev();
while (element != nullptr) {
- if (SkRegion::kIntersect_Op != element->getOp() && SkRegion::kReplace_Op != element->getOp())
+ if (SkCanvas::kIntersect_Op != element->getOp() && SkCanvas::kReplace_Op != element->getOp())
return false;
if (element->isInverseFilled()) {
// Part of 'rrect' could be trimmed off by the inverse-filled clip element
@@ -663,7 +663,7 @@
return false;
}
}
- if (SkRegion::kReplace_Op == element->getOp()) {
+ if (SkCanvas::kReplace_Op == element->getOp()) {
break;
}
element = iter.prev();
@@ -684,8 +684,8 @@
element->asPath(&operand);
}
- SkRegion::Op elementOp = element->getOp();
- if (elementOp == SkRegion::kReplace_Op) {
+ SkCanvas::ClipOp elementOp = element->getOp();
+ if (elementOp == SkCanvas::kReplace_Op) {
*path = operand;
} else {
Op(*path, operand, (SkPathOp)elementOp, path);
@@ -736,7 +736,7 @@
}
break;
}
- } else if (SkRegion::kReplace_Op == element.getOp()) {
+ } else if (SkCanvas::kReplace_Op == element.getOp()) {
this->restoreTo(fSaveCount - 1);
prior = (Element*) fDeque.back();
}
@@ -745,17 +745,17 @@
newElement->updateBoundAndGenID(prior);
}
-void SkClipStack::clipDevRRect(const SkRRect& rrect, SkRegion::Op op, bool doAA) {
+void SkClipStack::clipDevRRect(const SkRRect& rrect, SkCanvas::ClipOp op, bool doAA) {
Element element(fSaveCount, rrect, op, doAA);
this->pushElement(element);
}
-void SkClipStack::clipDevRect(const SkRect& rect, SkRegion::Op op, bool doAA) {
+void SkClipStack::clipDevRect(const SkRect& rect, SkCanvas::ClipOp op, bool doAA) {
Element element(fSaveCount, rect, op, doAA);
this->pushElement(element);
}
-void SkClipStack::clipDevPath(const SkPath& path, SkRegion::Op op, bool doAA) {
+void SkClipStack::clipDevPath(const SkPath& path, SkCanvas::ClipOp op, bool doAA) {
Element element(fSaveCount, path, op, doAA);
this->pushElement(element);
}
@@ -763,7 +763,7 @@
void SkClipStack::clipEmpty() {
Element* element = (Element*) fDeque.back();
- if (element && element->canBeIntersectedInPlace(fSaveCount, SkRegion::kIntersect_Op)) {
+ if (element && element->canBeIntersectedInPlace(fSaveCount, SkCanvas::kIntersect_Op)) {
element->setEmpty();
}
new (fDeque.push_back()) Element(fSaveCount);
@@ -789,7 +789,7 @@
return (const SkClipStack::Element*)fIter.prev();
}
-const SkClipStack::Element* SkClipStack::Iter::skipToTopmost(SkRegion::Op op) {
+const SkClipStack::Element* SkClipStack::Iter::skipToTopmost(SkCanvas::ClipOp op) {
if (nullptr == fStack) {
return nullptr;
@@ -874,13 +874,13 @@
back->getType() != SkClipStack::Element::kRRect_Type) {
return false;
}
- if (back->getOp() == SkRegion::kReplace_Op) {
+ if (back->getOp() == SkCanvas::kReplace_Op) {
*rrect = back->asRRect();
*aa = back->isAA();
return true;
}
- if (back->getOp() == SkRegion::kIntersect_Op) {
+ if (back->getOp() == SkCanvas::kIntersect_Op) {
SkRect backBounds;
if (!backBounds.intersect(bounds, back->asRRect().rect())) {
return false;
@@ -889,12 +889,12 @@
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() != SkRegion::kIntersect_Op &&
- prior->getOp() != SkRegion::kReplace_Op) ||
+ if ((prior->getOp() != SkCanvas::kIntersect_Op &&
+ prior->getOp() != SkCanvas::kReplace_Op) ||
!prior->contains(backBounds)) {
return false;
}
- if (prior->getOp() == SkRegion::kReplace_Op) {
+ if (prior->getOp() == SkCanvas::kReplace_Op) {
break;
}
}
@@ -946,12 +946,12 @@
"reverse-difference",
"replace",
};
- static_assert(0 == SkRegion::kDifference_Op, "op_str");
- static_assert(1 == SkRegion::kIntersect_Op, "op_str");
- static_assert(2 == SkRegion::kUnion_Op, "op_str");
- static_assert(3 == SkRegion::kXOR_Op, "op_str");
- static_assert(4 == SkRegion::kReverseDifference_Op, "op_str");
- static_assert(5 == SkRegion::kReplace_Op, "op_str");
+ 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(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 227c2f3..3175447 100644
--- a/src/core/SkLiteDL.cpp
+++ b/src/core/SkLiteDL.cpp
@@ -149,34 +149,34 @@
struct ClipPath final : Op {
static const auto kType = Type::ClipPath;
- ClipPath(const SkPath& path, SkRegion::Op op, bool aa) : path(path), op(op), aa(aa) {}
- SkPath path;
- SkRegion::Op op;
- bool aa;
+ ClipPath(const SkPath& path, SkCanvas::ClipOp op, bool aa) : path(path), op(op), aa(aa) {}
+ SkPath path;
+ SkCanvas::ClipOp 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, SkRegion::Op op, bool aa) : rect(rect), op(op), aa(aa) {}
- SkRect rect;
- SkRegion::Op op;
- bool aa;
+ ClipRect(const SkRect& rect, SkCanvas::ClipOp op, bool aa) : rect(rect), op(op), aa(aa) {}
+ SkRect rect;
+ SkCanvas::ClipOp 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, SkRegion::Op op, bool aa) : rrect(rrect), op(op), aa(aa) {}
- SkRRect rrect;
- SkRegion::Op op;
- bool aa;
+ ClipRRect(const SkRRect& rrect, SkCanvas::ClipOp op, bool aa) : rrect(rrect), op(op), aa(aa) {}
+ SkRRect rrect;
+ SkCanvas::ClipOp 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, SkRegion::Op op) : region(region), op(op) {}
- SkRegion region;
- SkRegion::Op op;
+ ClipRegion(const SkRegion& region, SkCanvas::ClipOp op) : region(region), op(op) {}
+ SkRegion region;
+ SkCanvas::ClipOp op;
void draw(SkCanvas* c, const SkMatrix&) { c->clipRegion(region, op); }
};
@@ -597,16 +597,16 @@
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, SkRegion::Op op, bool aa) {
+void SkLiteDL::clipPath(const SkPath& path, SkCanvas::ClipOp op, bool aa) {
this->push<ClipPath>(0, path, op, aa);
}
-void SkLiteDL::clipRect(const SkRect& rect, SkRegion::Op op, bool aa) {
+void SkLiteDL::clipRect(const SkRect& rect, SkCanvas::ClipOp op, bool aa) {
this->push<ClipRect>(0, rect, op, aa);
}
-void SkLiteDL::clipRRect(const SkRRect& rrect, SkRegion::Op op, bool aa) {
+void SkLiteDL::clipRRect(const SkRRect& rrect, SkCanvas::ClipOp op, bool aa) {
this->push<ClipRRect>(0, rrect, op, aa);
}
-void SkLiteDL::clipRegion(const SkRegion& region, SkRegion::Op op) {
+void SkLiteDL::clipRegion(const SkRegion& region, SkCanvas::ClipOp op) {
this->push<ClipRegion>(0, region, op);
}
diff --git a/src/core/SkLiteDL.h b/src/core/SkLiteDL.h
index 8edd700..b18cc54 100644
--- a/src/core/SkLiteDL.h
+++ b/src/core/SkLiteDL.h
@@ -43,10 +43,10 @@
void translate(SkScalar, SkScalar);
void translateZ(SkScalar);
- void clipPath (const SkPath&, SkRegion::Op, bool aa);
- void clipRect (const SkRect&, SkRegion::Op, bool aa);
- void clipRRect (const SkRRect&, SkRegion::Op, bool aa);
- void clipRegion(const SkRegion&, SkRegion::Op);
+ 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 drawPaint (const SkPaint&);
void drawPath (const SkPath&, const SkPaint&);
diff --git a/src/core/SkLiteRecorder.cpp b/src/core/SkLiteRecorder.cpp
index bc5ffbe..77a1bd7 100644
--- a/src/core/SkLiteRecorder.cpp
+++ b/src/core/SkLiteRecorder.cpp
@@ -40,19 +40,19 @@
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, SkRegion::Op op, ClipEdgeStyle style) {
+void SkLiteRecorder::onClipRect(const SkRect& rect, ClipOp op, ClipEdgeStyle style) {
fDL->clipRect(rect, op, style==kSoft_ClipEdgeStyle);
SkCanvas::onClipRect(rect, op, style);
}
-void SkLiteRecorder::onClipRRect(const SkRRect& rrect, SkRegion::Op op, ClipEdgeStyle style) {
+void SkLiteRecorder::onClipRRect(const SkRRect& rrect, ClipOp op, ClipEdgeStyle style) {
fDL->clipRRect(rrect, op, style==kSoft_ClipEdgeStyle);
SkCanvas::onClipRRect(rrect, op, style);
}
-void SkLiteRecorder::onClipPath(const SkPath& path, SkRegion::Op op, ClipEdgeStyle style) {
+void SkLiteRecorder::onClipPath(const SkPath& path, ClipOp op, ClipEdgeStyle style) {
fDL->clipPath(path, op, style==kSoft_ClipEdgeStyle);
SkCanvas::onClipPath(path, op, style);
}
-void SkLiteRecorder::onClipRegion(const SkRegion& region, SkRegion::Op op) {
+void SkLiteRecorder::onClipRegion(const SkRegion& region, ClipOp op) {
fDL->clipRegion(region, op);
SkCanvas::onClipRegion(region, op);
}
diff --git a/src/core/SkLiteRecorder.h b/src/core/SkLiteRecorder.h
index 7ec4f83..be27854 100644
--- a/src/core/SkLiteRecorder.h
+++ b/src/core/SkLiteRecorder.h
@@ -31,10 +31,10 @@
void didSetMatrix(const SkMatrix&) override;
void didTranslate(SkScalar, SkScalar) override;
- void onClipRect (const SkRect&, SkRegion::Op, ClipEdgeStyle) override;
- void onClipRRect (const SkRRect&, SkRegion::Op, ClipEdgeStyle) override;
- void onClipPath (const SkPath&, SkRegion::Op, ClipEdgeStyle) override;
- void onClipRegion(const SkRegion&, SkRegion::Op) 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 onDrawPaint (const SkPaint&) override;
void onDrawPath (const SkPath&, const SkPaint&) override;
diff --git a/src/core/SkPictureAnalyzer.cpp b/src/core/SkPictureAnalyzer.cpp
index b1d61ae..a7a4d94 100644
--- a/src/core/SkPictureAnalyzer.cpp
+++ b/src/core/SkPictureAnalyzer.cpp
@@ -38,11 +38,11 @@
fNumSlowPaths += picture->numSlowPaths();
}
-void SkPictureGpuAnalyzer::analyzeClipPath(const SkPath& path, SkRegion::Op op, bool doAntiAlias) {
+void SkPictureGpuAnalyzer::analyzeClipPath(const SkPath& path, SkCanvas::ClipOp op, bool doAntiAlias) {
const SkRecords::ClipPath clipOp = {
SkIRect::MakeEmpty(), // Willie don't care.
path,
- SkRecords::RegionOpAndAA(op, doAntiAlias)
+ SkRecords::ClipOpAndAA(op, doAntiAlias)
};
SkPathCounter counter;
diff --git a/src/core/SkPictureFlat.h b/src/core/SkPictureFlat.h
index acd2d82..beb2dd8 100644
--- a/src/core/SkPictureFlat.h
+++ b/src/core/SkPictureFlat.h
@@ -7,7 +7,7 @@
#ifndef SkPictureFlat_DEFINED
#define SkPictureFlat_DEFINED
-
+#include "SkCanvas.h"
#include "SkChecksum.h"
#include "SkChunkAlloc.h"
#include "SkReadBuffer.h"
@@ -126,15 +126,15 @@
///////////////////////////////////////////////////////////////////////////////
// clipparams are packed in 5 bits
-// doAA:1 | regionOp:4
+// doAA:1 | clipOp:4
-static inline uint32_t ClipParams_pack(SkRegion::Op op, bool doAA) {
+static inline uint32_t ClipParams_pack(SkCanvas::ClipOp op, bool doAA) {
unsigned doAABit = doAA ? 1 : 0;
return (doAABit << 4) | op;
}
-static inline SkRegion::Op ClipParams_unpackRegionOp(uint32_t packed) {
- return (SkRegion::Op)(packed & 0xF);
+static inline SkCanvas::ClipOp ClipParams_unpackRegionOp(uint32_t packed) {
+ return (SkCanvas::ClipOp)(packed & 0xF);
}
static inline bool ClipParams_unpackDoAA(uint32_t packed) {
diff --git a/src/core/SkPicturePlayback.cpp b/src/core/SkPicturePlayback.cpp
index 4520b6d..cc16855 100644
--- a/src/core/SkPicturePlayback.cpp
+++ b/src/core/SkPicturePlayback.cpp
@@ -126,11 +126,11 @@
case CLIP_PATH: {
const SkPath& path = fPictureData->getPath(reader);
uint32_t packed = reader->readInt();
- SkRegion::Op regionOp = ClipParams_unpackRegionOp(packed);
+ SkCanvas::ClipOp clipOp = ClipParams_unpackRegionOp(packed);
bool doAA = ClipParams_unpackDoAA(packed);
size_t offsetToRestore = reader->readInt();
SkASSERT(!offsetToRestore || offsetToRestore >= reader->offset());
- canvas->clipPath(path, regionOp, doAA);
+ canvas->clipPath(path, clipOp, doAA);
if (canvas->isClipEmpty() && offsetToRestore) {
reader->skip(offsetToRestore - reader->offset());
}
@@ -139,10 +139,10 @@
SkRegion region;
reader->readRegion(®ion);
uint32_t packed = reader->readInt();
- SkRegion::Op regionOp = ClipParams_unpackRegionOp(packed);
+ SkCanvas::ClipOp clipOp = ClipParams_unpackRegionOp(packed);
size_t offsetToRestore = reader->readInt();
SkASSERT(!offsetToRestore || offsetToRestore >= reader->offset());
- canvas->clipRegion(region, regionOp);
+ canvas->clipRegion(region, clipOp);
if (canvas->isClipEmpty() && offsetToRestore) {
reader->skip(offsetToRestore - reader->offset());
}
@@ -151,11 +151,11 @@
SkRect rect;
reader->readRect(&rect);
uint32_t packed = reader->readInt();
- SkRegion::Op regionOp = ClipParams_unpackRegionOp(packed);
+ SkCanvas::ClipOp clipOp = ClipParams_unpackRegionOp(packed);
bool doAA = ClipParams_unpackDoAA(packed);
size_t offsetToRestore = reader->readInt();
SkASSERT(!offsetToRestore || offsetToRestore >= reader->offset());
- canvas->clipRect(rect, regionOp, doAA);
+ canvas->clipRect(rect, clipOp, doAA);
if (canvas->isClipEmpty() && offsetToRestore) {
reader->skip(offsetToRestore - reader->offset());
}
@@ -164,11 +164,11 @@
SkRRect rrect;
reader->readRRect(&rrect);
uint32_t packed = reader->readInt();
- SkRegion::Op regionOp = ClipParams_unpackRegionOp(packed);
+ SkCanvas::ClipOp clipOp = ClipParams_unpackRegionOp(packed);
bool doAA = ClipParams_unpackDoAA(packed);
size_t offsetToRestore = reader->readInt();
SkASSERT(!offsetToRestore || offsetToRestore >= reader->offset());
- canvas->clipRRect(rrect, regionOp, doAA);
+ canvas->clipRRect(rrect, clipOp, doAA);
if (canvas->isClipEmpty() && offsetToRestore) {
reader->skip(offsetToRestore - reader->offset());
}
diff --git a/src/core/SkPictureRecord.cpp b/src/core/SkPictureRecord.cpp
index 5ee2e9f..4cba3b0 100644
--- a/src/core/SkPictureRecord.cpp
+++ b/src/core/SkPictureRecord.cpp
@@ -230,15 +230,15 @@
#endif
}
-static bool regionOpExpands(SkRegion::Op op) {
+static bool clipOpExpands(SkCanvas::ClipOp op) {
switch (op) {
- case SkRegion::kUnion_Op:
- case SkRegion::kXOR_Op:
- case SkRegion::kReverseDifference_Op:
- case SkRegion::kReplace_Op:
+ case SkCanvas::kUnion_Op:
+ case SkCanvas::kXOR_Op:
+ case SkCanvas::kReverseDifference_Op:
+ case SkCanvas::kReplace_Op:
return true;
- case SkRegion::kIntersect_Op:
- case SkRegion::kDifference_Op:
+ case SkCanvas::kIntersect_Op:
+ case SkCanvas::kDifference_Op:
return false;
default:
SkDEBUGFAIL("unknown region op");
@@ -279,7 +279,7 @@
this->restoreToCount(fInitialSaveCount);
}
-size_t SkPictureRecord::recordRestoreOffsetPlaceholder(SkRegion::Op op) {
+size_t SkPictureRecord::recordRestoreOffsetPlaceholder(ClipOp op) {
if (fRestoreOffsetStack.isEmpty()) {
return -1;
}
@@ -291,7 +291,7 @@
// restore command is recorded.
int32_t prevOffset = fRestoreOffsetStack.top();
- if (regionOpExpands(op)) {
+ if (clipOpExpands(op)) {
// Run back through any previous clip ops, and mark their offset to
// be 0, disabling their ability to trigger a jump-to-restore, otherwise
// they could hide this clips ability to expand the clip (i.e. go from
@@ -309,12 +309,12 @@
return offset;
}
-void SkPictureRecord::onClipRect(const SkRect& rect, SkRegion::Op op, ClipEdgeStyle edgeStyle) {
+void SkPictureRecord::onClipRect(const SkRect& rect, SkCanvas::ClipOp op, ClipEdgeStyle edgeStyle) {
this->recordClipRect(rect, op, kSoft_ClipEdgeStyle == edgeStyle);
this->INHERITED::onClipRect(rect, op, edgeStyle);
}
-size_t SkPictureRecord::recordClipRect(const SkRect& rect, SkRegion::Op op, bool doAA) {
+size_t SkPictureRecord::recordClipRect(const SkRect& rect, SkCanvas::ClipOp 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 @@
return offset;
}
-void SkPictureRecord::onClipRRect(const SkRRect& rrect, SkRegion::Op op, ClipEdgeStyle edgeStyle) {
+void SkPictureRecord::onClipRRect(const SkRRect& rrect, SkCanvas::ClipOp op, ClipEdgeStyle edgeStyle) {
this->recordClipRRect(rrect, op, kSoft_ClipEdgeStyle == edgeStyle);
this->INHERITED::onClipRRect(rrect, op, edgeStyle);
}
-size_t SkPictureRecord::recordClipRRect(const SkRRect& rrect, SkRegion::Op op, bool doAA) {
+size_t SkPictureRecord::recordClipRRect(const SkRRect& rrect, SkCanvas::ClipOp 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 @@
return offset;
}
-void SkPictureRecord::onClipPath(const SkPath& path, SkRegion::Op op, ClipEdgeStyle edgeStyle) {
+void SkPictureRecord::onClipPath(const SkPath& path, SkCanvas::ClipOp 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, SkRegion::Op op, bool doAA) {
+size_t SkPictureRecord::recordClipPath(int pathID, SkCanvas::ClipOp op, bool doAA) {
// op + path index + clip params
size_t size = 3 * kUInt32Size;
// recordRestoreOffsetPlaceholder doesn't always write an offset
@@ -374,12 +374,12 @@
return offset;
}
-void SkPictureRecord::onClipRegion(const SkRegion& region, SkRegion::Op op) {
+void SkPictureRecord::onClipRegion(const SkRegion& region, ClipOp op) {
this->recordClipRegion(region, op);
this->INHERITED::onClipRegion(region, op);
}
-size_t SkPictureRecord::recordClipRegion(const SkRegion& region, SkRegion::Op op) {
+size_t SkPictureRecord::recordClipRegion(const SkRegion& region, ClipOp 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 ac8058b..6d75609 100644
--- a/src/core/SkPictureRecord.h
+++ b/src/core/SkPictureRecord.h
@@ -76,7 +76,7 @@
private:
void handleOptimization(int opt);
- size_t recordRestoreOffsetPlaceholder(SkRegion::Op);
+ size_t recordRestoreOffsetPlaceholder(SkCanvas::ClipOp);
void fillRestoreOffsetPlaceholdersForCurrentStackLevel(uint32_t restoreOffset);
SkTDArray<int32_t> fRestoreOffsetStack;
@@ -205,10 +205,10 @@
const uint16_t indices[], int indexCount,
const SkPaint&) override;
- void onClipRect(const SkRect&, SkRegion::Op, ClipEdgeStyle) override;
- void onClipRRect(const SkRRect&, SkRegion::Op, ClipEdgeStyle) override;
- void onClipPath(const SkPath&, SkRegion::Op, ClipEdgeStyle) override;
- void onClipRegion(const SkRegion&, SkRegion::Op) 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 onDrawPicture(const SkPicture*, const SkMatrix*, const SkPaint*) override;
@@ -231,10 +231,10 @@
void recordConcat(const SkMatrix& matrix);
void recordTranslate(const SkMatrix& matrix);
void recordScale(const SkMatrix& matrix);
- size_t recordClipRect(const SkRect& rect, SkRegion::Op op, bool doAA);
- size_t recordClipRRect(const SkRRect& rrect, SkRegion::Op op, bool doAA);
- size_t recordClipPath(int pathID, SkRegion::Op op, bool doAA);
- size_t recordClipRegion(const SkRegion& region, SkRegion::Op op);
+ 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);
void recordSave();
void recordSaveLayer(const SaveLayerRec&);
void recordRestore(bool fillInSkips = true);
diff --git a/src/core/SkRecorder.cpp b/src/core/SkRecorder.cpp
index 4c09e51..0c23671 100644
--- a/src/core/SkRecorder.cpp
+++ b/src/core/SkRecorder.cpp
@@ -402,25 +402,25 @@
#endif
}
-void SkRecorder::onClipRect(const SkRect& rect, SkRegion::Op op, ClipEdgeStyle edgeStyle) {
+void SkRecorder::onClipRect(const SkRect& rect, ClipOp op, ClipEdgeStyle edgeStyle) {
INHERITED(onClipRect, rect, op, edgeStyle);
- SkRecords::RegionOpAndAA opAA(op, kSoft_ClipEdgeStyle == edgeStyle);
+ SkRecords::ClipOpAndAA opAA(op, kSoft_ClipEdgeStyle == edgeStyle);
APPEND(ClipRect, this->devBounds(), rect, opAA);
}
-void SkRecorder::onClipRRect(const SkRRect& rrect, SkRegion::Op op, ClipEdgeStyle edgeStyle) {
+void SkRecorder::onClipRRect(const SkRRect& rrect, ClipOp op, ClipEdgeStyle edgeStyle) {
INHERITED(onClipRRect, rrect, op, edgeStyle);
- SkRecords::RegionOpAndAA opAA(op, kSoft_ClipEdgeStyle == edgeStyle);
+ SkRecords::ClipOpAndAA opAA(op, kSoft_ClipEdgeStyle == edgeStyle);
APPEND(ClipRRect, this->devBounds(), rrect, opAA);
}
-void SkRecorder::onClipPath(const SkPath& path, SkRegion::Op op, ClipEdgeStyle edgeStyle) {
+void SkRecorder::onClipPath(const SkPath& path, ClipOp op, ClipEdgeStyle edgeStyle) {
INHERITED(onClipPath, path, op, edgeStyle);
- SkRecords::RegionOpAndAA opAA(op, kSoft_ClipEdgeStyle == edgeStyle);
+ SkRecords::ClipOpAndAA opAA(op, kSoft_ClipEdgeStyle == edgeStyle);
APPEND(ClipPath, this->devBounds(), path, opAA);
}
-void SkRecorder::onClipRegion(const SkRegion& deviceRgn, SkRegion::Op op) {
+void SkRecorder::onClipRegion(const SkRegion& deviceRgn, ClipOp op) {
INHERITED(onClipRegion, deviceRgn, op);
APPEND(ClipRegion, this->devBounds(), deviceRgn, op);
}
diff --git a/src/core/SkRecorder.h b/src/core/SkRecorder.h
index 3ab958b..8efae17 100644
--- a/src/core/SkRecorder.h
+++ b/src/core/SkRecorder.h
@@ -132,10 +132,10 @@
void onDrawAtlas(const SkImage*, const SkRSXform[], const SkRect[], const SkColor[],
int count, SkXfermode::Mode, const SkRect* cull, const SkPaint*) override;
- void onClipRect(const SkRect& rect, SkRegion::Op op, ClipEdgeStyle edgeStyle) override;
- void onClipRRect(const SkRRect& rrect, SkRegion::Op op, ClipEdgeStyle edgeStyle) override;
- void onClipPath(const SkPath& path, SkRegion::Op op, ClipEdgeStyle edgeStyle) override;
- void onClipRegion(const SkRegion& deviceRgn, SkRegion::Op op) 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 onDrawPicture(const SkPicture*, const SkMatrix*, const SkPaint*) override;
diff --git a/src/effects/SkXfermodeImageFilter.cpp b/src/effects/SkXfermodeImageFilter.cpp
index 8721dd7..c82482d 100644
--- a/src/effects/SkXfermodeImageFilter.cpp
+++ b/src/effects/SkXfermodeImageFilter.cpp
@@ -125,7 +125,7 @@
&paint);
}
- canvas->clipRect(SkRect::Make(foregroundBounds), SkRegion::kDifference_Op);
+ canvas->clipRect(SkRect::Make(foregroundBounds), SkCanvas::kDifference_Op);
paint.setColor(SK_ColorTRANSPARENT);
canvas->drawPaint(paint);
diff --git a/src/gpu/GrClipStackClip.cpp b/src/gpu/GrClipStackClip.cpp
index d6ad1d9..d85db11 100644
--- a/src/gpu/GrClipStackClip.cpp
+++ b/src/gpu/GrClipStackClip.cpp
@@ -181,10 +181,10 @@
for (ElementList::Iter iter(reducedClip.elements()); iter.get(); iter.next()) {
const Element* element = iter.get();
- SkRegion::Op op = element->getOp();
+ SkCanvas::ClipOp op = element->getOp();
bool invert = element->isInverseFilled();
bool needsStencil = invert ||
- SkRegion::kIntersect_Op == op || SkRegion::kReverseDifference_Op == op;
+ SkCanvas::kIntersect_Op == op || SkCanvas::kReverseDifference_Op == op;
if (PathNeedsSWRenderer(context, hasUserStencilSettings,
drawContext, translate, element, nullptr, needsStencil)) {
@@ -205,7 +205,7 @@
SkSTArray<kMaxAnalyticElements, sk_sp<GrFragmentProcessor>> fps;
ElementList::Iter iter(elements);
while (iter.get()) {
- SkRegion::Op op = iter.get()->getOp();
+ SkCanvas::ClipOp op = iter.get()->getOp();
bool invert;
bool skip = false;
switch (op) {
@@ -450,14 +450,14 @@
for (ElementList::Iter iter(reducedClip.elements()); iter.get(); iter.next()) {
const Element* element = iter.get();
- SkRegion::Op op = element->getOp();
+ SkCanvas::ClipOp op = element->getOp();
- if (SkRegion::kIntersect_Op == op || SkRegion::kReverseDifference_Op == op) {
+ if (SkCanvas::kIntersect_Op == op || SkCanvas::kReverseDifference_Op == 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 (SkRegion::kReverseDifference_Op == op) {
+ if (SkCanvas::kReverseDifference_Op == op) {
SkRect temp = SkRect::Make(reducedClip.ibounds());
// invert the entire scene
helper.drawRect(temp, SkRegion::kXOR_Op, false, 0xFF);
@@ -473,12 +473,12 @@
// The other ops (union, xor, diff) only affect pixels inside
// the geometry so they can just be drawn normally
if (Element::kRect_Type == element->getType()) {
- helper.drawRect(element->getRect(), op, element->isAA(), 0xFF);
+ helper.drawRect(element->getRect(), (SkRegion::Op)op, element->isAA(), 0xFF);
} else {
SkPath path;
element->asPath(&path);
GrShape shape(path, GrStyle::SimpleFill());
- helper.drawShape(shape, op, element->isAA(), 0xFF);
+ helper.drawShape(shape, (SkRegion::Op)op, element->isAA(), 0xFF);
}
}
diff --git a/src/gpu/GrReducedClip.cpp b/src/gpu/GrReducedClip.cpp
index 89690d3..4a912d3 100644
--- a/src/gpu/GrReducedClip.cpp
+++ b/src/gpu/GrReducedClip.cpp
@@ -74,7 +74,7 @@
fHasIBounds = true;
// Implement the clip with an AA rect element.
- fElements.addToHead(stackBounds, SkRegion::kReplace_Op, true/*doAA*/);
+ fElements.addToHead(stackBounds, SkCanvas::kReplace_Op, true/*doAA*/);
fElementsGenID = stack.getTopmostGenID();
fRequiresAA = true;
@@ -146,7 +146,7 @@
bool isFlip = false; // does this op just flip the in/out state of every point in the bounds
switch (element->getOp()) {
- case SkRegion::kDifference_Op:
+ case SkCanvas::kDifference_Op:
// 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()) {
@@ -172,7 +172,7 @@
emsmallens = true;
}
break;
- case SkRegion::kIntersect_Op:
+ case SkCanvas::kIntersect_Op:
// 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.
@@ -205,7 +205,7 @@
emsmallens = true;
}
break;
- case SkRegion::kUnion_Op:
+ case SkCanvas::kUnion_Op:
// 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.
@@ -228,7 +228,7 @@
embiggens = true;
}
break;
- case SkRegion::kXOR_Op:
+ case SkCanvas::kXOR_Op:
// 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
@@ -250,7 +250,7 @@
emsmallens = embiggens = true;
}
break;
- case SkRegion::kReverseDifference_Op:
+ case SkCanvas::kReverseDifference_Op:
// 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
@@ -275,7 +275,7 @@
}
break;
- case SkRegion::kReplace_Op:
+ case SkCanvas::kReplace_Op:
// 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
@@ -325,9 +325,9 @@
// if it is a flip, change it to a bounds-filling rect
if (isFlip) {
- SkASSERT(SkRegion::kXOR_Op == element->getOp() ||
- SkRegion::kReverseDifference_Op == element->getOp());
- fElements.addToHead(SkRect::Make(fIBounds), SkRegion::kReverseDifference_Op, false);
+ SkASSERT(SkCanvas::kXOR_Op == element->getOp() ||
+ SkCanvas::kReverseDifference_Op == element->getOp());
+ fElements.addToHead(SkRect::Make(fIBounds), SkCanvas::kReverseDifference_Op, false);
} else {
Element* newElement = fElements.addToHead(*element);
if (newElement->isAA()) {
@@ -336,11 +336,11 @@
// 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 = SkRegion::kReplace_Op == newElement->getOp();
+ bool isReplace = SkCanvas::kReplace_Op == newElement->getOp();
if (newElement->isInverseFilled() &&
- (SkRegion::kIntersect_Op == newElement->getOp() || isReplace)) {
+ (SkCanvas::kIntersect_Op == newElement->getOp() || isReplace)) {
newElement->invertShapeFillType();
- newElement->setOp(SkRegion::kDifference_Op);
+ newElement->setOp(SkCanvas::kDifference_Op);
if (isReplace) {
SkASSERT(InitialTriState::kAllOut == initialTriState);
initialTriState = InitialTriState::kAllIn;
@@ -359,36 +359,36 @@
while (element) {
bool skippable = false;
switch (element->getOp()) {
- case SkRegion::kDifference_Op:
+ case SkCanvas::kDifference_Op:
// subtracting from the empty set yields the empty set.
skippable = InitialTriState::kAllOut == initialTriState;
break;
- case SkRegion::kIntersect_Op:
+ case SkCanvas::kIntersect_Op:
// 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(SkRegion::kReplace_Op);
+ element->setOp(SkCanvas::kReplace_Op);
}
break;
- case SkRegion::kUnion_Op:
+ case SkCanvas::kUnion_Op:
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(SkRegion::kReplace_Op);
+ element->setOp(SkCanvas::kReplace_Op);
}
break;
- case SkRegion::kXOR_Op:
+ case SkCanvas::kXOR_Op:
if (InitialTriState::kAllOut == initialTriState) {
// xor could be changed to diff in the kAllIn case, not sure it's a win.
- element->setOp(SkRegion::kReplace_Op);
+ element->setOp(SkCanvas::kReplace_Op);
}
break;
- case SkRegion::kReverseDifference_Op:
+ case SkCanvas::kReverseDifference_Op:
if (InitialTriState::kAllIn == initialTriState) {
// subtracting the whole plane will yield the empty set.
skippable = true;
@@ -401,11 +401,11 @@
if (skippable) {
initialTriState = InitialTriState::kAllIn;
} else {
- element->setOp(SkRegion::kReplace_Op);
+ element->setOp(SkCanvas::kReplace_Op);
}
}
break;
- case SkRegion::kReplace_Op:
+ case SkCanvas::kReplace_Op:
skippable = false; // we would have skipped it in the backwards walk if we
// could've.
break;
@@ -430,12 +430,12 @@
fInitialState = static_cast<GrReducedClip::InitialState>(initialTriState);
}
-static bool element_is_pure_subtract(SkRegion::Op op) {
+static bool element_is_pure_subtract(SkCanvas::ClipOp op) {
SkASSERT(op >= 0);
- return op <= SkRegion::kIntersect_Op;
+ return op <= SkCanvas::kIntersect_Op;
- GR_STATIC_ASSERT(0 == SkRegion::kDifference_Op);
- GR_STATIC_ASSERT(1 == SkRegion::kIntersect_Op);
+ GR_STATIC_ASSERT(0 == SkCanvas::kDifference_Op);
+ GR_STATIC_ASSERT(1 == SkCanvas::kIntersect_Op);
}
void GrReducedClip::addInteriorWindowRectangles(int maxWindowRectangles) {
@@ -445,7 +445,7 @@
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 (SkRegion::kDifference_Op != element->getOp()) {
+ if (SkCanvas::kDifference_Op != element->getOp()) {
continue;
}
@@ -536,7 +536,7 @@
break;
case Element::kRect_Type:
return dc->drawContextPriv().drawAndStencilRect(clip, ss,
- element->getOp(),
+ (SkRegion::Op)element->getOp(),
element->isInverseFilled(),
element->isAA(),
viewMatrix, element->getRect());
@@ -549,7 +549,7 @@
}
return dc->drawContextPriv().drawAndStencilPath(clip, ss,
- element->getOp(),
+ (SkRegion::Op)element->getOp(),
element->isInverseFilled(),
element->isAA(), viewMatrix, path);
break;
@@ -608,7 +608,7 @@
// walk through each clip element and perform its set op
for (ElementList::Iter iter(fElements); iter.get(); iter.next()) {
const Element* element = iter.get();
- SkRegion::Op op = element->getOp();
+ SkRegion::Op op = (SkRegion::Op)element->getOp();
bool invert = element->isInverseFilled();
if (invert || SkRegion::kIntersect_Op == op || SkRegion::kReverseDifference_Op == op) {
// draw directly into the result with the stencil set to make the pixels affected
@@ -722,7 +722,7 @@
// stencil with arbitrary stencil settings.
GrPathRenderer::StencilSupport stencilSupport;
- SkRegion::Op op = element->getOp();
+ SkRegion::Op op = (SkRegion::Op)element->getOp();
GrPathRenderer* pr = nullptr;
SkPath clipPath;
diff --git a/src/pdf/SkPDFCanvas.cpp b/src/pdf/SkPDFCanvas.cpp
index 4ef1922..0fc242b 100644
--- a/src/pdf/SkPDFCanvas.cpp
+++ b/src/pdf/SkPDFCanvas.cpp
@@ -19,15 +19,15 @@
* 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, SkRegion::Op op, ClipEdgeStyle edgeStyle) {
+void SkPDFCanvas::onClipRect(const SkRect& rect, ClipOp op, ClipEdgeStyle edgeStyle) {
this->INHERITED::onClipRect(rect, op, kHard_ClipEdgeStyle);
}
-void SkPDFCanvas::onClipRRect(const SkRRect& rrect, SkRegion::Op op, ClipEdgeStyle edgeStyle) {
+void SkPDFCanvas::onClipRRect(const SkRRect& rrect, ClipOp op, ClipEdgeStyle edgeStyle) {
this->INHERITED::onClipRRect(rrect, op, kHard_ClipEdgeStyle);
}
-void SkPDFCanvas::onClipPath(const SkPath& path, SkRegion::Op op, ClipEdgeStyle edgeStyle) {
+void SkPDFCanvas::onClipPath(const SkPath& path, ClipOp op, ClipEdgeStyle edgeStyle) {
this->INHERITED::onClipPath(path, op, kHard_ClipEdgeStyle);
}
diff --git a/src/pdf/SkPDFCanvas.h b/src/pdf/SkPDFCanvas.h
index 5040e98..ead13c3 100644
--- a/src/pdf/SkPDFCanvas.h
+++ b/src/pdf/SkPDFCanvas.h
@@ -17,9 +17,9 @@
~SkPDFCanvas();
protected:
- void onClipRect(const SkRect&, SkRegion::Op, ClipEdgeStyle) override;
- void onClipRRect(const SkRRect&, SkRegion::Op, ClipEdgeStyle) override;
- void onClipPath(const SkPath&, SkRegion::Op, ClipEdgeStyle) override;
+ void onClipRect(const SkRect&, ClipOp, ClipEdgeStyle) override;
+ void onClipRRect(const SkRRect&, ClipOp, ClipEdgeStyle) override;
+ void onClipPath(const SkPath&, ClipOp, 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 0e54bfd..5299d70 100644
--- a/src/pdf/SkPDFDevice.cpp
+++ b/src/pdf/SkPDFDevice.cpp
@@ -176,9 +176,9 @@
static_assert(SkRegion::kReverseDifference_Op == (int)kReverseDifference_SkPathOp,
"region_pathop_mismatch");
-static SkPathOp region_op_to_pathops_op(SkRegion::Op op) {
+static SkPathOp region_op_to_pathops_op(SkCanvas::ClipOp op) {
SkASSERT(op >= 0);
- SkASSERT(op <= SkRegion::kReverseDifference_Op);
+ SkASSERT(op <= SkCanvas::kReverseDifference_Op);
return (SkPathOp)op;
}
@@ -209,7 +209,7 @@
}
entryPath.transform(transform);
- if (SkRegion::kReplace_Op == clipEntry->getOp()) {
+ if (SkCanvas::kReplace_Op == clipEntry->getOp()) {
*outClipPath = entryPath;
} else {
SkPathOp op = region_op_to_pathops_op(clipEntry->getOp());
@@ -1753,7 +1753,7 @@
synthesizedClipStack = fExistingClipStack;
SkPath clipPath;
clipRegion.getBoundaryPath(&clipPath);
- synthesizedClipStack.clipDevPath(clipPath, SkRegion::kReplace_Op,
+ synthesizedClipStack.clipDevPath(clipPath, SkCanvas::kReplace_Op,
false);
clipStack = &synthesizedClipStack;
}
diff --git a/src/pipe/SkPipeCanvas.cpp b/src/pipe/SkPipeCanvas.cpp
index 224451f..21b7267 100644
--- a/src/pipe/SkPipeCanvas.cpp
+++ b/src/pipe/SkPipeCanvas.cpp
@@ -318,21 +318,21 @@
this->INHERITED::didSetMatrix(matrix);
}
-void SkPipeCanvas::onClipRect(const SkRect& rect, SkRegion::Op op, ClipEdgeStyle edgeStyle) {
+void SkPipeCanvas::onClipRect(const SkRect& rect, ClipOp 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, SkRegion::Op op, ClipEdgeStyle edgeStyle) {
+void SkPipeCanvas::onClipRRect(const SkRRect& rrect, ClipOp 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, SkRegion::Op op, ClipEdgeStyle edgeStyle) {
+void SkPipeCanvas::onClipPath(const SkPath& path, ClipOp op, ClipEdgeStyle edgeStyle) {
SkPipeWriter writer(this);
writer.write32(pack_verb(SkPipeVerb::kClipPath, ((unsigned)op << 1) | edgeStyle));
writer.writePath(path);
@@ -340,7 +340,7 @@
this->INHERITED::onClipPath(path, op, edgeStyle);
}
-void SkPipeCanvas::onClipRegion(const SkRegion& deviceRgn, SkRegion::Op op) {
+void SkPipeCanvas::onClipRegion(const SkRegion& deviceRgn, ClipOp 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 82e54fc..50d76ed 100644
--- a/src/pipe/SkPipeCanvas.h
+++ b/src/pipe/SkPipeCanvas.h
@@ -140,10 +140,10 @@
const uint16_t indices[], int indexCount,
const SkPaint&) override;
- void onClipRect(const SkRect&, SkRegion::Op, ClipEdgeStyle) override;
- void onClipRRect(const SkRRect&, SkRegion::Op, ClipEdgeStyle) override;
- void onClipPath(const SkPath&, SkRegion::Op, ClipEdgeStyle) override;
- void onClipRegion(const SkRegion&, SkRegion::Op) 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 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 e0ca373..7157813 100644
--- a/src/pipe/SkPipeReader.cpp
+++ b/src/pipe/SkPipeReader.cpp
@@ -268,21 +268,21 @@
static void clipRect_handler(SkPipeReader& reader, uint32_t packedVerb, SkCanvas* canvas) {
SkASSERT(SkPipeVerb::kClipRect == unpack_verb(packedVerb));
- SkRegion::Op op = (SkRegion::Op)(unpack_verb_extra(packedVerb) >> 1);
+ SkCanvas::ClipOp op = (SkCanvas::ClipOp)(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));
- SkRegion::Op op = (SkRegion::Op)(unpack_verb_extra(packedVerb) >> 1);
+ SkCanvas::ClipOp op = (SkCanvas::ClipOp)(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));
- SkRegion::Op op = (SkRegion::Op)(unpack_verb_extra(packedVerb) >> 1);
+ SkCanvas::ClipOp op = (SkCanvas::ClipOp)(unpack_verb_extra(packedVerb) >> 1);
bool isAA = unpack_verb_extra(packedVerb) & 1;
SkPath path;
reader.readPath(&path);
@@ -291,7 +291,7 @@
static void clipRegion_handler(SkPipeReader& reader, uint32_t packedVerb, SkCanvas* canvas) {
SkASSERT(SkPipeVerb::kClipRegion == unpack_verb(packedVerb));
- SkRegion::Op op = (SkRegion::Op)(unpack_verb_extra(packedVerb) >> 1);
+ SkCanvas::ClipOp op = (SkCanvas::ClipOp)(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 d4d18da..99e8246 100644
--- a/src/svg/SkSVGDevice.cpp
+++ b/src/svg/SkSVGDevice.cpp
@@ -730,7 +730,7 @@
draw.fMatrix->mapRect(&devClipRect, dst);
adjustedClipStack = *draw.fClipStack;
- adjustedClipStack.clipDevRect(devClipRect, SkRegion::kIntersect_Op, paint.isAntiAlias());
+ adjustedClipStack.clipDevRect(devClipRect, SkCanvas::kIntersect_Op, paint.isAntiAlias());
adjustedDraw.fClipStack = &adjustedClipStack;
}
diff --git a/src/utils/SkCanvasStack.cpp b/src/utils/SkCanvasStack.cpp
index a5a483d..58607d7 100644
--- a/src/utils/SkCanvasStack.cpp
+++ b/src/utils/SkCanvasStack.cpp
@@ -53,7 +53,7 @@
void SkCanvasStack::clipToZOrderedBounds() {
SkASSERT(fList.count() == fCanvasData.count());
for (int i = 0; i < fList.count(); ++i) {
- fList[i]->clipRegion(fCanvasData[i].requiredClip, SkRegion::kIntersect_Op);
+ fList[i]->clipRegion(fCanvasData[i].requiredClip);
}
}
@@ -76,22 +76,22 @@
this->SkCanvas::didSetMatrix(matrix);
}
-void SkCanvasStack::onClipRect(const SkRect& r, SkRegion::Op op, ClipEdgeStyle edgeStyle) {
+void SkCanvasStack::onClipRect(const SkRect& r, ClipOp op, ClipEdgeStyle edgeStyle) {
this->INHERITED::onClipRect(r, op, edgeStyle);
this->clipToZOrderedBounds();
}
-void SkCanvasStack::onClipRRect(const SkRRect& rr, SkRegion::Op op, ClipEdgeStyle edgeStyle) {
+void SkCanvasStack::onClipRRect(const SkRRect& rr, ClipOp op, ClipEdgeStyle edgeStyle) {
this->INHERITED::onClipRRect(rr, op, edgeStyle);
this->clipToZOrderedBounds();
}
-void SkCanvasStack::onClipPath(const SkPath& p, SkRegion::Op op, ClipEdgeStyle edgeStyle) {
+void SkCanvasStack::onClipPath(const SkPath& p, ClipOp op, ClipEdgeStyle edgeStyle) {
this->INHERITED::onClipPath(p, op, edgeStyle);
this->clipToZOrderedBounds();
}
-void SkCanvasStack::onClipRegion(const SkRegion& deviceRgn, SkRegion::Op op) {
+void SkCanvasStack::onClipRegion(const SkRegion& deviceRgn, ClipOp 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 300bcd3..762ab9f 100644
--- a/src/utils/SkCanvasStack.h
+++ b/src/utils/SkCanvasStack.h
@@ -31,10 +31,10 @@
protected:
void didSetMatrix(const SkMatrix&) override;
- void onClipRect(const SkRect&, SkRegion::Op, ClipEdgeStyle) override;
- void onClipRRect(const SkRRect&, SkRegion::Op, ClipEdgeStyle) override;
- void onClipPath(const SkPath&, SkRegion::Op, ClipEdgeStyle) override;
- void onClipRegion(const SkRegion&, SkRegion::Op) 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;
private:
void clipToZOrderedBounds();
diff --git a/src/utils/SkCanvasStateUtils.cpp b/src/utils/SkCanvasStateUtils.cpp
index 4ef5e2f..cc8ea43 100644
--- a/src/utils/SkCanvasStateUtils.cpp
+++ b/src/utils/SkCanvasStateUtils.cpp
@@ -142,15 +142,15 @@
bool failed() { return fFailed; }
// ClipVisitor
- void clipRect(const SkRect& rect, SkRegion::Op op, bool antialias) override {
+ void clipRect(const SkRect& rect, SkCanvas::ClipOp op, bool antialias) override {
fFailed |= antialias;
}
- void clipRRect(const SkRRect& rrect, SkRegion::Op op, bool antialias) override {
+ void clipRRect(const SkRRect& rrect, SkCanvas::ClipOp op, bool antialias) override {
fFailed |= antialias;
}
- void clipPath(const SkPath&, SkRegion::Op, bool antialias) override {
+ void clipPath(const SkPath&, SkCanvas::ClipOp, bool antialias) override {
fFailed |= antialias;
}
@@ -284,7 +284,7 @@
}
canvas->setMatrix(matrix);
- canvas->setClipRegion(clip);
+ canvas->clipRegion(clip, SkCanvas::kReplace_Op);
}
static SkCanvas* create_canvas_from_canvas_layer(const SkCanvasLayerState& layerState) {
diff --git a/src/utils/SkDeferredCanvas.cpp b/src/utils/SkDeferredCanvas.cpp
index d2f95d9..c8af14c 100644
--- a/src/utils/SkDeferredCanvas.cpp
+++ b/src/utils/SkDeferredCanvas.cpp
@@ -99,7 +99,7 @@
case kClipRect_Type:
fCanvas->clipRect(rec.fData.fBounds);
this->INHERITED::onClipRect(rec.fData.fBounds,
- SkRegion::kIntersect_Op, kHard_ClipEdgeStyle);
+ kIntersect_Op, kHard_ClipEdgeStyle);
break;
case kTrans_Type:
case kScaleTrans_Type: {
@@ -272,8 +272,8 @@
this->INHERITED::didSetMatrix(matrix);
}
-void SkDeferredCanvas::onClipRect(const SkRect& rect, SkRegion::Op op, ClipEdgeStyle edgeStyle) {
- if (SkRegion::kIntersect_Op == op) {
+void SkDeferredCanvas::onClipRect(const SkRect& rect, ClipOp op, ClipEdgeStyle edgeStyle) {
+ if (kIntersect_Op == op) {
this->push_cliprect(rect);
} else {
this->flush_all();
@@ -282,19 +282,19 @@
}
}
-void SkDeferredCanvas::onClipRRect(const SkRRect& rrect, SkRegion::Op op, ClipEdgeStyle edgeStyle) {
+void SkDeferredCanvas::onClipRRect(const SkRRect& rrect, ClipOp 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, SkRegion::Op op, ClipEdgeStyle edgeStyle) {
+void SkDeferredCanvas::onClipPath(const SkPath& path, ClipOp 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, SkRegion::Op op) {
+void SkDeferredCanvas::onClipRegion(const SkRegion& deviceRgn, ClipOp 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 faa3d66..05ad4cf 100644
--- a/src/utils/SkDeferredCanvas.h
+++ b/src/utils/SkDeferredCanvas.h
@@ -86,10 +86,10 @@
int count, SkXfermode::Mode mode,
const SkRect* cull, const SkPaint* paint) override;
- void onClipRect(const SkRect&, SkRegion::Op, ClipEdgeStyle) override;
- void onClipRRect(const SkRRect&, SkRegion::Op, ClipEdgeStyle) override;
- void onClipPath(const SkPath&, SkRegion::Op, ClipEdgeStyle) override;
- void onClipRegion(const SkRegion&, SkRegion::Op) 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 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 ca18864..fcb24d2 100644
--- a/src/utils/SkDumpCanvas.cpp
+++ b/src/utils/SkDumpCanvas.cpp
@@ -105,7 +105,7 @@
}
}
-static const char* toString(SkRegion::Op op) {
+static const char* toString(SkCanvas::ClipOp op) {
static const char* gOpNames[] = {
"DIFF", "SECT", "UNION", "XOR", "RDIFF", "REPLACE"
};
@@ -258,7 +258,7 @@
return kSoft_ClipEdgeStyle == edgeStyle ? "AA" : "BW";
}
-void SkDumpCanvas::onClipRect(const SkRect& rect, SkRegion::Op op, ClipEdgeStyle edgeStyle) {
+void SkDumpCanvas::onClipRect(const SkRect& rect, ClipOp op, ClipEdgeStyle edgeStyle) {
SkString str;
toString(rect, &str);
this->dump(kClip_Verb, nullptr, "clipRect(%s %s %s)", str.c_str(), toString(op),
@@ -266,7 +266,7 @@
this->INHERITED::onClipRect(rect, op, edgeStyle);
}
-void SkDumpCanvas::onClipRRect(const SkRRect& rrect, SkRegion::Op op, ClipEdgeStyle edgeStyle) {
+void SkDumpCanvas::onClipRRect(const SkRRect& rrect, ClipOp op, ClipEdgeStyle edgeStyle) {
SkString str;
toString(rrect, &str);
this->dump(kClip_Verb, nullptr, "clipRRect(%s %s %s)", str.c_str(), toString(op),
@@ -274,7 +274,7 @@
this->INHERITED::onClipRRect(rrect, op, edgeStyle);
}
-void SkDumpCanvas::onClipPath(const SkPath& path, SkRegion::Op op, ClipEdgeStyle edgeStyle) {
+void SkDumpCanvas::onClipPath(const SkPath& path, ClipOp op, ClipEdgeStyle edgeStyle) {
SkString str;
toString(path, &str);
this->dump(kClip_Verb, nullptr, "clipPath(%s %s %s)", str.c_str(), toString(op),
@@ -282,7 +282,7 @@
this->INHERITED::onClipPath(path, op, edgeStyle);
}
-void SkDumpCanvas::onClipRegion(const SkRegion& deviceRgn, SkRegion::Op op) {
+void SkDumpCanvas::onClipRegion(const SkRegion& deviceRgn, ClipOp op) {
SkString str;
toString(deviceRgn, &str);
this->dump(kClip_Verb, nullptr, "clipRegion(%s %s)", str.c_str(),
diff --git a/src/utils/SkLua.cpp b/src/utils/SkLua.cpp
index 117cb8a..d9beaed 100644
--- a/src/utils/SkLua.cpp
+++ b/src/utils/SkLua.cpp
@@ -405,7 +405,7 @@
this->pushPath(element.getPath(), "path");
break;
}
- this->pushString(region_op(element.getOp()), "op");
+ this->pushString(region_op((SkRegion::Op)element.getOp()), "op");
this->pushBool(element.isAA(), "aa");
CHECK_SETFIELD(key);
}
diff --git a/src/utils/SkLuaCanvas.cpp b/src/utils/SkLuaCanvas.cpp
index 3883924..6b769f0 100644
--- a/src/utils/SkLuaCanvas.cpp
+++ b/src/utils/SkLuaCanvas.cpp
@@ -135,28 +135,28 @@
this->INHERITED::didSetMatrix(matrix);
}
-void SkLuaCanvas::onClipRect(const SkRect& r, SkRegion::Op op, ClipEdgeStyle edgeStyle) {
+void SkLuaCanvas::onClipRect(const SkRect& r, ClipOp 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, SkRegion::Op op, ClipEdgeStyle edgeStyle) {
+void SkLuaCanvas::onClipRRect(const SkRRect& rrect, ClipOp 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, SkRegion::Op op, ClipEdgeStyle edgeStyle) {
+void SkLuaCanvas::onClipPath(const SkPath& path, ClipOp 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, SkRegion::Op op) {
+void SkLuaCanvas::onClipRegion(const SkRegion& deviceRgn, ClipOp op) {
AUTO_LUA("clipRegion");
this->INHERITED::onClipRegion(deviceRgn, op);
}
diff --git a/src/utils/SkNWayCanvas.cpp b/src/utils/SkNWayCanvas.cpp
index 1cd3dc4..e19e7a8 100644
--- a/src/utils/SkNWayCanvas.cpp
+++ b/src/utils/SkNWayCanvas.cpp
@@ -100,7 +100,7 @@
this->INHERITED::didSetMatrix(matrix);
}
-void SkNWayCanvas::onClipRect(const SkRect& rect, SkRegion::Op op, ClipEdgeStyle edgeStyle) {
+void SkNWayCanvas::onClipRect(const SkRect& rect, ClipOp op, ClipEdgeStyle edgeStyle) {
Iter iter(fList);
while (iter.next()) {
iter->clipRect(rect, op, kSoft_ClipEdgeStyle == edgeStyle);
@@ -108,7 +108,7 @@
this->INHERITED::onClipRect(rect, op, edgeStyle);
}
-void SkNWayCanvas::onClipRRect(const SkRRect& rrect, SkRegion::Op op, ClipEdgeStyle edgeStyle) {
+void SkNWayCanvas::onClipRRect(const SkRRect& rrect, ClipOp op, ClipEdgeStyle edgeStyle) {
Iter iter(fList);
while (iter.next()) {
iter->clipRRect(rrect, op, kSoft_ClipEdgeStyle == edgeStyle);
@@ -116,7 +116,7 @@
this->INHERITED::onClipRRect(rrect, op, edgeStyle);
}
-void SkNWayCanvas::onClipPath(const SkPath& path, SkRegion::Op op, ClipEdgeStyle edgeStyle) {
+void SkNWayCanvas::onClipPath(const SkPath& path, ClipOp op, ClipEdgeStyle edgeStyle) {
Iter iter(fList);
while (iter.next()) {
iter->clipPath(path, op, kSoft_ClipEdgeStyle == edgeStyle);
@@ -124,7 +124,7 @@
this->INHERITED::onClipPath(path, op, edgeStyle);
}
-void SkNWayCanvas::onClipRegion(const SkRegion& deviceRgn, SkRegion::Op op) {
+void SkNWayCanvas::onClipRegion(const SkRegion& deviceRgn, ClipOp op) {
Iter iter(fList);
while (iter.next()) {
iter->clipRegion(deviceRgn, op);