diff options
Diffstat (limited to 'src/image/SkImage_Picture.cpp')
-rw-r--r-- | src/image/SkImage_Picture.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/image/SkImage_Picture.cpp b/src/image/SkImage_Picture.cpp index c93c06fab5..959e47bd06 100644 --- a/src/image/SkImage_Picture.cpp +++ b/src/image/SkImage_Picture.cpp @@ -39,7 +39,17 @@ void SkImage_Picture::onDraw(SkCanvas* canvas, SkScalar x, SkScalar y, SkImagePrivDrawPicture(canvas, fPicture, x, y, paint); } -SkImage* SkNewImageFromPicture(SkPicture* pict) { - return SkNEW_ARGS(SkImage_Picture, (pict)); +SkImage* SkNewImageFromPicture(const SkPicture* srcPicture) { + /** + * We want to snapshot the playback status of the picture, w/o affecting + * its ability to continue recording (if needed). + * + * Optimally this will shared as much data/buffers as it can with + * srcPicture, and srcPicture will perform a copy-on-write as needed if it + * needs to mutate them later on. + */ + SkAutoTUnref<SkPicture> playback(SkNEW_ARGS(SkPicture, (*srcPicture))); + + return SkNEW_ARGS(SkImage_Picture, (playback)); } |