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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 SkRect shadowBounds = *dst; | 114 SkRect shadowBounds = *dst; |
115 shadowBounds.offset(fDx, fDy); | 115 shadowBounds.offset(fDx, fDy); |
116 shadowBounds.outset(SkScalarMul(fSigmaX, SkIntToScalar(3)), | 116 shadowBounds.outset(SkScalarMul(fSigmaX, SkIntToScalar(3)), |
117 SkScalarMul(fSigmaY, SkIntToScalar(3))); | 117 SkScalarMul(fSigmaY, SkIntToScalar(3))); |
118 dst->join(shadowBounds); | 118 dst->join(shadowBounds); |
119 } | 119 } |
120 | 120 |
121 bool SkDropShadowImageFilter::onFilterBounds(const SkIRect& src, const SkMatrix&
ctm, | 121 bool SkDropShadowImageFilter::onFilterBounds(const SkIRect& src, const SkMatrix&
ctm, |
122 SkIRect* dst) const { | 122 SkIRect* dst) const { |
123 SkIRect bounds = src; | 123 SkIRect bounds = src; |
| 124 if (getInput(0) && !getInput(0)->filterBounds(src, ctm, &bounds)) { |
| 125 return false; |
| 126 } |
124 SkVector offsetVec = SkVector::Make(fDx, fDy); | 127 SkVector offsetVec = SkVector::Make(fDx, fDy); |
125 ctm.mapVectors(&offsetVec, 1); | 128 ctm.mapVectors(&offsetVec, 1); |
126 bounds.offset(-SkScalarCeilToInt(offsetVec.x()), | 129 bounds.offset(-SkScalarCeilToInt(offsetVec.x()), |
127 -SkScalarCeilToInt(offsetVec.y())); | 130 -SkScalarCeilToInt(offsetVec.y())); |
128 SkVector sigma = SkVector::Make(fSigmaX, fSigmaY); | 131 SkVector sigma = SkVector::Make(fSigmaX, fSigmaY); |
129 ctm.mapVectors(&sigma, 1); | 132 ctm.mapVectors(&sigma, 1); |
130 bounds.outset(SkScalarCeilToInt(SkScalarMul(sigma.x(), SkIntToScalar(3))), | 133 bounds.outset(SkScalarCeilToInt(SkScalarMul(sigma.x(), SkIntToScalar(3))), |
131 SkScalarCeilToInt(SkScalarMul(sigma.y(), SkIntToScalar(3)))); | 134 SkScalarCeilToInt(SkScalarMul(sigma.y(), SkIntToScalar(3)))); |
132 bounds.join(src); | 135 bounds.join(src); |
133 if (getInput(0) && !getInput(0)->filterBounds(bounds, ctm, &bounds)) { | |
134 return false; | |
135 } | |
136 *dst = bounds; | 136 *dst = bounds; |
137 return true; | 137 return true; |
138 } | 138 } |
OLD | NEW |