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 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 */ | 225 */ |
226 SkSurface* newSurface(const SkImageInfo&); | 226 SkSurface* newSurface(const SkImageInfo&); |
227 | 227 |
228 /** | 228 /** |
229 * Returns an image of the current state of the surface pixels up to this | 229 * Returns an image of the current state of the surface pixels up to this |
230 * point. Subsequent changes to the surface (by drawing into its canvas) | 230 * point. Subsequent changes to the surface (by drawing into its canvas) |
231 * will not be reflected in this image. If a copy must be made the Budgeted | 231 * will not be reflected in this image. If a copy must be made the Budgeted |
232 * parameter controls whether it counts against the resource budget | 232 * parameter controls whether it counts against the resource budget |
233 * (currently for the gpu backend only). | 233 * (currently for the gpu backend only). |
234 */ | 234 */ |
235 SkImage* newImageSnapshot(SkBudgeted = SkBudgeted::kYes); | 235 sk_sp<SkImage> makeImageSnapshot(SkBudgeted = SkBudgeted::kYes); |
236 | 236 |
237 /** | 237 /** |
238 * In rare instances a client may want a unique copy of the SkSurface's cont
ents in an image | 238 * In rare instances a client may want a unique copy of the SkSurface's cont
ents in an image |
239 * snapshot. This enum can be used to enforce that the image snapshot's back
ing store is not | 239 * snapshot. This enum can be used to enforce that the image snapshot's back
ing store is not |
240 * shared with another image snapshot or the surface's backing store. This i
s generally more | 240 * shared with another image snapshot or the surface's backing store. This i
s generally more |
241 * expensive. This was added for Chromium bug 585250. | 241 * expensive. This was added for Chromium bug 585250. |
242 */ | 242 */ |
243 enum ForceUnique { | 243 enum ForceUnique { |
244 kNo_ForceUnique, | 244 kNo_ForceUnique, |
245 kYes_ForceUnique | 245 kYes_ForceUnique |
246 }; | 246 }; |
247 SkImage* newImageSnapshot(SkBudgeted, ForceUnique); | 247 sk_sp<SkImage> makeImageSnapshot(SkBudgeted, ForceUnique); |
| 248 |
| 249 #ifdef SK_SUPPORT_LEGACY_IMAGEFACTORY |
| 250 SkImage* newImageSnapshot(SkBudgeted budgeted = SkBudgeted::kYes) { |
| 251 return this->makeImageSnapshot(budgeted).release(); |
| 252 } |
| 253 SkImage* newImageSnapshot(SkBudgeted budgeted, ForceUnique force) { |
| 254 return this->makeImageSnapshot(budgeted, force).release(); |
| 255 } |
| 256 #endif |
248 | 257 |
249 /** | 258 /** |
250 * Though the caller could get a snapshot image explicitly, and draw that, | 259 * Though the caller could get a snapshot image explicitly, and draw that, |
251 * it seems that directly drawing a surface into another canvas might be | 260 * it seems that directly drawing a surface into another canvas might be |
252 * a common pattern, and that we could possibly be more efficient, since | 261 * a common pattern, and that we could possibly be more efficient, since |
253 * we'd know that the "snapshot" need only live until we've handed it off | 262 * we'd know that the "snapshot" need only live until we've handed it off |
254 * to the canvas. | 263 * to the canvas. |
255 */ | 264 */ |
256 void draw(SkCanvas*, SkScalar x, SkScalar y, const SkPaint*); | 265 void draw(SkCanvas*, SkScalar x, SkScalar y, const SkPaint*); |
257 | 266 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
310 private: | 319 private: |
311 const SkSurfaceProps fProps; | 320 const SkSurfaceProps fProps; |
312 const int fWidth; | 321 const int fWidth; |
313 const int fHeight; | 322 const int fHeight; |
314 uint32_t fGenerationID; | 323 uint32_t fGenerationID; |
315 | 324 |
316 typedef SkRefCnt INHERITED; | 325 typedef SkRefCnt INHERITED; |
317 }; | 326 }; |
318 | 327 |
319 #endif | 328 #endif |
OLD | NEW |