| Index: include/core/SkPicture.h
|
| ===================================================================
|
| --- include/core/SkPicture.h (revision 14237)
|
| +++ include/core/SkPicture.h (working copy)
|
| @@ -18,6 +18,7 @@
|
| class GrContext;
|
| #endif
|
|
|
| +class SkBBHFactory;
|
| class SkBBoxHierarchy;
|
| class SkCanvas;
|
| class SkDrawPictureCallback;
|
| @@ -174,11 +175,10 @@
|
|
|
| #ifndef SK_SUPPORT_LEGACY_PICTURE_CAN_RECORD
|
| private:
|
| - friend class SkPictureRecorder;
|
| - friend class SkImage_Picture;
|
| - friend class SkSurface_Picture;
|
| #endif
|
|
|
| +#ifdef SK_SUPPORT_LEGACY_DERIVED_PICTURE_CLASSES
|
| +
|
| /** 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.
|
| @@ -188,6 +188,7 @@
|
| @return the picture canvas.
|
| */
|
| SkCanvas* beginRecording(int width, int height, uint32_t recordFlags = 0);
|
| +#endif
|
|
|
| /** 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).
|
| @@ -346,10 +347,14 @@
|
| // playback is unchanged.
|
| SkPicture(SkPicturePlayback*, int width, int height);
|
|
|
| +#ifdef SK_SUPPORT_LEGACY_DERIVED_PICTURE_CLASSES
|
| // For testing. Derived classes may instantiate an alternate
|
| // SkBBoxHierarchy implementation
|
| virtual SkBBoxHierarchy* createBBoxHierarchy() const;
|
| +#endif
|
|
|
| + SkCanvas* beginRecording(int width, int height, SkBBHFactory* factory, uint32_t recordFlags);
|
| +
|
| private:
|
| // An OperationList encapsulates a set of operation offsets into the picture byte
|
| // stream along with the CTMs needed for those operation.
|
| @@ -388,6 +393,7 @@
|
|
|
| friend class SkFlatPicture;
|
| friend class SkPicturePlayback;
|
| + friend class SkPictureRecorder;
|
| friend class SkGpuDevice;
|
| friend class GrGatherDevice;
|
| friend class SkDebugCanvas;
|
| @@ -413,6 +419,8 @@
|
| virtual bool abortDrawing() = 0;
|
| };
|
|
|
| +#ifdef SK_SUPPORT_LEGACY_DERIVED_PICTURE_CLASSES
|
| +
|
| class SkPictureFactory : public SkRefCnt {
|
| public:
|
| /**
|
| @@ -424,8 +432,21 @@
|
| typedef SkRefCnt INHERITED;
|
| };
|
|
|
| +#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()) {
|
| @@ -451,7 +472,25 @@
|
|
|
| return fPicture->beginRecording(width, height, recordFlags);
|
| }
|
| +#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).
|
| */
|
| @@ -488,9 +527,12 @@
|
| }
|
|
|
| private:
|
| - SkAutoTUnref<SkPictureFactory> fFactory;
|
| - SkAutoTUnref<SkPicture> fPicture;
|
| +#ifdef SK_SUPPORT_LEGACY_DERIVED_PICTURE_CLASSES
|
| + SkAutoTUnref<SkPictureFactory> fFactory;
|
| +#endif
|
|
|
| + SkAutoTUnref<SkPicture> fPicture;
|
| +
|
| typedef SkNoncopyable INHERITED;
|
| };
|
|
|
|
|