OLD | NEW |
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" |
(...skipping 11 matching lines...) Expand all Loading... |
22 : INHERITED(1, &input, cropRect, uniqueID) | 22 : INHERITED(1, &input, cropRect, uniqueID) |
23 , fDx(dx) | 23 , fDx(dx) |
24 , fDy(dy) | 24 , fDy(dy) |
25 , fSigmaX(sigmaX) | 25 , fSigmaX(sigmaX) |
26 , fSigmaY(sigmaY) | 26 , fSigmaY(sigmaY) |
27 , fColor(color) | 27 , fColor(color) |
28 , fShadowMode(shadowMode) | 28 , fShadowMode(shadowMode) |
29 { | 29 { |
30 } | 30 } |
31 | 31 |
32 #ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING | |
33 SkDropShadowImageFilter::SkDropShadowImageFilter(SkReadBuffer& buffer) | |
34 : INHERITED(1, buffer) { | |
35 fDx = buffer.readScalar(); | |
36 fDy = buffer.readScalar(); | |
37 fSigmaX = buffer.readScalar(); | |
38 fSigmaY = buffer.readScalar(); | |
39 fColor = buffer.readColor(); | |
40 fShadowMode = buffer.isVersionLT(SkReadBuffer::kDropShadowMode_Version) ? | |
41 kDrawShadowAndForeground_ShadowMode : | |
42 static_cast<ShadowMode>(buffer.readInt()); | |
43 buffer.validate(SkScalarIsFinite(fDx) && | |
44 SkScalarIsFinite(fDy) && | |
45 SkScalarIsFinite(fSigmaX) && | |
46 SkScalarIsFinite(fSigmaY)); | |
47 } | |
48 #endif | |
49 | |
50 SkFlattenable* SkDropShadowImageFilter::CreateProc(SkReadBuffer& buffer) { | 32 SkFlattenable* SkDropShadowImageFilter::CreateProc(SkReadBuffer& buffer) { |
51 SK_IMAGEFILTER_UNFLATTEN_COMMON(common, 1); | 33 SK_IMAGEFILTER_UNFLATTEN_COMMON(common, 1); |
52 SkScalar dx = buffer.readScalar(); | 34 SkScalar dx = buffer.readScalar(); |
53 SkScalar dy = buffer.readScalar(); | 35 SkScalar dy = buffer.readScalar(); |
54 SkScalar sigmaX = buffer.readScalar(); | 36 SkScalar sigmaX = buffer.readScalar(); |
55 SkScalar sigmaY = buffer.readScalar(); | 37 SkScalar sigmaY = buffer.readScalar(); |
56 SkColor color = buffer.readColor(); | 38 SkColor color = buffer.readColor(); |
57 ShadowMode shadowMode = buffer.isVersionLT(SkReadBuffer::kDropShadowMode_Ver
sion) ? | 39 ShadowMode shadowMode = buffer.isVersionLT(SkReadBuffer::kDropShadowMode_Ver
sion) ? |
58 kDrawShadowAndForeground_ShadowMode : | 40 kDrawShadowAndForeground_ShadowMode : |
59 static_cast<ShadowMode>(buffer.readInt()); | 41 static_cast<ShadowMode>(buffer.readInt()); |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 SkScalarCeilToInt(SkScalarMul(sigma.y(), SkIntToScalar(3)))); | 129 SkScalarCeilToInt(SkScalarMul(sigma.y(), SkIntToScalar(3)))); |
148 if (fShadowMode == kDrawShadowAndForeground_ShadowMode) { | 130 if (fShadowMode == kDrawShadowAndForeground_ShadowMode) { |
149 bounds.join(src); | 131 bounds.join(src); |
150 } | 132 } |
151 if (getInput(0) && !getInput(0)->filterBounds(bounds, ctm, &bounds)) { | 133 if (getInput(0) && !getInput(0)->filterBounds(bounds, ctm, &bounds)) { |
152 return false; | 134 return false; |
153 } | 135 } |
154 *dst = bounds; | 136 *dst = bounds; |
155 return true; | 137 return true; |
156 } | 138 } |
OLD | NEW |