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

Unified Diff: src/core/SkCanvas.cpp

Issue 225903010: Allow clients to specify an external SkImageFilter cache. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Move external to a global on SkImageFilter. Created 6 years, 8 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 | « include/core/SkImageFilter.h ('k') | src/core/SkImageFilter.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkCanvas.cpp
diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp
index a3e296951423d9bebf354d95ab30f47e8eff7bd9..569e9e59baca8bf97886536b51cf5f3d0f93bd2a 100644
--- a/src/core/SkCanvas.cpp
+++ b/src/core/SkCanvas.cpp
@@ -1258,8 +1258,12 @@ void SkCanvas::internalDrawDevice(SkBaseDevice* srcDev, int x, int y,
SkMatrix matrix = *iter.fMatrix;
matrix.postTranslate(SkIntToScalar(-pos.x()), SkIntToScalar(-pos.y()));
SkIRect clipBounds = SkIRect::MakeWH(srcDev->width(), srcDev->height());
- SkImageFilter::Cache* cache = SkImageFilter::Cache::Create();
- SkAutoUnref aur(cache);
+ SkImageFilter::Cache* cache = SkImageFilter::GetExternalCache();
+ SkAutoUnref aur(NULL);
+ if (!cache) {
+ cache = SkImageFilter::Cache::Create();
+ aur.reset(cache);
+ }
SkImageFilter::Context ctx(matrix, clipBounds, cache);
if (filter->filterImage(&proxy, src, ctx, &dst, &offset)) {
SkPaint tmpUnfiltered(*paint);
@@ -1300,8 +1304,12 @@ void SkCanvas::drawSprite(const SkBitmap& bitmap, int x, int y,
SkMatrix matrix = *iter.fMatrix;
matrix.postTranslate(SkIntToScalar(-pos.x()), SkIntToScalar(-pos.y()));
SkIRect clipBounds = SkIRect::MakeWH(bitmap.width(), bitmap.height());
- SkImageFilter::Cache* cache = SkImageFilter::Cache::Create();
- SkAutoUnref aur(cache);
+ SkImageFilter::Cache* cache = SkImageFilter::GetExternalCache();
+ SkAutoUnref aur(NULL);
+ if (!cache) {
+ cache = SkImageFilter::Cache::Create();
+ aur.reset(cache);
+ }
SkImageFilter::Context ctx(matrix, clipBounds, cache);
if (filter->filterImage(&proxy, bitmap, ctx, &dst, &offset)) {
SkPaint tmpUnfiltered(*paint);
« no previous file with comments | « include/core/SkImageFilter.h ('k') | src/core/SkImageFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698