Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(91)

Unified Diff: src/pdf/SkPDFDevice.cpp

Issue 2360663002: Add a transient image filter cache to SkImage::makeWithFilter & PDF (Closed)
Patch Set: Fix PDF device more - override getImageFilterCache Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/pdf/SkPDFDevice.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
+}
« no previous file with comments | « src/pdf/SkPDFDevice.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698