aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/core/SkWriteBuffer.h
diff options
context:
space:
mode:
authorGravatar msarett <msarett@google.com>2016-04-22 12:43:07 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-04-22 12:43:07 -0700
commita3b3b238f507a6ec7f43febc6bf0bb17e04e770f (patch)
tree4a699b7a262309f9695db86c2e565109309aeb27 /include/core/SkWriteBuffer.h
parent4ff7c7423661db10ebaabda782fc8329e7a5f7ee (diff)
Enable flattening/unflattening with custom unflatten procs
Now flattenables are serialized using a string name, so that flattenables do not necessarily need to be registered before serialization. They just need to override getTypeName(). Allows custom unflatten procs to be set on the SkReadBuffer. This is optional if the flattenable is registered, but otherwise must be called. This was split off from: https://codereview.chromium.org/1837913003/ BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1858323002 Review URL: https://codereview.chromium.org/1858323002
Diffstat (limited to 'include/core/SkWriteBuffer.h')
-rw-r--r--include/core/SkWriteBuffer.h9
1 files changed, 5 insertions, 4 deletions
diff --git a/include/core/SkWriteBuffer.h b/include/core/SkWriteBuffer.h
index 306a3e37a9..c931ad3fd2 100644
--- a/include/core/SkWriteBuffer.h
+++ b/include/core/SkWriteBuffer.h
@@ -16,6 +16,7 @@
#include "SkPixelSerializer.h"
#include "SkRefCnt.h"
#include "SkWriter32.h"
+#include "../private/SkTHash.h"
class SkBitmap;
class SkBitmapHeap;
@@ -27,7 +28,6 @@ class SkWriteBuffer {
public:
enum Flags {
kCrossProcess_Flag = 1 << 0,
- kValidation_Flag = 1 << 1,
};
SkWriteBuffer(uint32_t flags = 0);
@@ -35,7 +35,7 @@ public:
~SkWriteBuffer();
bool isCrossProcess() const {
- return this->isValidating() || SkToBool(fFlags & kCrossProcess_Flag);
+ return SkToBool(fFlags & kCrossProcess_Flag);
}
SkWriter32* getWriter32() { return &fWriter; }
@@ -108,8 +108,6 @@ public:
SkPixelSerializer* getPixelSerializer() const { return fPixelSerializer; }
private:
- bool isValidating() const { return SkToBool(fFlags & kValidation_Flag); }
-
const uint32_t fFlags;
SkFactorySet* fFactorySet;
SkWriter32 fWriter;
@@ -118,6 +116,9 @@ private:
SkRefCntSet* fTFSet;
SkAutoTUnref<SkPixelSerializer> fPixelSerializer;
+
+ // Only used if we do not have an fFactorySet
+ SkTHashMap<SkString, uint32_t> fFlattenableDict;
};
#endif // SkWriteBuffer_DEFINED