diff options
author | scroggo <scroggo@google.com> | 2014-12-11 10:53:58 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-12-11 10:53:58 -0800 |
commit | 895c43b28b27bb3124db3d32efd0c7219eb4a3cb (patch) | |
tree | 6ddad54915062eca5db65a8ad56525540ce380b1 /include/core/SkPicture.h | |
parent | 436293a3308d58ce494d9667bd13428dd6e35236 (diff) |
Replace EncodeBitmap with an interface.
Gives more flexibility to the caller to decide whether to use the
encoded data returned by refEncodedData().
Provides an implementation that supports the old version of
SkPicture::serialize().
TODO: Update Chrome, so we can remove SK_LEGACY_ENCODE_BITMAP entirely
BUG=skia:3190
Review URL: https://codereview.chromium.org/784643002
Diffstat (limited to 'include/core/SkPicture.h')
-rw-r--r-- | include/core/SkPicture.h | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/include/core/SkPicture.h b/include/core/SkPicture.h index eb136e14e4..35458095da 100644 --- a/include/core/SkPicture.h +++ b/include/core/SkPicture.h @@ -24,6 +24,7 @@ class SkBBoxHierarchy; class SkCanvas; class SkData; class SkPictureData; +class SkPixelSerializer; class SkStream; class SkWStream; @@ -35,6 +36,8 @@ namespace SkRecords { class CollectLayers; }; +//#define SK_LEGACY_ENCODE_BITMAP + /** \class SkPicture The SkPicture class records the drawing commands made to a canvas, to @@ -141,15 +144,30 @@ public: * @param pixelRefOffset DEPRECATED -- caller assumes it will return 0. * @return SkData If non-NULL, holds encoded data representing the passed * in bitmap. The caller is responsible for calling unref(). + * + * TODO: No longer used by SkPicture (except when SK_LEGACY_ENCODE_BITMAP + * is defined. Still used by PDF though. Move into PDF. */ typedef SkData* (*EncodeBitmap)(size_t* pixelRefOffset, const SkBitmap& bm); +#ifdef SK_LEGACY_ENCODE_BITMAP /** * Serialize to a stream. If non NULL, encoder will be used to encode * any bitmaps in the picture. * encoder will never be called with a NULL pixelRefOffset. + * DEPRECATED - use serialize(SkWStream*, SkPixelSerializer* serializer) + * instead. + */ + void serialize(SkWStream* wStream, EncodeBitmap encoder) const; +#endif + + /** + * Serialize to a stream. If non NULL, serializer will be used to serialize + * any bitmaps in the picture. + * + * TODO: Use serializer to serialize SkImages as well. */ - void serialize(SkWStream*, EncodeBitmap encoder = NULL) const; + void serialize(SkWStream*, SkPixelSerializer* serializer = NULL) const; /** * Serialize to a buffer. |