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

Unified Diff: src/core/SkCanvas.cpp

Issue 1308703007: Fix filter primitive bounds computations. (Closed) Base URL: https://skia.googlesource.com/skia.git@saveLayer-bounds-not-transformed
Patch Set: Update to ToT Created 5 years 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
Index: src/core/SkCanvas.cpp
diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp
index 88dddf412a7ae663c1e34d343a8ddd953f8ca1dc..683fd0ca55d66fa36688ec6f212a02e7916dd946 100644
--- a/src/core/SkCanvas.cpp
+++ b/src/core/SkCanvas.cpp
@@ -1070,21 +1070,11 @@ bool SkCanvas::clipRectBounds(const SkRect* bounds, SaveFlags flags,
const SkMatrix& ctm = fMCRec->fMatrix; // this->getTotalMatrix()
-// This is a temporary hack, until individual filters can do their own
-// bloating, when this will be removed.
-#ifdef SK_SUPPORT_SRC_BOUNDS_BLOAT_FOR_IMAGEFILTERS
- SkRect storage;
-#endif
if (imageFilter) {
imageFilter->filterBounds(clipBounds, ctm, &clipBounds);
-#ifdef SK_SUPPORT_SRC_BOUNDS_BLOAT_FOR_IMAGEFILTERS
- if (bounds && imageFilter->canComputeFastBounds()) {
- imageFilter->computeFastBounds(*bounds, &storage);
- bounds = &storage;
- } else {
+ if (bounds && !imageFilter->canComputeFastBounds()) {
bounds = nullptr;
}
-#endif
}
SkIRect ir;
if (bounds) {
@@ -1370,7 +1360,8 @@ void SkCanvas::internalDrawDevice(SkBaseDevice* srcDev, int x, int y,
const SkBitmap& src = srcDev->accessBitmap(false);
SkMatrix matrix = *iter.fMatrix;
matrix.postTranslate(SkIntToScalar(-pos.x()), SkIntToScalar(-pos.y()));
- SkIRect clipBounds = SkIRect::MakeWH(srcDev->width(), srcDev->height());
+ SkIRect clipBounds = iter.fClip->getBounds();
+ clipBounds.offset(-pos.x(), -pos.y());
SkAutoTUnref<SkImageFilter::Cache> cache(dstDev->getImageFilterCache());
SkImageFilter::Context ctx(matrix, clipBounds, cache.get(),
SkImageFilter::kApprox_SizeConstraint);

Powered by Google App Engine
This is Rietveld 408576698