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

Unified Diff: src/effects/SkBlurImageFilter.cpp

Issue 1308703007: Fix filter primitive bounds computations. (Closed) Base URL: https://skia.googlesource.com/skia.git@saveLayer-bounds-not-transformed
Patch Set: Fix comment style; remove useless param names 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/effects/SkBlurImageFilter.cpp
diff --git a/src/effects/SkBlurImageFilter.cpp b/src/effects/SkBlurImageFilter.cpp
index 928793de62fcf0b2013af246a197a1193cf76a40..752749b873f8a36e73f71800feedddaaa88d20c3 100644
--- a/src/effects/SkBlurImageFilter.cpp
+++ b/src/effects/SkBlurImageFilter.cpp
@@ -82,7 +82,10 @@ bool SkBlurImageFilter::onFilterImage(Proxy* proxy,
}
SkIRect srcBounds, dstBounds;
- if (!this->applyCropRect(ctx, src, srcOffset, &dstBounds, &srcBounds)) {
+ if (!this->applyCropRect(this->mapContext(ctx), src, srcOffset, &dstBounds, &srcBounds)) {
+ return false;
+ }
+ if (!srcBounds.intersect(dstBounds)) {
return false;
}
@@ -184,17 +187,12 @@ void SkBlurImageFilter::computeFastBounds(const SkRect& src, SkRect* dst) const
SkScalarMul(fSigma.height(), SkIntToScalar(3)));
}
-bool SkBlurImageFilter::onFilterBounds(const SkIRect& src, const SkMatrix& ctm,
- SkIRect* dst) const {
- SkIRect bounds = src;
+void SkBlurImageFilter::onFilterNodeBounds(const SkIRect& src, const SkMatrix& ctm,
+ SkIRect* dst, MapDirection) const {
+ *dst = src;
SkVector sigma = mapSigma(fSigma, ctm);
- bounds.outset(SkScalarCeilToInt(SkScalarMul(sigma.x(), SkIntToScalar(3))),
- SkScalarCeilToInt(SkScalarMul(sigma.y(), SkIntToScalar(3))));
- if (this->getInput(0) && !this->getInput(0)->filterBounds(bounds, ctm, &bounds)) {
- return false;
- }
- *dst = bounds;
- return true;
+ dst->outset(SkScalarCeilToInt(SkScalarMul(sigma.x(), SkIntToScalar(3))),
+ SkScalarCeilToInt(SkScalarMul(sigma.y(), SkIntToScalar(3))));
}
bool SkBlurImageFilter::filterImageGPU(Proxy* proxy, const SkBitmap& src, const Context& ctx,
@@ -206,7 +204,10 @@ bool SkBlurImageFilter::filterImageGPU(Proxy* proxy, const SkBitmap& src, const
return false;
}
SkIRect srcBounds, dstBounds;
- if (!this->applyCropRect(ctx, input, srcOffset, &dstBounds, &srcBounds)) {
+ if (!this->applyCropRect(this->mapContext(ctx), input, srcOffset, &dstBounds, &srcBounds)) {
+ return false;
+ }
+ if (!srcBounds.intersect(dstBounds)) {
return false;
}
GrTexture* source = input.getTexture();

Powered by Google App Engine
This is Rietveld 408576698