change SkSurface::newCanvas() to getCanvas(), and redefine its life-cycle to be
a single canvas for the lifetime of the surface.
Get a playback copy from the src picture, so we can continue to record into the
original picture.
git-svn-id: http://skia.googlecode.com/svn/trunk@4842 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/image/SkImage_Picture.cpp b/src/image/SkImage_Picture.cpp
index c93c06f..959e47b 100644
--- a/src/image/SkImage_Picture.cpp
+++ b/src/image/SkImage_Picture.cpp
@@ -39,7 +39,17 @@
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));
}