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