Index: src/pdf/SkPDFDevice.cpp |
diff --git a/src/pdf/SkPDFDevice.cpp b/src/pdf/SkPDFDevice.cpp |
index 5299d70d0e38f6770bc085b053485391b1240596..e79c915283a2cbdb420e700ab5d67a8b876c9521 100644 |
--- a/src/pdf/SkPDFDevice.cpp |
+++ b/src/pdf/SkPDFDevice.cpp |
@@ -16,6 +16,7 @@ |
#include "SkDraw.h" |
#include "SkDrawFilter.h" |
#include "SkGlyphCache.h" |
+#include "SkImageFilterCache.h" |
#include "SkMakeUnique.h" |
#include "SkPath.h" |
#include "SkPathEffect.h" |
@@ -2286,8 +2287,8 @@ void SkPDFDevice::drawSpecial(const SkDraw& draw, SkSpecialImage* srcImg, int x, |
SkMatrix matrix = *draw.fMatrix; |
matrix.postTranslate(SkIntToScalar(-x), SkIntToScalar(-y)); |
const SkIRect clipBounds = draw.fRC->getBounds().makeOffset(-x, -y); |
-// SkAutoTUnref<SkImageFilterCache> cache(this->getImageFilterCache()); |
- SkImageFilter::Context ctx(matrix, clipBounds, nullptr /*cache.get()*/); |
+ SkAutoTUnref<SkImageFilterCache> cache(this->getImageFilterCache()); |
+ SkImageFilter::Context ctx(matrix, clipBounds, cache.get()); |
sk_sp<SkSpecialImage> resultImg(filter->filterImage(srcImg, ctx, &offset)); |
if (resultImg) { |
@@ -2316,3 +2317,9 @@ sk_sp<SkSpecialImage> SkPDFDevice::makeSpecial(const SkImage* image) { |
sk_sp<SkSpecialImage> SkPDFDevice::snapSpecial() { |
return nullptr; |
} |
+ |
+SkImageFilterCache* SkPDFDevice::getImageFilterCache() { |
+ // We always return a transient cache, so it is freed after each |
+ // filter traversal. |
+ return SkImageFilterCache::Create(SkImageFilterCache::kDefaultTransientSize); |
+} |