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, |