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 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 Loading... |
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 |
OLD | NEW |