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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 SkVector offsetVec, localOffsetVec = SkVector::Make(fDx, fDy); | 88 SkVector offsetVec, localOffsetVec = SkVector::Make(fDx, fDy); |
89 matrix.mapVectors(&offsetVec, &localOffsetVec, 1); | 89 matrix.mapVectors(&offsetVec, &localOffsetVec, 1); |
90 canvas.translate(-SkIntToScalar(bounds.fLeft), -SkIntToScalar(bounds.fTop)); | 90 canvas.translate(-SkIntToScalar(bounds.fLeft), -SkIntToScalar(bounds.fTop)); |
91 canvas.drawBitmap(src, offsetVec.fX, offsetVec.fY, &paint); | 91 canvas.drawBitmap(src, offsetVec.fX, offsetVec.fY, &paint); |
92 canvas.drawBitmap(src, 0, 0); | 92 canvas.drawBitmap(src, 0, 0); |
93 *result = device->accessBitmap(false); | 93 *result = device->accessBitmap(false); |
94 offset->fX = bounds.fLeft; | 94 offset->fX = bounds.fLeft; |
95 offset->fY = bounds.fTop; | 95 offset->fY = bounds.fTop; |
96 return true; | 96 return true; |
97 } | 97 } |
| 98 |
| 99 void SkDropShadowImageFilter::computeFastBounds(const SkRect& src, SkRect* dst)
const { |
| 100 if (getInput(0)) { |
| 101 getInput(0)->computeFastBounds(src, dst); |
| 102 } else { |
| 103 *dst = src; |
| 104 } |
| 105 |
| 106 SkRect shadowBounds = *dst; |
| 107 shadowBounds.offset(fDx, fDy); |
| 108 shadowBounds.outset(SkScalarMul(fSigmaX, SkIntToScalar(3)), |
| 109 SkScalarMul(fSigmaY, SkIntToScalar(3))); |
| 110 dst->join(shadowBounds); |
| 111 } |
| 112 |
OLD | NEW |