diff options
author | senorblanco <senorblanco@chromium.org> | 2014-08-26 12:27:12 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-08-26 12:27:12 -0700 |
commit | 5e5f948b6b363dbfc8c076d8ff0c6b8e9ea99958 (patch) | |
tree | 1f3b8fdb8dc30a897119f3ce25e347cdaad94391 /src/effects/SkRectShaderImageFilter.cpp | |
parent | 21aed57023bad4b04076c59e37097c7563efc028 (diff) |
Reimplement deserialization of SkImageFilter's uniqueID.
9fa60d ("Simplify flattening to just write enough ... ") simplified just
a tad too much. In particular, it disabled deserialization of
SkImageFilter's uniqueID, which in turn caused the failure of
SkImageFilter's cache, which caused a large regression in Chrome's SVG
filter performance.
The medium-term fix is to switch to the new SkRecordDraw SkPicture
backend, which will make the unique IDs unnecessary.
This change is an "in case of emergecy" CL, in the event that there are
problems switching on the new backend in Chrome. For that reason, it's
minimalist: only the filters used by Chrome are modified, and whitespace
changes are kept to a minimum. In this way, it should be easy to revert
once the new backend goes in.
R=reed@google.com
Author: senorblanco@chromium.org
Review URL: https://codereview.chromium.org/503833002
Diffstat (limited to 'src/effects/SkRectShaderImageFilter.cpp')
-rw-r--r-- | src/effects/SkRectShaderImageFilter.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/effects/SkRectShaderImageFilter.cpp b/src/effects/SkRectShaderImageFilter.cpp index be3c23ce4b..fb34ed0007 100644 --- a/src/effects/SkRectShaderImageFilter.cpp +++ b/src/effects/SkRectShaderImageFilter.cpp @@ -23,13 +23,14 @@ SkRectShaderImageFilter* SkRectShaderImageFilter::Create(SkShader* s, const SkRe return SkNEW_ARGS(SkRectShaderImageFilter, (s, &cropRect)); } -SkRectShaderImageFilter* SkRectShaderImageFilter::Create(SkShader* s, const CropRect* cropRect) { +SkRectShaderImageFilter* SkRectShaderImageFilter::Create(SkShader* s, const CropRect* cropRect, uint32_t uniqueID) { SkASSERT(s); - return SkNEW_ARGS(SkRectShaderImageFilter, (s, cropRect)); + return SkNEW_ARGS(SkRectShaderImageFilter, (s, cropRect, uniqueID)); } -SkRectShaderImageFilter::SkRectShaderImageFilter(SkShader* s, const CropRect* cropRect) - : INHERITED(0, NULL, cropRect) +SkRectShaderImageFilter::SkRectShaderImageFilter(SkShader* s, const CropRect* cropRect, + uint32_t uniqueID) + : INHERITED(0, NULL, cropRect, uniqueID) , fShader(s) { SkASSERT(s); s->ref(); @@ -45,7 +46,7 @@ SkRectShaderImageFilter::SkRectShaderImageFilter(SkReadBuffer& buffer) SkFlattenable* SkRectShaderImageFilter::CreateProc(SkReadBuffer& buffer) { SK_IMAGEFILTER_UNFLATTEN_COMMON(common, 0); SkAutoTUnref<SkShader> shader(buffer.readShader()); - return Create(shader.get(), &common.cropRect()); + return Create(shader.get(), &common.cropRect(), common.uniqueID()); } void SkRectShaderImageFilter::flatten(SkWriteBuffer& buffer) const { |