Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8)

Unified Diff: include/core/SkPictureRecorder.h

Issue 732653004: option to return drawable from recording (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « include/core/SkPicture.h ('k') | samplecode/SampleArc.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/core/SkPictureRecorder.h
diff --git a/include/core/SkPictureRecorder.h b/include/core/SkPictureRecorder.h
index 528472bc2231bf4611b380265f8a9d983714ca52..37cbe8692a2b78c129dd2e9247b3f24dbf7d0904 100644
--- a/include/core/SkPictureRecorder.h
+++ b/include/core/SkPictureRecorder.h
@@ -19,6 +19,7 @@ namespace android {
#endif
class SkCanvas;
+class SkCanvasDrawable;
class SkPictureRecord;
class SkRecord;
class SkRecorder;
@@ -65,12 +66,32 @@ public:
*/
SkCanvas* getRecordingCanvas();
- /** Signal that the caller is done recording. This invalidates the canvas
- returned by beginRecording/getRecordingCanvas, and returns the
- created SkPicture. Note that the returned picture has its creation
- ref which the caller must take ownership of.
- */
- SkPicture* endRecording();
+ /**
+ * Signal that the caller is done recording. This invalidates the canvas returned by
+ * beginRecording/getRecordingCanvas. Ownership of the object is passed to the caller, who
+ * must call unref() when they are done using it.
+ *
+ * The returned picture is immutable. If during recording drawables were added to the canvas,
+ * these will have been "drawn" into a recording canvas, so that this resulting picture will
+ * reflect their current state, but will not contain a live reference to the drawables
+ * themselves.
+ */
+ SkPicture* endRecordingAsPicture();
+
+ /**
+ * Signal that the caller is done recording. This invalidates the canvas returned by
+ * beginRecording/getRecordingCanvas. Ownership of the object is passed to the caller, who
+ * must call unref() when they are done using it.
+ *
+ * Unlike endRecordingAsPicture(), which returns an immutable picture, the returned drawable
+ * may contain live references to other drawables (if they were added to the recording canvas)
+ * and therefore this drawable will reflect the current state of those nested drawables anytime
+ * it is drawn or a new picture is snapped from it (by calling drawable->newPictureSnapshot()).
+ */
+ SkCanvasDrawable* EXPERIMENTAL_endRecordingAsDrawable();
+
+ // Legacy API -- use endRecordingAsPicture instead.
+ SkPicture* endRecording() { return this->endRecordingAsPicture(); }
private:
void reset();
@@ -88,7 +109,8 @@ private:
SkRect fCullRect;
SkAutoTUnref<SkBBoxHierarchy> fBBH;
SkAutoTUnref<SkRecorder> fRecorder;
- SkAutoTDelete<SkRecord> fRecord;
+ SkAutoTUnref<SkRecord> fRecord;
+ SkBBHFactory* fBBHFactory;
typedef SkNoncopyable INHERITED;
};
« no previous file with comments | « include/core/SkPicture.h ('k') | samplecode/SampleArc.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698