From 915881fe743f9a789037695f543bc6ea189cd0cb Mon Sep 17 00:00:00 2001 From: senorblanco Date: Thu, 20 Aug 2015 07:42:11 -0700 Subject: Implement canComputeFastBounds() for image filters. Image filters have never implemented this check, which means that filters which affect transparent black falsely claim they can compute their bounds. Implemented an affectsTransparentBlack() virtual for image filters, and a similar helper function for color filters. This will affect the following GMs: imagefiltersscaled (lighting, perlin noise now filter to clip), colorfilterimagefilter (new test case), imagefiltersclipped (perlin noise now filters to clip). Note: I de-inlined SkPaint::canComputeFastBounds() to avoid adding a dependency from SkPaint.h to SkImageFilter.h.h. Skia benches show no impact from this change, but will watch the perf bots carefully. BUG=4212 Review URL: https://codereview.chromium.org/1296943002 --- src/effects/SkRectShaderImageFilter.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/effects/SkRectShaderImageFilter.cpp') diff --git a/src/effects/SkRectShaderImageFilter.cpp b/src/effects/SkRectShaderImageFilter.cpp index cdf03131c1..45962537c8 100644 --- a/src/effects/SkRectShaderImageFilter.cpp +++ b/src/effects/SkRectShaderImageFilter.cpp @@ -79,6 +79,10 @@ bool SkRectShaderImageFilter::onFilterImage(Proxy* proxy, return true; } +bool SkRectShaderImageFilter::affectsTransparentBlack() const { + return true; +} + #ifndef SK_IGNORE_TO_STRING void SkRectShaderImageFilter::toString(SkString* str) const { str->appendf("SkRectShaderImageFilter: ("); -- cgit v1.2.3