aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkPictureData.h
diff options
context:
space:
mode:
authorGravatar reed <reed@google.com>2016-08-11 03:55:15 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-08-11 03:55:15 -0700
commita9ca05ca5e604b9ee18e9cce19b059085ca0e22c (patch)
treeb8b28257068935dc55c956c41ff2e3d899e031c7 /src/core/SkPictureData.h
parent286a8657da0364006e95cb0988477cc3a5f0e112 (diff)
Deserialize pictures with custom image-deserializer
Diffstat (limited to 'src/core/SkPictureData.h')
-rw-r--r--src/core/SkPictureData.h13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/core/SkPictureData.h b/src/core/SkPictureData.h
index ec147f7e21..0e351509bc 100644
--- a/src/core/SkPictureData.h
+++ b/src/core/SkPictureData.h
@@ -64,7 +64,7 @@ public:
// Does not affect ownership of SkStream.
static SkPictureData* CreateFromStream(SkStream*,
const SkPictInfo&,
- SkPicture::InstallPixelRefProc,
+ SkImageDeserializer*,
SkTypefacePlayback*);
static SkPictureData* CreateFromBuffer(SkReadBuffer&, const SkPictInfo&);
@@ -85,13 +85,13 @@ protected:
explicit SkPictureData(const SkPictInfo& info);
// Does not affect ownership of SkStream.
- bool parseStream(SkStream*, SkPicture::InstallPixelRefProc, SkTypefacePlayback*);
+ bool parseStream(SkStream*, SkImageDeserializer*, SkTypefacePlayback*);
bool parseBuffer(SkReadBuffer& buffer);
public:
- const SkBitmap& getBitmap(SkReadBuffer* reader) const {
+ const SkImage* getBitmapAsImage(SkReadBuffer* reader) const {
const int index = reader->readInt();
- return reader->validateIndex(index, fBitmaps.count()) ? fBitmaps[index] : fEmptyBitmap;
+ return reader->validateIndex(index, fBitmapImageCount) ? fBitmapImageRefs[index] : nullptr;
}
const SkImage* getImage(SkReadBuffer* reader) const {
@@ -149,11 +149,10 @@ private:
// these help us with reading/writing
// Does not affect ownership of SkStream.
bool parseStreamTag(SkStream*, uint32_t tag, uint32_t size,
- SkPicture::InstallPixelRefProc, SkTypefacePlayback*);
+ SkImageDeserializer*, SkTypefacePlayback*);
bool parseBufferTag(SkReadBuffer&, uint32_t tag, uint32_t size);
void flattenToBuffer(SkWriteBuffer&) const;
- SkTArray<SkBitmap> fBitmaps;
SkTArray<SkPaint> fPaints;
SkTArray<SkPath> fPaths;
@@ -170,6 +169,8 @@ private:
int fTextBlobCount;
const SkImage** fImageRefs;
int fImageCount;
+ const SkImage** fBitmapImageRefs;
+ int fBitmapImageCount;
SkPictureContentInfo fContentInfo;