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

Unified Diff: src/effects/SkMatrixConvolutionImageFilter.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/SkMatrixConvolutionImageFilter.cpp
diff --git a/src/effects/SkMatrixConvolutionImageFilter.cpp b/src/effects/SkMatrixConvolutionImageFilter.cpp
index 7c5dd8368f439e528ca06691d3f9ff3bb9273ad0..a1f23f7a290b8b0837fd3ca1efc7f9e02a48cd1c 100644
--- a/src/effects/SkMatrixConvolutionImageFilter.cpp
+++ b/src/effects/SkMatrixConvolutionImageFilter.cpp
@@ -280,7 +280,7 @@ bool SkMatrixConvolutionImageFilter::onFilterImage(Proxy* proxy,
}
SkIRect bounds;
- if (!this->applyCropRect(ctx, proxy, src, &srcOffset, &bounds, &src)) {
+ if (!this->applyCropRect(this->mapContext(ctx), proxy, src, &srcOffset, &bounds, &src)) {
return false;
}
@@ -322,17 +322,17 @@ bool SkMatrixConvolutionImageFilter::onFilterImage(Proxy* proxy,
return true;
}
-bool SkMatrixConvolutionImageFilter::onFilterBounds(const SkIRect& src, const SkMatrix& ctm,
- SkIRect* dst) const {
- SkIRect bounds = src;
- bounds.fRight += fKernelSize.width() - 1;
- bounds.fBottom += fKernelSize.height() - 1;
- bounds.offset(-fKernelOffset);
- if (getInput(0) && !getInput(0)->filterBounds(bounds, ctm, &bounds)) {
- return false;
+void SkMatrixConvolutionImageFilter::onFilterNodeBounds(const SkIRect& src, const SkMatrix& ctm,
+ SkIRect* dst, MapDirection direction) const {
+ *dst = src;
+ int w = fKernelSize.width() - 1, h = fKernelSize.height() - 1;
+ dst->fRight += w;
+ dst->fBottom += h;
+ if (kReverse_MapDirection == direction) {
+ dst->offset(-fKernelOffset);
+ } else {
+ dst->offset(fKernelOffset - SkIPoint::Make(w, h));
}
- *dst = bounds;
- return true;
}
bool SkMatrixConvolutionImageFilter::canComputeFastBounds() const {

Powered by Google App Engine
This is Rietveld 408576698