Index: src/core/SkDevice.cpp |
diff --git a/src/core/SkDevice.cpp b/src/core/SkDevice.cpp |
index 34c171db9071109cb668619964b037dbee95ad21..cf4a279b355523be1a982af8a989e014beaf7938 100644 |
--- a/src/core/SkDevice.cpp |
+++ b/src/core/SkDevice.cpp |
@@ -402,6 +402,29 @@ void SkBaseDevice::drawTextOnPath(const SkDraw& draw, const void* text, size_t b |
////////////////////////////////////////////////////////////////////////////////////////// |
+void SkBaseDevice::drawBitmapAsSprite(const SkDraw& draw, const SkBitmap& bitmap, int x, int y, |
+ const SkPaint& paint) { |
+ 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 = bitmap.bounds(); |
+ SkAutoTUnref<SkImageFilter::Cache> cache(this->getImageFilterCache()); |
+ SkImageFilter::Context ctx(matrix, clipBounds, cache.get(), |
+ SkImageFilter::kApprox_SizeConstraint); |
+ if (filter->filterImage(&proxy, bitmap, ctx, &dst, &offset)) { |
+ SkPaint tmpUnfiltered(paint); |
+ tmpUnfiltered.setImageFilter(nullptr); |
+ this->drawSprite(draw, dst, x + offset.x(), y + offset.y(), tmpUnfiltered); |
+ } |
+ } else { |
+ this->drawSprite(draw, bitmap, x, y, paint); |
+ } |
+} |
+ |
uint32_t SkBaseDevice::filterTextFlags(const SkPaint& paint) const { |
uint32_t flags = paint.getFlags(); |