Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(124)

Unified Diff: src/core/SkCanvas.cpp

Issue 1657333002: Fix for rounded-rect clips with filters. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: picture GM fix Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « include/core/SkCanvas.h ('k') | src/core/SkRasterClip.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkCanvas.cpp
diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp
index ce08d41a1f76d3673eda3f8de94c34a4e74a0bed..c8c4b8749b9b748d7f84127f7e983f63b22f35a0 100644
--- a/src/core/SkCanvas.cpp
+++ b/src/core/SkCanvas.cpp
@@ -812,19 +812,17 @@ void SkCanvas::flush() {
}
}
-SkISize SkCanvas::getTopLayerSize() const {
- SkBaseDevice* d = this->getTopDevice();
+SkISize SkCanvas::getBaseLayerSize() const {
+ SkBaseDevice* d = this->getDevice();
return d ? SkISize::Make(d->width(), d->height()) : SkISize::Make(0, 0);
}
-SkIPoint SkCanvas::getTopLayerOrigin() const {
+SkIRect SkCanvas::getTopLayerBounds() const {
SkBaseDevice* d = this->getTopDevice();
- return d ? d->getOrigin() : SkIPoint::Make(0, 0);
-}
-
-SkISize SkCanvas::getBaseLayerSize() const {
- SkBaseDevice* d = this->getDevice();
- return d ? SkISize::Make(d->width(), d->height()) : SkISize::Make(0, 0);
+ if (!d) {
+ return SkIRect::MakeEmpty();
+ }
+ return SkIRect::MakeXYWH(d->getOrigin().x(), d->getOrigin().y(), d->width(), d->height());
}
SkBaseDevice* SkCanvas::getDevice() const {
@@ -1516,7 +1514,7 @@ void SkCanvas::onClipRect(const SkRect& rect, SkRegion::Op op, ClipEdgeStyle edg
if (rectStaysRect) {
const bool isAA = kSoft_ClipEdgeStyle == edgeStyle;
fClipStack->clipDevRect(devR, op, isAA);
- fMCRec->fRasterClip.op(devR, this->getBaseLayerSize(), op, isAA);
+ fMCRec->fRasterClip.op(devR, this->getTopLayerBounds(), 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
@@ -1529,11 +1527,6 @@ void SkCanvas::onClipRect(const SkRect& rect, SkRegion::Op op, ClipEdgeStyle edg
}
}
-static void rasterclip_path(SkRasterClip* rc, const SkCanvas* canvas, const SkPath& devPath,
- SkRegion::Op op, bool doAA) {
- rc->op(devPath, canvas->getBaseLayerSize(), op, doAA);
-}
-
void SkCanvas::clipRRect(const SkRRect& rrect, SkRegion::Op op, bool doAA) {
this->checkForDeferredSave();
ClipEdgeStyle edgeStyle = doAA ? kSoft_ClipEdgeStyle : kHard_ClipEdgeStyle;
@@ -1557,7 +1550,7 @@ void SkCanvas::onClipRRect(const SkRRect& rrect, SkRegion::Op op, ClipEdgeStyle
fClipStack->clipDevRRect(transformedRRect, op, kSoft_ClipEdgeStyle == edgeStyle);
- fMCRec->fRasterClip.op(transformedRRect, this->getBaseLayerSize(), op,
+ fMCRec->fRasterClip.op(transformedRRect, this->getTopLayerBounds(), op,
kSoft_ClipEdgeStyle == edgeStyle);
return;
}
@@ -1643,7 +1636,7 @@ void SkCanvas::onClipPath(const SkPath& path, SkRegion::Op op, ClipEdgeStyle edg
op = SkRegion::kReplace_Op;
}
- rasterclip_path(&fMCRec->fRasterClip, this, devPath, op, edgeStyle);
+ fMCRec->fRasterClip.op(devPath, this->getTopLayerBounds(), op, edgeStyle);
}
void SkCanvas::clipRegion(const SkRegion& rgn, SkRegion::Op op) {
@@ -1691,7 +1684,7 @@ void SkCanvas::validateClip() const {
default: {
SkPath path;
element->asPath(&path);
- rasterclip_path(&tmpClip, this, path, element->getOp(), element->isAA());
+ tmpClip.op(path, this->getTopLayerBounds(), element->getOp(), element->isAA());
break;
}
}
« no previous file with comments | « include/core/SkCanvas.h ('k') | src/core/SkRasterClip.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698