diff options
author | Mike Reed <reed@google.com> | 2017-12-13 08:22:13 -0500 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-12-13 13:41:32 +0000 |
commit | c8226728541fdd6434a7f1b97678246202b0edc5 (patch) | |
tree | 3443b3f2f2fb5408b3abe999390470ef0c35eff0 /include/core | |
parent | 526c39f41f62f9ab82ebbeb30cc8762bb0eaa417 (diff) |
impl SkSerial picture procs
The picture serialization code is a bit of a mess, with duplicated functions for streams and buffers.
Could not see how to fix that and land this at the same time, but I will try to circle back and
simplify if possible afterwards.
Bug: skia:
Change-Id: I9053fdc476c60f483df013d021e248258181c199
Reviewed-on: https://skia-review.googlesource.com/83943
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Mike Reed <reed@google.com>
Diffstat (limited to 'include/core')
-rw-r--r-- | include/core/SkWriteBuffer.h | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/include/core/SkWriteBuffer.h b/include/core/SkWriteBuffer.h index 42d8f96eb9..b0b6fd993a 100644 --- a/include/core/SkWriteBuffer.h +++ b/include/core/SkWriteBuffer.h @@ -37,6 +37,8 @@ public: virtual bool isCrossProcess() const = 0; + virtual void writePad32(const void* buffer, size_t bytes) = 0; + virtual void writeByteArray(const void* data, size_t size) = 0; void writeDataAsByteArray(SkData* data) { this->writeByteArray(data->data(), data->size()); @@ -83,9 +85,14 @@ public: */ void setClientContext(void* ctx) { fClientCtx = ctx; } + void setSerialProcs(const SkSerialProcs& procs) { fProcs = procs; } + protected: - SkDeduper* fDeduper = nullptr; - void* fClientCtx = nullptr; + SkDeduper* fDeduper = nullptr; + void* fClientCtx = nullptr; + SkSerialProcs fProcs; + + friend class SkPicture; // fProcs }; /** @@ -108,7 +115,7 @@ public: void write(const void* buffer, size_t bytes) { fWriter.write(buffer, bytes); } - void writePad32(const void* buffer, size_t bytes) { + void writePad32(const void* buffer, size_t bytes) override { fWriter.writePad(buffer, bytes); } @@ -150,8 +157,6 @@ public: SkFactorySet* setFactoryRecorder(SkFactorySet*); SkRefCntSet* setTypefaceRecorder(SkRefCntSet*); - void setSerialProcs(const SkSerialProcs& procs) { fProcs = procs; } - #ifdef SK_SUPPORT_LEGACY_SERIAL_BUFFER_OBJECTS void setPixelSerializer(sk_sp<SkPixelSerializer>); #endif @@ -162,7 +167,6 @@ private: SkWriter32 fWriter; SkRefCntSet* fTFSet; - SkSerialProcs fProcs; // Only used if we do not have an fFactorySet SkTHashMap<SkString, uint32_t> fFlattenableDict; |