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

Side by Side 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright 2012 Google Inc. 2 * Copyright 2012 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkSurface_Base.h" 8 #include "SkSurface_Base.h"
9 #include "SkImagePriv.h" 9 #include "SkImagePriv.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 157
158 void SkSurface::notifyContentWillChange(ContentChangeMode mode) { 158 void SkSurface::notifyContentWillChange(ContentChangeMode mode) {
159 asSB(this)->aboutToDraw(mode); 159 asSB(this)->aboutToDraw(mode);
160 } 160 }
161 161
162 SkCanvas* SkSurface::getCanvas() { 162 SkCanvas* SkSurface::getCanvas() {
163 return asSB(this)->getCachedCanvas(); 163 return asSB(this)->getCachedCanvas();
164 } 164 }
165 165
166 SkImage* SkSurface::newImageSnapshot(Budgeted budgeted) { 166 SkImage* SkSurface::newImageSnapshot(Budgeted budgeted) {
167 SkImage* image = asSB(this)->getCachedImage(budgeted); 167 // the caller will call unref() to balance this
168 SkSafeRef(image); // the caller will call unref() to balance this 168 return asSB(this)->refCachedImage(budgeted, kNo_ForceUnique);
169 return image; 169 }
170
171 SkImage* SkSurface::newImageSnapshot(Budgeted budgeted, ForceUnique unique) {
172 // the caller will call unref() to balance this
173 return asSB(this)->refCachedImage(budgeted, unique);
170 } 174 }
171 175
172 SkSurface* SkSurface::newSurface(const SkImageInfo& info) { 176 SkSurface* SkSurface::newSurface(const SkImageInfo& info) {
173 return asSB(this)->onNewSurface(info); 177 return asSB(this)->onNewSurface(info);
174 } 178 }
175 179
176 void SkSurface::draw(SkCanvas* canvas, SkScalar x, SkScalar y, 180 void SkSurface::draw(SkCanvas* canvas, SkScalar x, SkScalar y,
177 const SkPaint* paint) { 181 const SkPaint* paint) {
178 return asSB(this)->onDraw(canvas, x, y, paint); 182 return asSB(this)->onDraw(canvas, x, y, paint);
179 } 183 }
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 const SkSurfaceProps*) { 216 const SkSurfaceProps*) {
213 return nullptr; 217 return nullptr;
214 } 218 }
215 219
216 SkSurface* SkSurface::NewFromBackendRenderTarget(GrContext*, const GrBackendRend erTargetDesc&, 220 SkSurface* SkSurface::NewFromBackendRenderTarget(GrContext*, const GrBackendRend erTargetDesc&,
217 const SkSurfaceProps*) { 221 const SkSurfaceProps*) {
218 return nullptr; 222 return nullptr;
219 } 223 }
220 224
221 #endif 225 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698