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

Unified Diff: src/core/SkPictureShader.cpp

Issue 808853003: [M40 merge] Detect discarded SkPictureShader pixel refs. (Closed) Base URL: https://skia.googlesource.com/skia.git@m40
Patch Set: 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 1f32a7ecdfd5c8a99b0e39046c10756b600213b0..1596fb3abb92e9a4df698f7d3fb7ab22463ea6bc 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