aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/core/SkPicture.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/core/SkPicture.h')
-rw-r--r--include/core/SkPicture.h102
1 files changed, 2 insertions, 100 deletions
diff --git a/include/core/SkPicture.h b/include/core/SkPicture.h
index 14296e9c29..1f588a42b9 100644
--- a/include/core/SkPicture.h
+++ b/include/core/SkPicture.h
@@ -434,106 +434,8 @@ private:
#endif
-class SkBBHFactory {
-public:
- /**
- * Allocate a new SkBBoxHierarchy. Return NULL on failure.
- */
- virtual SkBBoxHierarchy* operator()(int width, int height) const = 0;
- virtual ~SkBBHFactory() {};
-};
-
-class SK_API SkPictureRecorder : SkNoncopyable {
-public:
-#ifdef SK_SUPPORT_LEGACY_DERIVED_PICTURE_CLASSES
-
- SkPictureRecorder(SkPictureFactory* factory = NULL) {
- fFactory.reset(factory);
- if (NULL != fFactory.get()) {
- fFactory.get()->ref();
- }
- }
-
- /** Returns the canvas that records the drawing commands.
- @param width the base width for the picture, as if the recording
- canvas' bitmap had this width.
- @param height the base width for the picture, as if the recording
- canvas' bitmap had this height.
- @param recordFlags optional flags that control recording.
- @return the canvas.
- */
- SkCanvas* beginRecording(int width, int height, uint32_t recordFlags = 0) {
- if (NULL != fFactory) {
- fPicture.reset(fFactory->create(width, height));
- recordFlags |= SkPicture::kOptimizeForClippedPlayback_RecordingFlag;
- } else {
- fPicture.reset(SkNEW(SkPicture));
- }
-
- return fPicture->beginRecording(width, height, recordFlags);
- }
+#ifdef SK_SUPPORT_LEGACY_PICTURE_HEADERS
+#include "SkPictureRecorder.h"
#endif
- /** Returns the canvas that records the drawing commands.
- @param width the base width for the picture, as if the recording
- canvas' bitmap had this width.
- @param height the base width for the picture, as if the recording
- canvas' bitmap had this height.
- @param bbhFactory factory to create desired acceleration structure
- @param recordFlags optional flags that control recording.
- @return the canvas.
- */
- // TODO: allow default parameters once the other beginRecoding entry point is gone
- SkCanvas* beginRecording(int width, int height,
- SkBBHFactory* bbhFactory /* = NULL */,
- uint32_t recordFlags /* = 0 */) {
- fPicture.reset(SkNEW(SkPicture));
- return fPicture->beginRecording(width, height, bbhFactory, recordFlags);
- }
-
- /** Returns the recording canvas if one is active, or NULL if recording is
- not active. This does not alter the refcnt on the canvas (if present).
- */
- SkCanvas* getRecordingCanvas() {
- if (NULL != fPicture.get()) {
- return fPicture->getRecordingCanvas();
- }
- return NULL;
- }
-
- /** Signal that the caller is done recording. This invalidates the canvas
- returned by beginRecording/getRecordingCanvas, and returns the
- created SkPicture. Note that the returned picture has its creation
- ref which the caller must take ownership of.
- */
- SkPicture* endRecording() {
- if (NULL != fPicture.get()) {
- fPicture->endRecording();
- return fPicture.detach();
- }
- return NULL;
- }
-
- /** Enable/disable all the picture recording optimizations (i.e.,
- those in SkPictureRecord). It is mainly intended for testing the
- existing optimizations (i.e., to actually have the pattern
- appear in an .skp we have to disable the optimization). Call right
- after 'beginRecording'.
- */
- void internalOnly_EnableOpts(bool enableOpts) {
- if (NULL != fPicture.get()) {
- fPicture->internalOnly_EnableOpts(enableOpts);
- }
- }
-
-private:
-#ifdef SK_SUPPORT_LEGACY_DERIVED_PICTURE_CLASSES
- SkAutoTUnref<SkPictureFactory> fFactory;
-#endif
-
- SkAutoTUnref<SkPicture> fPicture;
-
- typedef SkNoncopyable INHERITED;
-};
-
#endif