diff options
author | robertphillips <robertphillips@google.com> | 2015-01-07 07:28:41 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-01-07 07:28:41 -0800 |
commit | 783fe16b8ed1cd1cff34eacc33296874a32f293b (patch) | |
tree | 18a8a4641125e2a092a6af30ac500238ffa62a98 /include | |
parent | c56fb00373fc6138f9530c2e47ddfd68c28dfc50 (diff) |
Rename SkDrawPictureCallback to SkPicture::AbortCallback
Committed: https://skia.googlesource.com/skia/+/7ef197255deb4e2fa64c03c7130d56ddf164e83c
Review URL: https://codereview.chromium.org/829983003
Diffstat (limited to 'include')
-rw-r--r-- | include/core/SkDrawPictureCallback.h | 13 | ||||
-rw-r--r-- | include/core/SkPicture.h | 23 |
2 files changed, 28 insertions, 8 deletions
diff --git a/include/core/SkDrawPictureCallback.h b/include/core/SkDrawPictureCallback.h index d5a360ee8e..ea30f59a24 100644 --- a/include/core/SkDrawPictureCallback.h +++ b/include/core/SkDrawPictureCallback.h @@ -10,6 +10,9 @@ #include "SkTypes.h" +#ifdef SK_LEGACY_DRAWPICTURECALLBACK +#include "SkPicture.h" + /** * Subclasses of this can be passed to canvas.drawPicture(). During the drawing * of the picture, this callback will periodically be invoked. If its @@ -20,12 +23,12 @@ * 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 SK_API SkDrawPictureCallback { +class SK_API SkDrawPictureCallback : public SkPicture::AbortCallback { public: - SkDrawPictureCallback() {} - virtual ~SkDrawPictureCallback() {} - virtual bool abortDrawing() = 0; + + bool abort() SK_OVERRIDE { return this->abortDrawing(); } }; +#endif -#endif//SkDrawPictureCallback_DEFINED +#endif // SkDrawPictureCallback_DEFINED diff --git a/include/core/SkPicture.h b/include/core/SkPicture.h index 35b4d056a5..80c3ca30a1 100644 --- a/include/core/SkPicture.h +++ b/include/core/SkPicture.h @@ -9,8 +9,6 @@ #ifndef SkPicture_DEFINED #define SkPicture_DEFINED -#include "SkBitmap.h" -#include "SkDrawPictureCallback.h" #include "SkImageDecoder.h" #include "SkRefCnt.h" #include "SkTDArray.h" @@ -19,6 +17,7 @@ class GrContext; #endif +class SkBitmap; class SkBBoxHierarchy; class SkCanvas; class SkData; @@ -102,6 +101,24 @@ public: ~SkPicture(); + /** + * Subclasses of this can be passed to playback(). During the playback + * of the picture, this callback will periodically be invoked. If its + * abort() 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 playback call was made. + */ + class SK_API AbortCallback { + public: + AbortCallback() {} + virtual ~AbortCallback() {} + + virtual bool abort() = 0; + }; + /** Replays the drawing commands on the specified canvas. Note that this has the effect of unfurling this picture into the destination canvas. Using the SkCanvas::drawPicture entry point gives the destination @@ -109,7 +126,7 @@ public: @param canvas the canvas receiving the drawing commands. @param callback a callback that allows interruption of playback */ - void playback(SkCanvas* canvas, SkDrawPictureCallback* = NULL) const; + void playback(SkCanvas* canvas, AbortCallback* = NULL) const; /** Return the cull rect used when creating this picture: { 0, 0, cullWidth, cullHeight }. It does not necessarily reflect the bounds of what has been recorded into the picture. |