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

Side by Side Diff: include/core/SkSurface.h

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
« no previous file with comments | « no previous file | src/image/SkSurface.cpp » ('j') | src/image/SkSurface_Gpu.cpp » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #ifndef SkSurface_DEFINED 8 #ifndef SkSurface_DEFINED
9 #define SkSurface_DEFINED 9 #define SkSurface_DEFINED
10 10
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 /** 230 /**
231 * Returns an image of the current state of the surface pixels up to this 231 * Returns an image of the current state of the surface pixels up to this
232 * point. Subsequent changes to the surface (by drawing into its canvas) 232 * point. Subsequent changes to the surface (by drawing into its canvas)
233 * will not be reflected in this image. If a copy must be made the Budgeted 233 * will not be reflected in this image. If a copy must be made the Budgeted
234 * parameter controls whether it counts against the resource budget 234 * parameter controls whether it counts against the resource budget
235 * (currently for the gpu backend only). 235 * (currently for the gpu backend only).
236 */ 236 */
237 SkImage* newImageSnapshot(Budgeted = kYes_Budgeted); 237 SkImage* newImageSnapshot(Budgeted = kYes_Budgeted);
238 238
239 /** 239 /**
240 * In rare instances a client may want a unique copy of the SkSurface's cont ents in an image
241 * snapshot. This enum can be used to enforce that the image snapshot's back ing store is not
242 * shared with another image snapshot or the surface's backing store. This i s generally more
243 * expensive. This was added for Chromium bug 585250.
244 */
245 enum ForceUnique {
246 kNo_ForceUnique,
247 kYes_ForceUnique
248 };
249 SkImage* newImageSnapshot(Budgeted, ForceUnique);
250
251 /**
240 * Though the caller could get a snapshot image explicitly, and draw that, 252 * Though the caller could get a snapshot image explicitly, and draw that,
241 * it seems that directly drawing a surface into another canvas might be 253 * it seems that directly drawing a surface into another canvas might be
242 * a common pattern, and that we could possibly be more efficient, since 254 * a common pattern, and that we could possibly be more efficient, since
243 * we'd know that the "snapshot" need only live until we've handed it off 255 * we'd know that the "snapshot" need only live until we've handed it off
244 * to the canvas. 256 * to the canvas.
245 */ 257 */
246 void draw(SkCanvas*, SkScalar x, SkScalar y, const SkPaint*); 258 void draw(SkCanvas*, SkScalar x, SkScalar y, const SkPaint*);
247 259
248 /** 260 /**
249 * If the surface has direct access to its pixels (i.e. they are in local 261 * If the surface has direct access to its pixels (i.e. they are in local
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 private: 304 private:
293 const SkSurfaceProps fProps; 305 const SkSurfaceProps fProps;
294 const int fWidth; 306 const int fWidth;
295 const int fHeight; 307 const int fHeight;
296 uint32_t fGenerationID; 308 uint32_t fGenerationID;
297 309
298 typedef SkRefCnt INHERITED; 310 typedef SkRefCnt INHERITED;
299 }; 311 };
300 312
301 #endif 313 #endif
OLDNEW
« no previous file with comments | « no previous file | src/image/SkSurface.cpp » ('j') | src/image/SkSurface_Gpu.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698