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

Unified Diff: include/core/SkCanvas.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 | include/core/SkPicture.h » ('j') | include/core/SkPicture.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/core/SkCanvas.h
diff --git a/include/core/SkCanvas.h b/include/core/SkCanvas.h
index 2bf5a54a51ae298d0947c063eb41882f1cb7d0a6..18abbdcf41d3e5081bf001fe3c169dc91078d434 100644
--- a/include/core/SkCanvas.h
+++ b/include/core/SkCanvas.h
@@ -30,6 +30,24 @@ class SkPicture;
class SkRRect;
class SkSurface_Base;
+/**
+ * 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;
+};
+
/** \class SkCanvas
A Canvas encapsulates all of the state about drawing into a device (bitmap).
@@ -808,13 +826,14 @@ public:
const SkPath& path, const SkMatrix* matrix);
#endif
+
/** Draw the picture into this canvas. This method effective brackets the
playback of the picture's draw calls with save/restore, so the state
of this canvas will be unchanged after this call.
@param picture The recorded drawing commands to playback into this
canvas.
*/
- virtual void drawPicture(SkPicture& picture);
+ virtual void drawPicture(SkPicture& picture, SkDrawPictureCallback* = NULL);
enum VertexMode {
kTriangles_VertexMode,
« no previous file with comments | « no previous file | include/core/SkPicture.h » ('j') | include/core/SkPicture.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698