aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/effects
diff options
context:
space:
mode:
authorGravatar senorblanco <senorblanco@chromium.org>2015-12-04 13:57:30 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2015-12-04 13:57:31 -0800
commit8705ec80518ef551994b82ca5ccaeb0241d6adec (patch)
tree205344722622c58258b8bf48cb6e3faf97d18c66 /src/effects
parent95f53fbc5ddf14ddb1e51c7ebced2b80fb069f81 (diff)
Matrix convolution bounds fix; affectsTransparentBlack fixes.
Because the convolution kernel is (currently) applied in device space, there's no way to know which object-space pixels will be touched. So return false from canComputeFastBounds(). The results from the matrixconvolution GM were actually wrong, since they were showing edge differences on the clip boundaries, where they should really only show on crop boundaries. I added a crop to the GM to keep the results the same (which are useful to test the different convolution tile modes). While I was at it, SkImageFilter::affectsTransparentBlack() was inapplicable on most things except color filters, and its use on leaf nodes was confusing. So I removed it, and made SkImageFilter::canComputeFastBounds() virtual instead. BUG=skia: Review URL: https://codereview.chromium.org/1500923004
Diffstat (limited to 'src/effects')
-rw-r--r--src/effects/SkColorFilterImageFilter.cpp7
-rw-r--r--src/effects/SkMatrixConvolutionImageFilter.cpp6
-rw-r--r--src/effects/SkRectShaderImageFilter.cpp7
3 files changed, 16 insertions, 4 deletions
diff --git a/src/effects/SkColorFilterImageFilter.cpp b/src/effects/SkColorFilterImageFilter.cpp
index 8d394aa17b..b0e47505a7 100644
--- a/src/effects/SkColorFilterImageFilter.cpp
+++ b/src/effects/SkColorFilterImageFilter.cpp
@@ -99,8 +99,11 @@ bool SkColorFilterImageFilter::onIsColorFilterNode(SkColorFilter** filter) const
return false;
}
-bool SkColorFilterImageFilter::affectsTransparentBlack() const {
- return fColorFilter->affectsTransparentBlack();
+bool SkColorFilterImageFilter::canComputeFastBounds() const {
+ if (fColorFilter->affectsTransparentBlack()) {
+ return false;
+ }
+ return INHERITED::canComputeFastBounds();
}
#ifndef SK_IGNORE_TO_STRING
diff --git a/src/effects/SkMatrixConvolutionImageFilter.cpp b/src/effects/SkMatrixConvolutionImageFilter.cpp
index e58eec10f4..7c5dd8368f 100644
--- a/src/effects/SkMatrixConvolutionImageFilter.cpp
+++ b/src/effects/SkMatrixConvolutionImageFilter.cpp
@@ -335,6 +335,12 @@ bool SkMatrixConvolutionImageFilter::onFilterBounds(const SkIRect& src, const Sk
return true;
}
+bool SkMatrixConvolutionImageFilter::canComputeFastBounds() const {
+ // Because the kernel is applied in device-space, we have no idea what
+ // pixels it will affect in object-space.
+ return false;
+}
+
#if SK_SUPPORT_GPU
static GrTextureDomain::Mode convert_tilemodes(
diff --git a/src/effects/SkRectShaderImageFilter.cpp b/src/effects/SkRectShaderImageFilter.cpp
index 14837d02b1..00964b5ffb 100644
--- a/src/effects/SkRectShaderImageFilter.cpp
+++ b/src/effects/SkRectShaderImageFilter.cpp
@@ -79,8 +79,11 @@ bool SkRectShaderImageFilter::onFilterImage(Proxy* proxy,
return true;
}
-bool SkRectShaderImageFilter::affectsTransparentBlack() const {
- return true;
+bool SkRectShaderImageFilter::canComputeFastBounds() const {
+ // http:skbug.com/4627: "make computeFastBounds and onFilterBounds() CropRect-aware"
+ // computeFastBounds() doesn't currently take the crop rect into account,
+ // so we can't compute it. If a full crop rect is set, we should return true here.
+ return false;
}
#ifndef SK_IGNORE_TO_STRING