| 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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 if (!this->applyCropRect(&bounds, matrix)) { | 70 if (!this->applyCropRect(&bounds, matrix)) { |
| 71 return false; | 71 return false; |
| 72 } | 72 } |
| 73 | 73 |
| 74 SkAutoTUnref<SkBaseDevice> device(proxy->createDevice(bounds.width(), bounds
.height())); | 74 SkAutoTUnref<SkBaseDevice> device(proxy->createDevice(bounds.width(), bounds
.height())); |
| 75 if (NULL == device.get()) { | 75 if (NULL == device.get()) { |
| 76 return false; | 76 return false; |
| 77 } | 77 } |
| 78 SkCanvas canvas(device.get()); | 78 SkCanvas canvas(device.get()); |
| 79 | 79 |
| 80 SkAutoTUnref<SkImageFilter> blurFilter(new SkBlurImageFilter(fSigmaX, fSigma
Y)); | 80 SkVector sigma, localSigma = SkVector::Make(fSigmaX, fSigmaY); |
| 81 matrix.mapVectors(&sigma, &localSigma, 1); |
| 82 SkAutoTUnref<SkImageFilter> blurFilter(new SkBlurImageFilter(sigma.fX, sigma
.fY)); |
| 81 SkAutoTUnref<SkColorFilter> colorFilter(SkColorFilter::CreateModeFilter(fCol
or, SkXfermode::kSrcIn_Mode)); | 83 SkAutoTUnref<SkColorFilter> colorFilter(SkColorFilter::CreateModeFilter(fCol
or, SkXfermode::kSrcIn_Mode)); |
| 82 SkPaint paint; | 84 SkPaint paint; |
| 83 paint.setImageFilter(blurFilter.get()); | 85 paint.setImageFilter(blurFilter.get()); |
| 84 paint.setColorFilter(colorFilter.get()); | 86 paint.setColorFilter(colorFilter.get()); |
| 85 paint.setXfermodeMode(SkXfermode::kSrcOver_Mode); | 87 paint.setXfermodeMode(SkXfermode::kSrcOver_Mode); |
| 88 SkVector offsetVec, localOffsetVec = SkVector::Make(fDx, fDy); |
| 89 matrix.mapVectors(&offsetVec, &localOffsetVec, 1); |
| 86 canvas.translate(-SkIntToScalar(bounds.fLeft), -SkIntToScalar(bounds.fTop)); | 90 canvas.translate(-SkIntToScalar(bounds.fLeft), -SkIntToScalar(bounds.fTop)); |
| 87 canvas.drawBitmap(src, fDx, fDy, &paint); | 91 canvas.drawBitmap(src, offsetVec.fX, offsetVec.fY, &paint); |
| 88 canvas.drawBitmap(src, 0, 0); | 92 canvas.drawBitmap(src, 0, 0); |
| 89 *result = device->accessBitmap(false); | 93 *result = device->accessBitmap(false); |
| 90 offset->fX = bounds.fLeft; | 94 offset->fX = bounds.fLeft; |
| 91 offset->fY = bounds.fTop; | 95 offset->fY = bounds.fTop; |
| 92 return true; | 96 return true; |
| 93 } | 97 } |
| OLD | NEW |