OLD | NEW |
---|---|
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 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
221 * SkCanvas* canvasA = surfaceA->newCanvas(); | 221 * SkCanvas* canvasA = surfaceA->newCanvas(); |
222 * ... | 222 * ... |
223 * SkSurface* surfaceB = surfaceA->newSurface(...); | 223 * SkSurface* surfaceB = surfaceA->newSurface(...); |
224 * SkCanvas* canvasB = surfaceB->newCanvas(); | 224 * SkCanvas* canvasB = surfaceB->newCanvas(); |
225 * ... // draw using canvasB | 225 * ... // draw using canvasB |
226 * canvasA->drawSurface(surfaceB); // <--- this will always be optimal! | 226 * canvasA->drawSurface(surfaceB); // <--- this will always be optimal! |
227 */ | 227 */ |
228 SkSurface* newSurface(const SkImageInfo&); | 228 SkSurface* newSurface(const SkImageInfo&); |
229 | 229 |
230 /** | 230 /** |
231 * In rare instances a client may want a unique copy of the SkSurface's cont ents in an image | |
232 * snapshot. This enum can be used to enforce that the image snapshot's back ing store is not | |
233 * shared with another image snapshot or the surface's backing store. This i s generally more | |
234 * expensive. | |
235 */ | |
236 enum ForceUnique { | |
237 kNo_ForceUnique, | |
238 kYes_ForceUnique | |
239 }; | |
240 | |
241 /** | |
231 * Returns an image of the current state of the surface pixels up to this | 242 * 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) | 243 * 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 | 244 * 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 | 245 * parameter controls whether it counts against the resource budget |
235 * (currently for the gpu backend only). | 246 * (currently for the gpu backend only). |
236 */ | 247 */ |
237 SkImage* newImageSnapshot(Budgeted = kYes_Budgeted); | 248 SkImage* newImageSnapshot(Budgeted = kYes_Budgeted, ForceUnique = kNo_ForceU nique); |
reed1
2016/02/15 21:32:13
Crud. I think its cruddy when we have more than on
| |
238 | 249 |
239 /** | 250 /** |
240 * Though the caller could get a snapshot image explicitly, and draw that, | 251 * 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 | 252 * 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 | 253 * 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 | 254 * we'd know that the "snapshot" need only live until we've handed it off |
244 * to the canvas. | 255 * to the canvas. |
245 */ | 256 */ |
246 void draw(SkCanvas*, SkScalar x, SkScalar y, const SkPaint*); | 257 void draw(SkCanvas*, SkScalar x, SkScalar y, const SkPaint*); |
247 | 258 |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
292 private: | 303 private: |
293 const SkSurfaceProps fProps; | 304 const SkSurfaceProps fProps; |
294 const int fWidth; | 305 const int fWidth; |
295 const int fHeight; | 306 const int fHeight; |
296 uint32_t fGenerationID; | 307 uint32_t fGenerationID; |
297 | 308 |
298 typedef SkRefCnt INHERITED; | 309 typedef SkRefCnt INHERITED; |
299 }; | 310 }; |
300 | 311 |
301 #endif | 312 #endif |
OLD | NEW |