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

Unified Diff: src/core/SkPictureShader.cpp

Issue 787043006: Detect discarded SkPictureShader pixel refs. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: added issue ref Created 6 years 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkPictureShader.cpp
diff --git a/src/core/SkPictureShader.cpp b/src/core/SkPictureShader.cpp
index 198a2a9e497602b24e0ed7b5ed4a9f66c9899a19..fb05597db853d18b1497fe3c91e7e361606d03b2 100644
--- a/src/core/SkPictureShader.cpp
+++ b/src/core/SkPictureShader.cpp
@@ -77,7 +77,14 @@ struct BitmapShaderRec : public SkResourceCache::Rec {
SkAutoTUnref<SkShader>* result = reinterpret_cast<SkAutoTUnref<SkShader>*>(contextShader);
result->reset(SkRef(rec.fShader.get()));
- return true;
+
+ SkBitmap tile;
+ rec.fShader.get()->asABitmap(&tile, NULL, NULL);
+ // FIXME: this doesn't protect the pixels from being discarded as soon as we unlock.
+ // Should be handled via a pixel ref generator instead
+ // (https://code.google.com/p/skia/issues/detail?id=3220).
+ SkAutoLockPixels alp(tile, true);
+ return tile.getPixels() != NULL;
}
};
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698