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
This commit is contained in:
senorblanco 2014-06-18 15:11:25 -07:00 committed by Commit bot
parent c5d5cf9489
commit ffa9b500d7

View File

@ -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);
}