Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Side by Side Diff: src/effects/SkDropShadowImageFilter.cpp

Issue 503833002: Reimplement deserialization of SkImageFilter's uniqueID. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/effects/SkDisplacementMapEffect.cpp ('k') | src/effects/SkLightingImageFilter.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2013 Google Inc. 2 * Copyright 2013 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkDropShadowImageFilter.h" 8 #include "SkDropShadowImageFilter.h"
9 9
10 #include "SkBitmap.h" 10 #include "SkBitmap.h"
11 #include "SkBlurImageFilter.h" 11 #include "SkBlurImageFilter.h"
12 #include "SkCanvas.h" 12 #include "SkCanvas.h"
13 #include "SkColorMatrixFilter.h" 13 #include "SkColorMatrixFilter.h"
14 #include "SkDevice.h" 14 #include "SkDevice.h"
15 #include "SkReadBuffer.h" 15 #include "SkReadBuffer.h"
16 #include "SkWriteBuffer.h" 16 #include "SkWriteBuffer.h"
17 17
18 SkDropShadowImageFilter::SkDropShadowImageFilter(SkScalar dx, SkScalar dy, 18 SkDropShadowImageFilter::SkDropShadowImageFilter(SkScalar dx, SkScalar dy,
19 SkScalar sigmaX, SkScalar sigma Y, SkColor color, 19 SkScalar sigmaX, SkScalar sigma Y, SkColor color,
20 SkImageFilter* input, const Cro pRect* cropRect) 20 SkImageFilter* input, const Cro pRect* cropRect,
21 : INHERITED(1, &input, cropRect) 21 uint32_t uniqueID)
22 : INHERITED(1, &input, cropRect, uniqueID)
22 , fDx(dx) 23 , fDx(dx)
23 , fDy(dy) 24 , fDy(dy)
24 , fSigmaX(sigmaX) 25 , fSigmaX(sigmaX)
25 , fSigmaY(sigmaY) 26 , fSigmaY(sigmaY)
26 , fColor(color) 27 , fColor(color)
27 { 28 {
28 } 29 }
29 30
30 #ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING 31 #ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING
31 SkDropShadowImageFilter::SkDropShadowImageFilter(SkReadBuffer& buffer) 32 SkDropShadowImageFilter::SkDropShadowImageFilter(SkReadBuffer& buffer)
(...skipping 10 matching lines...) Expand all
42 } 43 }
43 #endif 44 #endif
44 45
45 SkFlattenable* SkDropShadowImageFilter::CreateProc(SkReadBuffer& buffer) { 46 SkFlattenable* SkDropShadowImageFilter::CreateProc(SkReadBuffer& buffer) {
46 SK_IMAGEFILTER_UNFLATTEN_COMMON(common, 1); 47 SK_IMAGEFILTER_UNFLATTEN_COMMON(common, 1);
47 SkScalar dx = buffer.readScalar(); 48 SkScalar dx = buffer.readScalar();
48 SkScalar dy = buffer.readScalar(); 49 SkScalar dy = buffer.readScalar();
49 SkScalar sigmaX = buffer.readScalar(); 50 SkScalar sigmaX = buffer.readScalar();
50 SkScalar sigmaY = buffer.readScalar(); 51 SkScalar sigmaY = buffer.readScalar();
51 SkColor color = buffer.readColor(); 52 SkColor color = buffer.readColor();
52 return Create(dx, dy, sigmaX, sigmaY, color, common.getInput(0), &common.cro pRect()); 53 return Create(dx, dy, sigmaX, sigmaY, color, common.getInput(0), &common.cro pRect(), common.uniqueID());
53 } 54 }
54 55
55 void SkDropShadowImageFilter::flatten(SkWriteBuffer& buffer) const { 56 void SkDropShadowImageFilter::flatten(SkWriteBuffer& buffer) const {
56 this->INHERITED::flatten(buffer); 57 this->INHERITED::flatten(buffer);
57 buffer.writeScalar(fDx); 58 buffer.writeScalar(fDx);
58 buffer.writeScalar(fDy); 59 buffer.writeScalar(fDy);
59 buffer.writeScalar(fSigmaX); 60 buffer.writeScalar(fSigmaX);
60 buffer.writeScalar(fSigmaY); 61 buffer.writeScalar(fSigmaY);
61 buffer.writeColor(fColor); 62 buffer.writeColor(fColor);
62 } 63 }
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 bounds.offset(-SkScalarCeilToInt(offsetVec.x()), 130 bounds.offset(-SkScalarCeilToInt(offsetVec.x()),
130 -SkScalarCeilToInt(offsetVec.y())); 131 -SkScalarCeilToInt(offsetVec.y()));
131 SkVector sigma = SkVector::Make(fSigmaX, fSigmaY); 132 SkVector sigma = SkVector::Make(fSigmaX, fSigmaY);
132 ctm.mapVectors(&sigma, 1); 133 ctm.mapVectors(&sigma, 1);
133 bounds.outset(SkScalarCeilToInt(SkScalarMul(sigma.x(), SkIntToScalar(3))), 134 bounds.outset(SkScalarCeilToInt(SkScalarMul(sigma.x(), SkIntToScalar(3))),
134 SkScalarCeilToInt(SkScalarMul(sigma.y(), SkIntToScalar(3)))); 135 SkScalarCeilToInt(SkScalarMul(sigma.y(), SkIntToScalar(3))));
135 bounds.join(src); 136 bounds.join(src);
136 *dst = bounds; 137 *dst = bounds;
137 return true; 138 return true;
138 } 139 }
OLDNEW
« no previous file with comments | « src/effects/SkDisplacementMapEffect.cpp ('k') | src/effects/SkLightingImageFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698