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

Unified Diff: src/image/SkSurface.cpp

Issue 1686163002: Allow client to force an SkImage snapshot to be unique (and uniquely own its backing store). (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix enum to bool warning Created 4 years, 10 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
Index: src/image/SkSurface.cpp
diff --git a/src/image/SkSurface.cpp b/src/image/SkSurface.cpp
index fed13a284beaed2202f5d2bde92f71032dcc777f..711dfda6a43c9662d9ef6c1586f5a5e87619b014 100644
--- a/src/image/SkSurface.cpp
+++ b/src/image/SkSurface.cpp
@@ -164,9 +164,13 @@ SkCanvas* SkSurface::getCanvas() {
}
SkImage* SkSurface::newImageSnapshot(Budgeted budgeted) {
- SkImage* image = asSB(this)->getCachedImage(budgeted);
- SkSafeRef(image); // the caller will call unref() to balance this
- return image;
+ // the caller will call unref() to balance this
+ return asSB(this)->refCachedImage(budgeted, kNo_ForceUnique);
+}
+
+SkImage* SkSurface::newImageSnapshot(Budgeted budgeted, ForceUnique unique) {
+ // the caller will call unref() to balance this
+ return asSB(this)->refCachedImage(budgeted, unique);
}
SkSurface* SkSurface::newSurface(const SkImageInfo& info) {

Powered by Google App Engine
This is Rietveld 408576698