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

Unified Diff: include/core/SkPicture.h

Issue 14598023: add SkDrawPictureCallback optional parameter to drawPicture(), which can abort the picture drawing. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 7 months 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 | « no previous file | src/core/SkPicture.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/core/SkPicture.h
diff --git a/include/core/SkPicture.h b/include/core/SkPicture.h
index b2c2b62edec4ee3684dc4ef4ef3129a1e29f2ad8..83aee4b2be4aea4e3d19fe1165bbe89fe664cd47 100644
--- a/include/core/SkPicture.h
+++ b/include/core/SkPicture.h
@@ -15,6 +15,7 @@
class SkBBoxHierarchy;
class SkCanvas;
+class SkDrawPictureCallback;
class SkPicturePlayback;
class SkPictureRecord;
class SkStream;
@@ -150,9 +151,9 @@ public:
/** Replays the drawing commands on the specified canvas. This internally
calls endRecording() if that has not already been called.
- @param surface the canvas receiving the drawing commands.
+ @param canvas the canvas receiving the drawing commands.
robertphillips 2013/05/20 17:05:19 document 'callback' parameter?
*/
- void draw(SkCanvas* surface);
+ void draw(SkCanvas* canvas, SkDrawPictureCallback* = NULL);
/** Return the width of the picture's recording canvas. This
value reflects what was passed to setSize(), and does not necessarily
@@ -246,5 +247,22 @@ private:
SkCanvas* fCanvas;
};
+/**
+ * Subclasses of this can be passed to canvas.drawPicture. During the drawing
+ * of the picture, this callback will periodically be invoked. If its
+ * abortDrawing() returns true, then picture playback will be interrupted.
+ *
+ * The resulting drawing is undefined, as there is no guarantee how often the
+ * callback will be invoked. If the abort happens inside some level of nested
+ * calls to save(), restore will automatically be called to return the state
+ * to the same level it was before the drawPicture call was made.
+ */
+class SkDrawPictureCallback {
+public:
+ SkDrawPictureCallback() {}
+ virtual ~SkDrawPictureCallback() {}
+
+ virtual bool abortDrawing() = 0;
+};
#endif
« no previous file with comments | « no previous file | src/core/SkPicture.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698