diff options
-rw-r--r-- | gm/windowrectangles.cpp | 14 | ||||
-rw-r--r-- | include/core/SkClipStack.h | 10 | ||||
-rw-r--r-- | src/core/SkCanvas.cpp | 104 | ||||
-rw-r--r-- | src/core/SkClipStack.cpp | 57 | ||||
-rw-r--r-- | src/core/SkRasterClip.cpp | 56 | ||||
-rw-r--r-- | src/core/SkRasterClip.h | 6 | ||||
-rw-r--r-- | src/pdf/SkPDFDevice.cpp | 8 | ||||
-rw-r--r-- | src/svg/SkSVGDevice.cpp | 6 | ||||
-rw-r--r-- | tests/AAClipTest.cpp | 8 | ||||
-rw-r--r-- | tests/ClipBoundsTest.cpp | 2 | ||||
-rw-r--r-- | tests/ClipStackTest.cpp | 206 |
11 files changed, 226 insertions, 251 deletions
diff --git a/gm/windowrectangles.cpp b/gm/windowrectangles.cpp index f1a7356a98..3928763e14 100644 --- a/gm/windowrectangles.cpp +++ b/gm/windowrectangles.cpp @@ -42,19 +42,21 @@ void WindowRectanglesBaseGM::onDraw(SkCanvas* canvas) { canvas->saveLayer(SkRect::Make(kLayerRect), nullptr); SkClipStack stack; - stack.clipDevRect(SkRect::MakeXYWH(370.75, 80.25, 149, 100), SkCanvas::kDifference_Op, false); - stack.clipDevRect(SkRect::MakeXYWH(80.25, 420.75, 150, 100), SkCanvas::kDifference_Op, true); - stack.clipDevRRect(SkRRect::MakeRectXY(SkRect::MakeXYWH(200, 200, 200, 200), 60, 45), - SkCanvas::kDifference_Op, true); + stack.clipRect(SkRect::MakeXYWH(370.75, 80.25, 149, 100), SkMatrix::I(), + SkCanvas::kDifference_Op, false); + stack.clipRect(SkRect::MakeXYWH(80.25, 420.75, 150, 100), SkMatrix::I(), + SkCanvas::kDifference_Op, true); + stack.clipRRect(SkRRect::MakeRectXY(SkRect::MakeXYWH(200, 200, 200, 200), 60, 45), + SkMatrix::I(), SkCanvas::kDifference_Op, true); SkRRect nine; nine.setNinePatch(SkRect::MakeXYWH(550 - 30.25 - 100, 370.75, 100, 150), 12, 35, 23, 20); - stack.clipDevRRect(nine, SkCanvas::kDifference_Op, true); + stack.clipRRect(nine, SkMatrix::I(), SkCanvas::kDifference_Op, 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.clipDevRRect(complx, SkCanvas::kDifference_Op, false); + stack.clipRRect(complx, SkMatrix::I(), SkCanvas::kDifference_Op, false); this->onCoverClipStack(stack, canvas); diff --git a/include/core/SkClipStack.h b/include/core/SkClipStack.h index 1fb7b5c9da..7a8eb5ca84 100644 --- a/include/core/SkClipStack.h +++ b/include/core/SkClipStack.h @@ -302,8 +302,6 @@ public: SkClipStack(); SkClipStack(const SkClipStack& b); - explicit SkClipStack(const SkRect& r); - explicit SkClipStack(const SkIRect& r); ~SkClipStack(); SkClipStack& operator=(const SkClipStack& b); @@ -351,11 +349,11 @@ public: void clipDevRect(const SkIRect& ir, SkCanvas::ClipOp op) { SkRect r; r.set(ir); - this->clipDevRect(r, op, false); + this->clipRect(r, SkMatrix::I(), op, false); } - void clipDevRect(const SkRect&, SkCanvas::ClipOp, bool doAA); - void clipDevRRect(const SkRRect&, SkCanvas::ClipOp, bool doAA); - void clipDevPath(const SkPath&, SkCanvas::ClipOp, bool doAA); + 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); // An optimized version of clipDevRect(emptyRect, kIntersect, ...) void clipEmpty(); diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp index c55ca10f77..7db8601846 100644 --- a/src/core/SkCanvas.cpp +++ b/src/core/SkCanvas.cpp @@ -1545,42 +1545,12 @@ void SkCanvas::clipRect(const SkRect& rect, ClipOp op, bool doAA) { } 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 (kIntersect_Op == op && kHard_ClipEdgeStyle == edgeStyle && isScaleTrans) { - if (devR.round().contains(fMCRec->fRasterClip.getBounds())) { -#if 0 - SkDebugf("------- ignored clipRect [%g %g %g %g]\n", - rect.left(), rect.top(), rect.right(), rect.bottom()); -#endif - return; - } - } - + const bool isAA = kSoft_ClipEdgeStyle == edgeStyle; AutoValidateClip avc(this); - + fClipStack->clipRect(rect, fMCRec->fMatrix, op, isAA); + fMCRec->fRasterClip.op(rect, fMCRec->fMatrix, this->getTopLayerBounds(), (SkRegion::Op)op, + isAA); fDeviceCMDirty = true; - - if (isScaleTrans) { - const bool isAA = kSoft_ClipEdgeStyle == edgeStyle; - fClipStack->clipDevRect(devR, 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 - // avoid recursion in the case where we are subclassed (e.g. Pictures) - // we explicitly call "our" version of clipPath. - SkPath path; - - path.addRect(rect); - path.setIsVolatile(true); - this->SkCanvas::onClipPath(path, op, edgeStyle); - } - fDeviceClipBounds = qr_clip_bounds(fMCRec->fRasterClip.getBounds()); } @@ -1595,25 +1565,16 @@ void SkCanvas::clipRRect(const SkRRect& rrect, ClipOp op, bool doAA) { } void SkCanvas::onClipRRect(const SkRRect& rrect, ClipOp op, ClipEdgeStyle edgeStyle) { - SkRRect transformedRRect; - if (rrect.transform(fMCRec->fMatrix, &transformedRRect)) { - AutoValidateClip avc(this); - - fDeviceCMDirty = true; - - fClipStack->clipDevRRect(transformedRRect, op, kSoft_ClipEdgeStyle == edgeStyle); + AutoValidateClip avc(this); - fMCRec->fRasterClip.op(transformedRRect, this->getTopLayerBounds(), (SkRegion::Op)op, - kSoft_ClipEdgeStyle == edgeStyle); - fDeviceClipBounds = qr_clip_bounds(fMCRec->fRasterClip.getBounds()); - return; - } + fDeviceCMDirty = true; - SkPath path; - path.addRRect(rrect); - path.setIsVolatile(true); - // call the non-virtual version - this->SkCanvas::onClipPath(path, op, edgeStyle); + bool isAA = kSoft_ClipEdgeStyle == edgeStyle; + fClipStack->clipRRect(rrect, fMCRec->fMatrix, op, isAA); + fMCRec->fRasterClip.op(rrect, fMCRec->fMatrix, this->getTopLayerBounds(), (SkRegion::Op)op, + isAA); + fDeviceClipBounds = qr_clip_bounds(fMCRec->fRasterClip.getBounds()); + return; } void SkCanvas::clipPath(const SkPath& path, ClipOp op, bool doAA) { @@ -1645,38 +1606,21 @@ void SkCanvas::onClipPath(const SkPath& path, ClipOp op, ClipEdgeStyle edgeStyle AutoValidateClip avc(this); fDeviceCMDirty = true; + bool isAA = kSoft_ClipEdgeStyle == edgeStyle; - SkPath devPath; - if (fMCRec->fMatrix.isIdentity()) { - devPath = path; - } else { - path.transform(fMCRec->fMatrix, &devPath); - devPath.setIsVolatile(true); - } - - // Check if the transfomation, or the original path itself - // made us empty. Note this can also happen if we contained NaN - // values. computing the bounds detects this, and will set our - // bounds to empty if that is the case. (see SkRect::set(pts, count)) - if (devPath.getBounds().isEmpty()) { - // resetting the path will remove any NaN or other wanky values - // that might upset our scan converter. - devPath.reset(); - } - - // if we called path.swap() we could avoid a deep copy of this path - fClipStack->clipDevPath(devPath, op, kSoft_ClipEdgeStyle == edgeStyle); + fClipStack->clipPath(path, fMCRec->fMatrix, op, isAA); + const SkPath* rasterClipPath = &path; + const SkMatrix* matrix = &fMCRec->fMatrix; + SkPath tempPath; if (fAllowSimplifyClip) { - bool clipIsAA = getClipStack()->asPath(&devPath); - if (clipIsAA) { - edgeStyle = kSoft_ClipEdgeStyle; - } - + isAA = getClipStack()->asPath(&tempPath); + rasterClipPath = &tempPath; + matrix = &SkMatrix::I(); op = kReplace_Op; } - - fMCRec->fRasterClip.op(devPath, this->getTopLayerBounds(), (SkRegion::Op)op, edgeStyle); + fMCRec->fRasterClip.op(*rasterClipPath, *matrix, this->getTopLayerBounds(), (SkRegion::Op)op, + isAA); fDeviceClipBounds = qr_clip_bounds(fMCRec->fRasterClip.getBounds()); } @@ -1725,8 +1669,8 @@ void SkCanvas::validateClip() const { default: { SkPath path; element->asPath(&path); - tmpClip.op(path, this->getTopLayerBounds(), (SkRegion::Op)element->getOp(), - element->isAA()); + tmpClip.op(path, SkMatrix::I(), this->getTopLayerBounds(), + (SkRegion::Op)element->getOp(), element->isAA()); break; } } diff --git a/src/core/SkClipStack.cpp b/src/core/SkClipStack.cpp index 0019077804..f155b49c4f 100644 --- a/src/core/SkClipStack.cpp +++ b/src/core/SkClipStack.cpp @@ -503,24 +503,6 @@ SkClipStack::SkClipStack(const SkClipStack& b) *this = b; } -SkClipStack::SkClipStack(const SkRect& r) - : fDeque(sizeof(Element), kDefaultElementAllocCnt) - , fSaveCount(0) { - if (!r.isEmpty()) { - this->clipDevRect(r, SkCanvas::kReplace_Op, false); - } -} - -SkClipStack::SkClipStack(const SkIRect& r) - : fDeque(sizeof(Element), kDefaultElementAllocCnt) - , fSaveCount(0) { - if (!r.isEmpty()) { - SkRect temp; - temp.set(r); - this->clipDevRect(temp, SkCanvas::kReplace_Op, false); - } -} - SkClipStack::~SkClipStack() { reset(); } @@ -745,18 +727,41 @@ void SkClipStack::pushElement(const Element& element) { newElement->updateBoundAndGenID(prior); } -void SkClipStack::clipDevRRect(const SkRRect& rrect, SkCanvas::ClipOp op, bool doAA) { - Element element(fSaveCount, rrect, op, doAA); - this->pushElement(element); +void SkClipStack::clipRRect(const SkRRect& rrect, const SkMatrix& matrix, SkCanvas::ClipOp op, + bool doAA) { + SkRRect transformedRRect; + if (rrect.transform(matrix, &transformedRRect)) { + Element element(fSaveCount, transformedRRect, op, doAA); + this->pushElement(element); + return; + } + SkPath path; + path.addRRect(rrect); + path.setIsVolatile(true); + this->clipPath(path, matrix, op, doAA); } -void SkClipStack::clipDevRect(const SkRect& rect, SkCanvas::ClipOp op, bool doAA) { - Element element(fSaveCount, rect, op, doAA); - this->pushElement(element); +void SkClipStack::clipRect(const SkRect& rect, const SkMatrix& matrix, SkCanvas::ClipOp op, + bool doAA) { + if (matrix.rectStaysRect()) { + SkRect devRect; + matrix.mapRect(&devRect, rect); + Element element(fSaveCount, devRect, op, doAA); + this->pushElement(element); + return; + } + SkPath path; + path.addRect(rect); + path.setIsVolatile(true); + this->clipPath(path, matrix, op, doAA); } -void SkClipStack::clipDevPath(const SkPath& path, SkCanvas::ClipOp op, bool doAA) { - Element element(fSaveCount, path, op, doAA); +void SkClipStack::clipPath(const SkPath& path, const SkMatrix& matrix, SkCanvas::ClipOp op, + bool doAA) { + SkPath devPath; + path.transform(matrix, &devPath); + + Element element(fSaveCount, devPath, op, doAA); this->pushElement(element); } diff --git a/src/core/SkRasterClip.cpp b/src/core/SkRasterClip.cpp index 88bfbafc36..1090c66f34 100644 --- a/src/core/SkRasterClip.cpp +++ b/src/core/SkRasterClip.cpp @@ -185,18 +185,20 @@ bool SkRasterClip::setPath(const SkPath& path, const SkRegion& clip, bool doAA) return this->updateCacheAndReturnNonEmpty(); } -bool SkRasterClip::op(const SkRRect& rrect, const SkIRect& bounds, SkRegion::Op op, bool doAA) { +bool SkRasterClip::op(const SkRRect& rrect, const SkMatrix& matrix, const SkIRect& bounds, + SkRegion::Op op, bool doAA) { if (fForceConservativeRects) { - return this->op(rrect.getBounds(), bounds, op, doAA); + return this->op(rrect.getBounds(), matrix, bounds, op, doAA); } SkPath path; path.addRRect(rrect); - return this->op(path, bounds, op, doAA); + return this->op(path, matrix, bounds, op, doAA); } -bool SkRasterClip::op(const SkPath& path, const SkIRect& bounds, SkRegion::Op op, bool doAA) { +bool SkRasterClip::op(const SkPath& path, const SkMatrix& matrix, const SkIRect& bounds, + SkRegion::Op op, bool doAA) { AUTO_RASTERCLIP_VALIDATE(*this); if (fForceConservativeRects) { @@ -207,9 +209,12 @@ bool SkRasterClip::op(const SkPath& path, const SkIRect& bounds, SkRegion::Op op case kReplaceClippedAgainstGlobalBounds_MutateResult: ir = bounds; break; - case kContinue_MutateResult: - ir = path.getBounds().roundOut(); + case kContinue_MutateResult: { + SkRect bounds = path.getBounds(); + matrix.mapRect(&bounds); + ir = bounds.roundOut(); break; + } } return this->op(ir, op); } @@ -218,6 +223,13 @@ bool SkRasterClip::op(const SkPath& path, const SkIRect& bounds, SkRegion::Op op // region that results from scan converting devPath. SkRegion base; + SkPath devPath; + if (matrix.isIdentity()) { + devPath = path; + } else { + path.transform(matrix, &devPath); + devPath.setIsVolatile(true); + } if (SkRegion::kIntersect_Op == op) { // since we are intersect, we can do better (tighter) with currRgn's // bounds, than just using the device. However, if currRgn is complex, @@ -226,21 +238,21 @@ bool SkRasterClip::op(const SkPath& path, const SkIRect& bounds, SkRegion::Op op // FIXME: we should also be able to do this when this->isBW(), // but relaxing the test above triggers GM asserts in // SkRgnBuilder::blitH(). We need to investigate what's going on. - return this->setPath(path, this->bwRgn(), doAA); + return this->setPath(devPath, this->bwRgn(), doAA); } else { base.setRect(this->getBounds()); SkRasterClip clip(fForceConservativeRects); - clip.setPath(path, base, doAA); + clip.setPath(devPath, base, doAA); return this->op(clip, op); } } else { base.setRect(bounds); if (SkRegion::kReplace_Op == op) { - return this->setPath(path, base, doAA); + return this->setPath(devPath, base, doAA); } else { SkRasterClip clip(fForceConservativeRects); - clip.setPath(path, base, doAA); + clip.setPath(devPath, base, doAA); return this->op(clip, op); } } @@ -309,8 +321,10 @@ static bool nearly_integral(SkScalar x) { return x - SkScalarFloorToScalar(x) < domain; } -bool SkRasterClip::op(const SkRect& r, const SkIRect& bounds, SkRegion::Op op, bool doAA) { +bool SkRasterClip::op(const SkRect& localRect, const SkMatrix& matrix, const SkIRect& bounds, + SkRegion::Op op, bool doAA) { AUTO_RASTERCLIP_VALIDATE(*this); + SkRect devRect; if (fForceConservativeRects) { SkIRect ir; @@ -321,30 +335,40 @@ bool SkRasterClip::op(const SkRect& r, const SkIRect& bounds, SkRegion::Op op, b ir = bounds; break; case kContinue_MutateResult: - ir = r.roundOut(); + matrix.mapRect(&devRect, localRect); + ir = devRect.roundOut(); break; } return this->op(ir, op); } + const bool isScaleTrans = matrix.isScaleTranslate(); + if (!isScaleTrans) { + SkPath path; + path.addRect(localRect); + path.setIsVolatile(true); + return this->op(path, matrix, bounds, op, doAA); + } + + matrix.mapRect(&devRect, localRect); if (fIsBW && doAA) { // check that the rect really needs aa, or is it close enought to // integer boundaries that we can just treat it as a BW rect? - if (nearly_integral(r.fLeft) && nearly_integral(r.fTop) && - nearly_integral(r.fRight) && nearly_integral(r.fBottom)) { + if (nearly_integral(devRect.fLeft) && nearly_integral(devRect.fTop) && + nearly_integral(devRect.fRight) && nearly_integral(devRect.fBottom)) { doAA = false; } } if (fIsBW && !doAA) { SkIRect ir; - r.round(&ir); + devRect.round(&ir); (void)fBW.op(ir, op); } else { if (fIsBW) { this->convertToAA(); } - (void)fAA.op(r, op, doAA); + (void)fAA.op(devRect, op, doAA); } return this->updateCacheAndReturnNonEmpty(); } diff --git a/src/core/SkRasterClip.h b/src/core/SkRasterClip.h index 14d34fdaf0..4b462479c3 100644 --- a/src/core/SkRasterClip.h +++ b/src/core/SkRasterClip.h @@ -62,9 +62,9 @@ public: bool op(const SkIRect&, SkRegion::Op); bool op(const SkRegion&, SkRegion::Op); - bool op(const SkRect&, const SkIRect&, SkRegion::Op, bool doAA); - bool op(const SkRRect&, const SkIRect&, SkRegion::Op, bool doAA); - bool op(const SkPath&, const SkIRect&, SkRegion::Op, bool doAA); + bool op(const SkRect&, const SkMatrix& matrix, const SkIRect&, SkRegion::Op, bool doAA); + bool op(const SkRRect&, const SkMatrix& matrix, const SkIRect&, SkRegion::Op, bool doAA); + bool op(const SkPath&, const SkMatrix& matrix, const SkIRect&, SkRegion::Op, bool doAA); void translate(int dx, int dy, SkRasterClip* dst) const; void translate(int dx, int dy) { diff --git a/src/pdf/SkPDFDevice.cpp b/src/pdf/SkPDFDevice.cpp index a002120738..f13b4bc1f6 100644 --- a/src/pdf/SkPDFDevice.cpp +++ b/src/pdf/SkPDFDevice.cpp @@ -1637,10 +1637,9 @@ void SkPDFDevice::handlePathAnnotation(const SkPath& path, return; } - SkPath transformedPath = path; - transformedPath.transform(*d.fMatrix); SkRasterClip clip = *d.fRC; - clip.op(transformedPath, SkIRect::MakeWH(width(), height()), SkRegion::kIntersect_Op, + clip.op(path, *d.fMatrix, SkIRect::MakeWH(width(), height()), + SkRegion::kIntersect_Op, false); SkRect transformedRect = SkRect::Make(clip.getBounds()); @@ -1761,8 +1760,7 @@ SkPDFDevice::ContentEntry* SkPDFDevice::setUpContentEntry(const SkClipStack* cli synthesizedClipStack = fExistingClipStack; SkPath clipPath; clipRegion.getBoundaryPath(&clipPath); - synthesizedClipStack.clipDevPath(clipPath, SkCanvas::kReplace_Op, - false); + synthesizedClipStack.clipPath(clipPath, SkMatrix::I(), SkCanvas::kReplace_Op, false); clipStack = &synthesizedClipStack; } } diff --git a/src/svg/SkSVGDevice.cpp b/src/svg/SkSVGDevice.cpp index 99e824657f..16e2b3f7b5 100644 --- a/src/svg/SkSVGDevice.cpp +++ b/src/svg/SkSVGDevice.cpp @@ -726,11 +726,9 @@ void SkSVGDevice::drawBitmapRect(const SkDraw& draw, const SkBitmap& bm, const S SkClipStack adjustedClipStack; if (srcOrNull && *srcOrNull != SkRect::Make(bm.bounds())) { - SkRect devClipRect; - draw.fMatrix->mapRect(&devClipRect, dst); - adjustedClipStack = *draw.fClipStack; - adjustedClipStack.clipDevRect(devClipRect, SkCanvas::kIntersect_Op, paint.isAntiAlias()); + adjustedClipStack.clipRect(dst, *draw.fMatrix, SkCanvas::kIntersect_Op, + paint.isAntiAlias()); adjustedDraw.fClipStack = &adjustedClipStack; } diff --git a/tests/AAClipTest.cpp b/tests/AAClipTest.cpp index 438dab4da8..5b156a40b5 100644 --- a/tests/AAClipTest.cpp +++ b/tests/AAClipTest.cpp @@ -356,11 +356,11 @@ static void did_dx_affect(skiatest::Reporter* reporter, const SkScalar dx[], SkRasterClip rc1(ir); SkRasterClip rc2(ir); - rc0.op(r, baseBounds, SkRegion::kIntersect_Op, false); + rc0.op(r, SkMatrix::I(), baseBounds, SkRegion::kIntersect_Op, false); r.offset(dx[i], 0); - rc1.op(r, baseBounds, SkRegion::kIntersect_Op, true); + rc1.op(r, SkMatrix::I(), baseBounds, SkRegion::kIntersect_Op, true); r.offset(-2*dx[i], 0); - rc2.op(r, baseBounds, SkRegion::kIntersect_Op, true); + rc2.op(r, SkMatrix::I(), baseBounds, SkRegion::kIntersect_Op, true); REPORTER_ASSERT(reporter, changed != (rc0 == rc1)); REPORTER_ASSERT(reporter, changed != (rc0 == rc2)); @@ -406,7 +406,7 @@ static void test_crbug_422693(skiatest::Reporter* reporter) { SkRasterClip rc(SkIRect::MakeLTRB(-25000, -25000, 25000, 25000)); SkPath path; path.addCircle(50, 50, 50); - rc.op(path, rc.getBounds(), SkRegion::kIntersect_Op, true); + rc.op(path, SkMatrix::I(), rc.getBounds(), SkRegion::kIntersect_Op, true); } DEF_TEST(AAClip, reporter) { diff --git a/tests/ClipBoundsTest.cpp b/tests/ClipBoundsTest.cpp index 0373b89297..fd3e191ee6 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.clipDevRect(clipRect, SkCanvas::kReplace_Op, false); + stack.clipRect(clipRect, SkMatrix::I(), SkCanvas::kReplace_Op, false); bool isIntersectionOfRects = true; SkRect devStackBounds; diff --git a/tests/ClipStackTest.cpp b/tests/ClipStackTest.cpp index 5d6cf328f8..247acb0658 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.clipDevPath(p, SkCanvas::kIntersect_Op, doAA); + s.clipPath(p, SkMatrix::I(), SkCanvas::kIntersect_Op, doAA); s.save(); REPORTER_ASSERT(reporter, 2 == s.getSaveCount()); SkRect r = SkRect::MakeLTRB(1, 2, 3, 4); - s.clipDevRect(r, SkCanvas::kIntersect_Op, doAA); + s.clipRect(r, SkMatrix::I(), SkCanvas::kIntersect_Op, doAA); r = SkRect::MakeLTRB(10, 11, 12, 13); - s.clipDevRect(r, SkCanvas::kIntersect_Op, doAA); + s.clipRect(r, SkMatrix::I(), SkCanvas::kIntersect_Op, doAA); s.save(); REPORTER_ASSERT(reporter, 3 == s.getSaveCount()); r = SkRect::MakeLTRB(14, 15, 16, 17); - s.clipDevRect(r, SkCanvas::kUnion_Op, doAA); + s.clipRect(r, SkMatrix::I(), SkCanvas::kUnion_Op, 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.clipDevRect(r, SkCanvas::kUnion_Op, doAA); + s.clipRect(r, SkMatrix::I(), SkCanvas::kUnion_Op, 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.clipDevRect(r, SkCanvas::kIntersect_Op, doAA); + s.clipRect(r, SkMatrix::I(), SkCanvas::kIntersect_Op, 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.clipDevPath(rp, SkCanvas::kUnion_Op, doAA); + s.clipPath(rp, SkMatrix::I(), SkCanvas::kUnion_Op, 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.clipDevRect(r, SkCanvas::kUnion_Op, doAA); + s.clipRect(r, SkMatrix::I(), SkCanvas::kUnion_Op, 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.clipDevPath(p, SkCanvas::kIntersect_Op, doAA); + s.clipPath(p, SkMatrix::I(), SkCanvas::kIntersect_Op, 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.clipDevRect(gRects[i], SkCanvas::kUnion_Op, false); + stack.clipRect(gRects[i], SkMatrix::I(), SkCanvas::kUnion_Op, false); } assert_count(reporter, stack, 4); @@ -265,16 +265,16 @@ static void test_bounds(skiatest::Reporter* reporter, SkClipStack::Element::Type SkDEBUGFAIL("Don't call this with kEmpty."); break; case SkClipStack::Element::kRect_Type: - stack.clipDevRect(rectA, SkCanvas::kIntersect_Op, false); - stack.clipDevRect(rectB, gOps[op], false); + stack.clipRect(rectA, SkMatrix::I(), SkCanvas::kIntersect_Op, false); + stack.clipRect(rectB, SkMatrix::I(), gOps[op], false); break; case SkClipStack::Element::kRRect_Type: - stack.clipDevRRect(rrectA, SkCanvas::kIntersect_Op, false); - stack.clipDevRRect(rrectB, gOps[op], false); + stack.clipRRect(rrectA, SkMatrix::I(), SkCanvas::kIntersect_Op, false); + stack.clipRRect(rrectB, SkMatrix::I(), gOps[op], false); break; case SkClipStack::Element::kPath_Type: - stack.clipDevPath(pathA, SkCanvas::kIntersect_Op, false); - stack.clipDevPath(pathB, gOps[op], false); + stack.clipPath(pathA, SkMatrix::I(), SkCanvas::kIntersect_Op, false); + stack.clipPath(pathB, SkMatrix::I(), gOps[op], false); break; } @@ -334,8 +334,8 @@ static void test_isWideOpen(skiatest::Reporter* reporter) { clipB.addRoundRect(rectB, SkIntToScalar(5), SkIntToScalar(5)); clipB.setFillType(SkPath::kInverseEvenOdd_FillType); - stack.clipDevPath(clipA, SkCanvas::kReplace_Op, false); - stack.clipDevPath(clipB, SkCanvas::kUnion_Op, false); + stack.clipPath(clipA, SkMatrix::I(), SkCanvas::kReplace_Op, false); + stack.clipPath(clipB, SkMatrix::I(), SkCanvas::kUnion_Op, 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.clipDevRect(rectA, SkCanvas::kUnion_Op, false); + stack.clipRect(rectA, SkMatrix::I(), SkCanvas::kUnion_Op, 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.clipDevRect(emptyRect, SkCanvas::kDifference_Op, false); + stack.clipRect(emptyRect, SkMatrix::I(), SkCanvas::kDifference_Op, 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.clipDevRect(rectA, SkCanvas::kReplace_Op, false); + stack.clipRect(rectA, SkMatrix::I(), SkCanvas::kReplace_Op, 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.clipDevPath(path, SkCanvas::kIntersect_Op, false); + stack.clipPath(path, SkMatrix::I(), SkCanvas::kIntersect_Op, 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.clipDevRect(rect, SkCanvas::kReplace_Op, false); + stack.clipRect(rect, SkMatrix::I(), SkCanvas::kReplace_Op, false); REPORTER_ASSERT(reporter, 1 == count(stack)); - stack.clipDevRect(rect, SkCanvas::kReplace_Op, false); + stack.clipRect(rect, SkMatrix::I(), SkCanvas::kReplace_Op, 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.clipDevRect(rect, SkCanvas::kReplace_Op, true); + stack.clipRect(rect, SkMatrix::I(), SkCanvas::kReplace_Op, true); REPORTER_ASSERT(reporter, 1 == count(stack)); - stack.clipDevRect(rect, SkCanvas::kReplace_Op, true); + stack.clipRect(rect, SkMatrix::I(), SkCanvas::kReplace_Op, 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.clipDevRect(rect, SkCanvas::kReplace_Op, false); + stack.clipRect(rect, SkMatrix::I(), SkCanvas::kReplace_Op, false); REPORTER_ASSERT(reporter, 1 == count(stack)); - stack.clipDevRect(rect, SkCanvas::kReplace_Op, true); + stack.clipRect(rect, SkMatrix::I(), SkCanvas::kReplace_Op, true); REPORTER_ASSERT(reporter, 1 == count(stack)); - stack.clipDevRect(rect, SkCanvas::kReplace_Op, false); + stack.clipRect(rect, SkMatrix::I(), SkCanvas::kReplace_Op, false); REPORTER_ASSERT(reporter, 1 == count(stack)); } // Make sure replace clip rects don't collapse too much. { SkClipStack stack; - stack.clipDevRect(rect, SkCanvas::kReplace_Op, false); - stack.clipDevRect(rect2, SkCanvas::kIntersect_Op, false); + stack.clipRect(rect, SkMatrix::I(), SkCanvas::kReplace_Op, false); + stack.clipRect(rect2, SkMatrix::I(), SkCanvas::kIntersect_Op, false); REPORTER_ASSERT(reporter, 1 == count(stack)); stack.save(); - stack.clipDevRect(rect, SkCanvas::kReplace_Op, false); + stack.clipRect(rect, SkMatrix::I(), SkCanvas::kReplace_Op, 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.clipDevRect(rect, SkCanvas::kReplace_Op, false); - stack.clipDevRect(rect, SkCanvas::kReplace_Op, false); + stack.clipRect(rect, SkMatrix::I(), SkCanvas::kReplace_Op, false); + stack.clipRect(rect, SkMatrix::I(), SkCanvas::kReplace_Op, false); REPORTER_ASSERT(reporter, 2 == count(stack)); stack.restore(); REPORTER_ASSERT(reporter, 1 == count(stack)); stack.save(); - stack.clipDevRect(rect, SkCanvas::kReplace_Op, false); - stack.clipDevRect(rect2, SkCanvas::kIntersect_Op, false); - stack.clipDevRect(rect, SkCanvas::kReplace_Op, false); + 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); 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.clipDevPath(path, SkCanvas::kReplace_Op, false); + stack.clipPath(path, SkMatrix::I(), SkCanvas::kReplace_Op, false); REPORTER_ASSERT(reporter, 1 == count(stack)); - stack.clipDevPath(path, SkCanvas::kReplace_Op, false); + stack.clipPath(path, SkMatrix::I(), SkCanvas::kReplace_Op, false); REPORTER_ASSERT(reporter, 1 == count(stack)); } // Replacing rect with path. { SkClipStack stack; - stack.clipDevRect(rect, SkCanvas::kReplace_Op, true); + stack.clipRect(rect, SkMatrix::I(), SkCanvas::kReplace_Op, true); REPORTER_ASSERT(reporter, 1 == count(stack)); - stack.clipDevPath(path, SkCanvas::kReplace_Op, true); + stack.clipPath(path, SkMatrix::I(), SkCanvas::kReplace_Op, true); REPORTER_ASSERT(reporter, 1 == count(stack)); } } @@ -532,9 +532,9 @@ static void test_rect_merging(skiatest::Reporter* reporter) { { SkClipStack stack; - stack.clipDevRect(overlapLeft, SkCanvas::kReplace_Op, false); + stack.clipRect(overlapLeft, SkMatrix::I(), SkCanvas::kReplace_Op, false); - stack.clipDevRect(overlapRight, SkCanvas::kIntersect_Op, false); + stack.clipRect(overlapRight, SkMatrix::I(), SkCanvas::kIntersect_Op, false); REPORTER_ASSERT(reporter, 1 == count(stack)); @@ -547,9 +547,9 @@ static void test_rect_merging(skiatest::Reporter* reporter) { { SkClipStack stack; - stack.clipDevRect(overlapLeft, SkCanvas::kReplace_Op, true); + stack.clipRect(overlapLeft, SkMatrix::I(), SkCanvas::kReplace_Op, true); - stack.clipDevRect(overlapRight, SkCanvas::kIntersect_Op, true); + stack.clipRect(overlapRight, SkMatrix::I(), SkCanvas::kIntersect_Op, true); REPORTER_ASSERT(reporter, 1 == count(stack)); @@ -562,9 +562,9 @@ static void test_rect_merging(skiatest::Reporter* reporter) { { SkClipStack stack; - stack.clipDevRect(overlapLeft, SkCanvas::kReplace_Op, true); + stack.clipRect(overlapLeft, SkMatrix::I(), SkCanvas::kReplace_Op, true); - stack.clipDevRect(overlapRight, SkCanvas::kIntersect_Op, false); + stack.clipRect(overlapRight, SkMatrix::I(), SkCanvas::kIntersect_Op, false); REPORTER_ASSERT(reporter, 2 == count(stack)); @@ -577,9 +577,9 @@ static void test_rect_merging(skiatest::Reporter* reporter) { { SkClipStack stack; - stack.clipDevRect(nestedParent, SkCanvas::kReplace_Op, true); + stack.clipRect(nestedParent, SkMatrix::I(), SkCanvas::kReplace_Op, true); - stack.clipDevRect(nestedChild, SkCanvas::kIntersect_Op, false); + stack.clipRect(nestedChild, SkMatrix::I(), SkCanvas::kIntersect_Op, false); REPORTER_ASSERT(reporter, 1 == count(stack)); @@ -592,9 +592,9 @@ static void test_rect_merging(skiatest::Reporter* reporter) { { SkClipStack stack; - stack.clipDevRect(nestedParent, SkCanvas::kReplace_Op, false); + stack.clipRect(nestedParent, SkMatrix::I(), SkCanvas::kReplace_Op, false); - stack.clipDevRect(nestedChild, SkCanvas::kIntersect_Op, true); + stack.clipRect(nestedChild, SkMatrix::I(), SkCanvas::kIntersect_Op, true); REPORTER_ASSERT(reporter, 1 == count(stack)); @@ -607,9 +607,9 @@ static void test_rect_merging(skiatest::Reporter* reporter) { { SkClipStack stack; - stack.clipDevRect(nestedChild, SkCanvas::kReplace_Op, false); + stack.clipRect(nestedChild, SkMatrix::I(), SkCanvas::kReplace_Op, false); - stack.clipDevRect(nestedParent, SkCanvas::kIntersect_Op, true); + stack.clipRect(nestedParent, SkMatrix::I(), SkCanvas::kIntersect_Op, true); REPORTER_ASSERT(reporter, 2 == count(stack)); @@ -637,7 +637,7 @@ static void test_quickContains(skiatest::Reporter* reporter) { { SkClipStack stack; - stack.clipDevRect(outsideRect, SkCanvas::kDifference_Op, false); + stack.clipRect(outsideRect, SkMatrix::I(), SkCanvas::kDifference_Op, false); // return false because quickContains currently does not care for kDifference_Op REPORTER_ASSERT(reporter, false == stack.quickContains(testRect)); } @@ -645,24 +645,24 @@ static void test_quickContains(skiatest::Reporter* reporter) { // Replace Op tests { SkClipStack stack; - stack.clipDevRect(outsideRect, SkCanvas::kReplace_Op, false); + stack.clipRect(outsideRect, SkMatrix::I(), SkCanvas::kReplace_Op, false); REPORTER_ASSERT(reporter, true == stack.quickContains(testRect)); } { SkClipStack stack; - stack.clipDevRect(insideRect, SkCanvas::kIntersect_Op, false); + stack.clipRect(insideRect, SkMatrix::I(), SkCanvas::kIntersect_Op, false); stack.save(); // To prevent in-place substitution by replace OP - stack.clipDevRect(outsideRect, SkCanvas::kReplace_Op, false); + stack.clipRect(outsideRect, SkMatrix::I(), SkCanvas::kReplace_Op, false); REPORTER_ASSERT(reporter, true == stack.quickContains(testRect)); stack.restore(); } { SkClipStack stack; - stack.clipDevRect(outsideRect, SkCanvas::kIntersect_Op, false); + stack.clipRect(outsideRect, SkMatrix::I(), SkCanvas::kIntersect_Op, false); stack.save(); // To prevent in-place substitution by replace OP - stack.clipDevRect(insideRect, SkCanvas::kReplace_Op, false); + stack.clipRect(insideRect, SkMatrix::I(), SkCanvas::kReplace_Op, 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.clipDevRect(insideRect, SkCanvas::kIntersect_Op, false); + stack.clipRect(insideRect, SkMatrix::I(), SkCanvas::kIntersect_Op, false); // Use a path for second clip to prevent in-place intersection - stack.clipDevPath(outsideCircle, SkCanvas::kIntersect_Op, false); + stack.clipPath(outsideCircle, SkMatrix::I(), SkCanvas::kIntersect_Op, false); REPORTER_ASSERT(reporter, false == stack.quickContains(testRect)); } // Intersect Op tests with rectangles { SkClipStack stack; - stack.clipDevRect(outsideRect, SkCanvas::kIntersect_Op, false); + stack.clipRect(outsideRect, SkMatrix::I(), SkCanvas::kIntersect_Op, false); REPORTER_ASSERT(reporter, true == stack.quickContains(testRect)); } { SkClipStack stack; - stack.clipDevRect(insideRect, SkCanvas::kIntersect_Op, false); + stack.clipRect(insideRect, SkMatrix::I(), SkCanvas::kIntersect_Op, false); REPORTER_ASSERT(reporter, false == stack.quickContains(testRect)); } { SkClipStack stack; - stack.clipDevRect(intersectingRect, SkCanvas::kIntersect_Op, false); + stack.clipRect(intersectingRect, SkMatrix::I(), SkCanvas::kIntersect_Op, false); REPORTER_ASSERT(reporter, false == stack.quickContains(testRect)); } { SkClipStack stack; - stack.clipDevRect(nonIntersectingRect, SkCanvas::kIntersect_Op, false); + stack.clipRect(nonIntersectingRect, SkMatrix::I(), SkCanvas::kIntersect_Op, false); REPORTER_ASSERT(reporter, false == stack.quickContains(testRect)); } // Intersect Op tests with circle paths { SkClipStack stack; - stack.clipDevPath(outsideCircle, SkCanvas::kIntersect_Op, false); + stack.clipPath(outsideCircle, SkMatrix::I(), SkCanvas::kIntersect_Op, false); REPORTER_ASSERT(reporter, true == stack.quickContains(testRect)); } { SkClipStack stack; - stack.clipDevPath(insideCircle, SkCanvas::kIntersect_Op, false); + stack.clipPath(insideCircle, SkMatrix::I(), SkCanvas::kIntersect_Op, false); REPORTER_ASSERT(reporter, false == stack.quickContains(testRect)); } { SkClipStack stack; - stack.clipDevPath(intersectingCircle, SkCanvas::kIntersect_Op, false); + stack.clipPath(intersectingCircle, SkMatrix::I(), SkCanvas::kIntersect_Op, false); REPORTER_ASSERT(reporter, false == stack.quickContains(testRect)); } { SkClipStack stack; - stack.clipDevPath(nonIntersectingCircle, SkCanvas::kIntersect_Op, false); + stack.clipPath(nonIntersectingCircle, SkMatrix::I(), SkCanvas::kIntersect_Op, 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.clipDevPath(path, SkCanvas::kIntersect_Op, false); + stack.clipPath(path, SkMatrix::I(), SkCanvas::kIntersect_Op, 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.clipDevPath(path, SkCanvas::kIntersect_Op, false); + stack.clipPath(path, SkMatrix::I(), SkCanvas::kIntersect_Op, 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.clipDevPath(path, SkCanvas::kIntersect_Op, false); + stack.clipPath(path, SkMatrix::I(), SkCanvas::kIntersect_Op, 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.clipDevPath(path, SkCanvas::kIntersect_Op, false); + stack.clipPath(path, SkMatrix::I(), SkCanvas::kIntersect_Op, 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.clipDevPath(path, SkCanvas::kIntersect_Op, false); + stack.clipPath(path, SkMatrix::I(), SkCanvas::kIntersect_Op, 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.clipDevPath(path, SkCanvas::kIntersect_Op, false); + stack.clipPath(path, SkMatrix::I(), SkCanvas::kIntersect_Op, 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.clipDevPath(path, SkCanvas::kIntersect_Op, false); + stack.clipPath(path, SkMatrix::I(), SkCanvas::kIntersect_Op, 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.clipDevPath(path, SkCanvas::kIntersect_Op, false); + stack.clipPath(path, SkMatrix::I(), SkCanvas::kIntersect_Op, 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.clipDevRect({10, 10, 20, 20}, SkCanvas::kIntersect_Op, false); + stack.clipRect({10, 10, 20, 20}, SkMatrix::I(), SkCanvas::kIntersect_Op, false); SkPath path; path.addRect({30, 10, 40, 20}); path.setFillType(SkPath::kInverseWinding_FillType); - stack.clipDevPath(path, SkCanvas::kDifference_Op, false); + stack.clipPath(path, SkMatrix::I(), SkCanvas::kDifference_Op, false); REPORTER_ASSERT(reporter, SkClipStack::kEmptyGenID == stack.getTopmostGenID()); @@ -863,11 +863,11 @@ static void add_round_rect(const SkRect& rect, bool invert, SkCanvas::ClipOp op, SkPath path; path.addRoundRect(rect, rx, ry); path.setFillType(SkPath::kInverseWinding_FillType); - stack->clipDevPath(path, op, doAA); + stack->clipPath(path, SkMatrix::I(), op, doAA); } else { SkRRect rrect; rrect.setRectXY(rect, rx, ry); - stack->clipDevRRect(rrect, op, doAA); + stack->clipRRect(rrect, SkMatrix::I(), op, doAA); } }; @@ -877,9 +877,9 @@ static void add_rect(const SkRect& rect, bool invert, SkCanvas::ClipOp op, SkCli SkPath path; path.addRect(rect); path.setFillType(SkPath::kInverseWinding_FillType); - stack->clipDevPath(path, op, doAA); + stack->clipPath(path, SkMatrix::I(), op, doAA); } else { - stack->clipDevRect(rect, op, doAA); + stack->clipRect(rect, SkMatrix::I(), op, doAA); } }; @@ -890,19 +890,19 @@ static void add_oval(const SkRect& rect, bool invert, SkCanvas::ClipOp op, SkCli if (invert) { path.setFillType(SkPath::kInverseWinding_FillType); } - stack->clipDevPath(path, op, doAA); + stack->clipPath(path, SkMatrix::I(), op, doAA); }; static void add_elem_to_stack(const SkClipStack::Element& element, SkClipStack* stack) { switch (element.getType()) { case SkClipStack::Element::kRect_Type: - stack->clipDevRect(element.getRect(), element.getOp(), element.isAA()); + stack->clipRect(element.getRect(), SkMatrix::I(), element.getOp(), element.isAA()); break; case SkClipStack::Element::kRRect_Type: - stack->clipDevRRect(element.getRRect(), element.getOp(), element.isAA()); + stack->clipRRect(element.getRRect(), SkMatrix::I(), element.getOp(), element.isAA()); break; case SkClipStack::Element::kPath_Type: - stack->clipDevPath(element.getPath(), element.getOp(), element.isAA()); + stack->clipPath(element.getPath(), SkMatrix::I(), element.getOp(), element.isAA()); break; case SkClipStack::Element::kEmpty_Type: SkDEBUGFAIL("Why did the reducer produce an explicit empty."); @@ -1076,8 +1076,10 @@ static void test_reduced_clip_stack(skiatest::Reporter* reporter) { static void test_reduced_clip_stack_genid(skiatest::Reporter* reporter) { { SkClipStack stack; - stack.clipDevRect(SkRect::MakeXYWH(0, 0, 100, 100), SkCanvas::kReplace_Op, true); - stack.clipDevRect(SkRect::MakeXYWH(0, 0, SkScalar(50.3), SkScalar(50.3)), SkCanvas::kReplace_Op, true); + stack.clipRect(SkRect::MakeXYWH(0, 0, 100, 100), SkMatrix::I(), SkCanvas::kReplace_Op, + true); + stack.clipRect(SkRect::MakeXYWH(0, 0, SkScalar(50.3), SkScalar(50.3)), SkMatrix::I(), + SkCanvas::kReplace_Op, true); SkRect bounds = SkRect::MakeXYWH(0, 0, 100, 100); SkAlignedSTStorage<1, GrReducedClip> storage; @@ -1098,13 +1100,17 @@ static void test_reduced_clip_stack_genid(skiatest::Reporter* reporter) { // A B // C D - stack.clipDevRect(SkRect::MakeXYWH(0, 0, SkScalar(25.3), SkScalar(25.3)), SkCanvas::kReplace_Op, true); + stack.clipRect(SkRect::MakeXYWH(0, 0, SkScalar(25.3), SkScalar(25.3)), SkMatrix::I(), + SkCanvas::kReplace_Op, true); int32_t genIDA = stack.getTopmostGenID(); - stack.clipDevRect(SkRect::MakeXYWH(50, 0, SkScalar(25.3), SkScalar(25.3)), SkCanvas::kUnion_Op, true); + stack.clipRect(SkRect::MakeXYWH(50, 0, SkScalar(25.3), SkScalar(25.3)), SkMatrix::I(), + SkCanvas::kUnion_Op, true); int32_t genIDB = stack.getTopmostGenID(); - stack.clipDevRect(SkRect::MakeXYWH(0, 50, SkScalar(25.3), SkScalar(25.3)), SkCanvas::kUnion_Op, true); + stack.clipRect(SkRect::MakeXYWH(0, 50, SkScalar(25.3), SkScalar(25.3)), SkMatrix::I(), + SkCanvas::kUnion_Op, true); int32_t genIDC = stack.getTopmostGenID(); - stack.clipDevRect(SkRect::MakeXYWH(50, 50, SkScalar(25.3), SkScalar(25.3)), SkCanvas::kUnion_Op, true); + stack.clipRect(SkRect::MakeXYWH(50, 50, SkScalar(25.3), SkScalar(25.3)), SkMatrix::I(), + SkCanvas::kUnion_Op, true); int32_t genIDD = stack.getTopmostGenID(); @@ -1284,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.clipDevRect(alignedRect, SkCanvas::kIntersect_Op, true); + stack.clipRect(alignedRect, SkMatrix::I(), SkCanvas::kIntersect_Op, 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); @@ -1292,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.clipDevRect(rect, SkCanvas::kIntersect_Op, true); + stack.clipRect(rect, SkMatrix::I(), SkCanvas::kIntersect_Op, 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); @@ -1300,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.clipDevRect(rect, SkCanvas::kDifference_Op, true); + stack.clipRect(rect, SkMatrix::I(), SkCanvas::kDifference_Op, 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); @@ -1308,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.clipDevRect(rect, SkCanvas::kIntersect_Op, true); - stack.clipDevRect(innerRect, SkCanvas::kXOR_Op, true); + stack.clipRect(rect, SkMatrix::I(), SkCanvas::kIntersect_Op, true); + stack.clipRect(innerRect, SkMatrix::I(), SkCanvas::kXOR_Op, 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); @@ -1320,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.clipDevRect(alignedRect, SkCanvas::kIntersect_Op, true); - stack.clipDevRect(innerRect, SkCanvas::kXOR_Op, true); + stack.clipRect(alignedRect, SkMatrix::I(), SkCanvas::kIntersect_Op, true); + stack.clipRect(innerRect, SkMatrix::I(), SkCanvas::kXOR_Op, 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); |