Chromium Code Reviews| Index: src/core/SkDevice.cpp |
| diff --git a/src/core/SkDevice.cpp b/src/core/SkDevice.cpp |
| index 7adb0f4b3cf4b91173f36867ca3ad6fd04976a43..39f041be9995beacb7f0ce6dd98c70d017d528ff 100644 |
| --- a/src/core/SkDevice.cpp |
| +++ b/src/core/SkDevice.cpp |
| @@ -17,6 +17,7 @@ |
| #include "SkRasterClip.h" |
| #include "SkRSXform.h" |
| #include "SkShader.h" |
| +#include "SkSpecialImage.h" |
| #include "SkTextBlobRunIterator.h" |
| #include "SkTextToPathIter.h" |
| @@ -408,17 +409,27 @@ void SkBaseDevice::drawBitmapAsSprite(const SkDraw& draw, const SkBitmap& bitmap |
| SkImageFilter* filter = paint.getImageFilter(); |
| if (filter && !this->canHandleImageFilter(filter)) { |
| SkImageFilter::DeviceProxy proxy(this); |
| - SkBitmap dst; |
| SkIPoint offset = SkIPoint::Make(0, 0); |
| SkMatrix matrix = *draw.fMatrix; |
| matrix.postTranslate(SkIntToScalar(-x), SkIntToScalar(-y)); |
| const SkIRect clipBounds = draw.fClip->getBounds().makeOffset(-x, -y); |
| SkAutoTUnref<SkImageFilter::Cache> cache(this->getImageFilterCache()); |
| SkImageFilter::Context ctx(matrix, clipBounds, cache.get()); |
| - if (filter->filterImageDeprecated(&proxy, bitmap, ctx, &dst, &offset)) { |
| + |
| + SkAutoTUnref<SkSpecialImage> srcImg(SkSpecialImage::internal_fromBM(&proxy, bitmap)); |
| + if (!srcImg) { |
| + return; // something disastrous happened |
| + } |
| + |
| + SkAutoTUnref<SkSpecialImage>resultImg(filter->filterImage(srcImg, ctx, &offset)); |
|
Stephen White
2016/03/04 15:55:05
Nit: need space between > and resultImg.
robertphillips
2016/03/04 18:08:36
Done.
|
| + if (resultImg) { |
| SkPaint tmpUnfiltered(paint); |
| tmpUnfiltered.setImageFilter(nullptr); |
| - this->drawSprite(draw, dst, x + offset.x(), y + offset.y(), tmpUnfiltered); |
| + SkBitmap resultBM; |
| + if (resultImg->internal_getBM(&resultBM)) { |
| + // TODO: add drawSprite(SkSpecialImage) to SkDevice? |
| + this->drawSprite(draw, resultBM, x + offset.x(), y + offset.y(), tmpUnfiltered); |
| + } |
| } |
| } else { |
| this->drawSprite(draw, bitmap, x, y, paint); |