From ffa9b500d7e83e7dddf6a8902f47c4355b608c30 Mon Sep 17 00:00:00 2001 From: senorblanco Date: Wed, 18 Jun 2014 15:11:25 -0700 Subject: [PATCH] Fix external SkImageFilter caching with clips. When the external cache is active, do not intersect the saveLayer bounds with the clip bounds. This is so that the cache is always the full size of the primitive's bounds, regardless of the clip active on first draw. (Drawing of the filtered or cached result is always drawn against the active clip, though, since it is restored before internalDrawDevice() is called.) This is a slightly hacky solution, but this code can all go away (including the external cache) once all platforms have switched to impl-side painting. See Chromium bug http://crbug.com/379147. BUG=skia: R=reed@google.com Author: senorblanco@chromium.org Review URL: https://codereview.chromium.org/340203002 --- src/core/SkImageFilter.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/core/SkImageFilter.cpp b/src/core/SkImageFilter.cpp index 6356c1a5dd..4c4b56beac 100644 --- a/src/core/SkImageFilter.cpp +++ b/src/core/SkImageFilter.cpp @@ -122,6 +122,16 @@ bool SkImageFilter::filterBounds(const SkIRect& src, const SkMatrix& ctm, SkIRect* dst) const { SkASSERT(&src); SkASSERT(dst); + if (SkImageFilter::GetExternalCache()) { + /* + * When the external cache is active, do not intersect the saveLayer + * bounds with the clip bounds. This is so that the cached result + * is always the full size of the primitive's bounds, + * regardless of the clip active on first draw. + */ + *dst = SkIRect::MakeLargest(); + return true; + } return this->onFilterBounds(src, ctm, dst); }