skia2/include/core/SkDrawPictureCallback.h
Mike Klein c11530ea73 Tick off some TODOs:
- support fRecord in copy constructor
  - support SkDrawPictureCallback

Moved SkDrawPictureCallback to its own header so
SkRecordDraw can include it without pulling in all of
SkPicture.

Adding an SkAutoSaveRestore to SkRecordDraw was the easiest
way to match the balance guarantees of the callback, and
probably not a bad idea in general.  Updated its tests.

BUG=skia:
R=robertphillips@google.com

Review URL: https://codereview.chromium.org/349973008
2014-06-24 11:29:06 -04:00

30 lines
960 B
C++

/*
* Copyright 2014 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef SkDrawPictureCallback_DEFINED
#define SkDrawPictureCallback_DEFINED
/**
* 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 SK_API SkDrawPictureCallback {
public:
SkDrawPictureCallback() {}
virtual ~SkDrawPictureCallback() {}
virtual bool abortDrawing() = 0;
};
#endif//SkDrawPictureCallback_DEFINED