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" |
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, SkSca
lar sigma, | 18 SkDropShadowImageFilter::SkDropShadowImageFilter(SkScalar dx, SkScalar dy, SkSca
lar sigma, |
19 SkColor color, SkImageFilter* i
nput) | 19 SkColor color, SkImageFilter* i
nput) |
20 : INHERITED(input) | 20 : INHERITED(1, &input) |
21 , fDx(dx) | 21 , fDx(dx) |
22 , fDy(dy) | 22 , fDy(dy) |
23 , fSigmaX(sigma) | 23 , fSigmaX(sigma) |
24 , fSigmaY(sigma) | 24 , fSigmaY(sigma) |
25 , fColor(color) | 25 , fColor(color) |
26 { | 26 { |
27 } | 27 } |
28 | 28 |
29 SkDropShadowImageFilter::SkDropShadowImageFilter(SkScalar dx, SkScalar dy, | 29 SkDropShadowImageFilter::SkDropShadowImageFilter(SkScalar dx, SkScalar dy, |
30 SkScalar sigmaX, SkScalar sigma
Y, SkColor color, | 30 SkScalar sigmaX, SkScalar sigma
Y, SkColor color, |
31 SkImageFilter* input, const Cro
pRect* cropRect) | 31 SkImageFilter* input, const Cro
pRect* cropRect) |
32 : INHERITED(input, cropRect) | 32 : INHERITED(1, &input, cropRect) |
33 , fDx(dx) | 33 , fDx(dx) |
34 , fDy(dy) | 34 , fDy(dy) |
35 , fSigmaX(sigmaX) | 35 , fSigmaX(sigmaX) |
36 , fSigmaY(sigmaY) | 36 , fSigmaY(sigmaY) |
37 , fColor(color) | 37 , fColor(color) |
38 { | 38 { |
39 } | 39 } |
40 | 40 |
41 SkDropShadowImageFilter::SkDropShadowImageFilter(SkReadBuffer& buffer) | 41 SkDropShadowImageFilter::SkDropShadowImageFilter(SkReadBuffer& buffer) |
42 : INHERITED(1, buffer) { | 42 : INHERITED(1, buffer) { |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 bounds.offset(-SkScalarCeilToInt(offsetVec.x()), | 129 bounds.offset(-SkScalarCeilToInt(offsetVec.x()), |
130 -SkScalarCeilToInt(offsetVec.y())); | 130 -SkScalarCeilToInt(offsetVec.y())); |
131 SkVector sigma = SkVector::Make(fSigmaX, fSigmaY); | 131 SkVector sigma = SkVector::Make(fSigmaX, fSigmaY); |
132 ctm.mapVectors(&sigma, 1); | 132 ctm.mapVectors(&sigma, 1); |
133 bounds.outset(SkScalarCeilToInt(SkScalarMul(sigma.x(), SkIntToScalar(3))), | 133 bounds.outset(SkScalarCeilToInt(SkScalarMul(sigma.x(), SkIntToScalar(3))), |
134 SkScalarCeilToInt(SkScalarMul(sigma.y(), SkIntToScalar(3)))); | 134 SkScalarCeilToInt(SkScalarMul(sigma.y(), SkIntToScalar(3)))); |
135 bounds.join(src); | 135 bounds.join(src); |
136 *dst = bounds; | 136 *dst = bounds; |
137 return true; | 137 return true; |
138 } | 138 } |
OLD | NEW |