diff options
author | reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2012-06-25 14:36:28 +0000 |
---|---|---|
committer | reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2012-06-25 14:36:28 +0000 |
commit | 34342f6f5127122ecc32166dcffa7f3d2a45c387 (patch) | |
tree | c81853324ad7a7461527222b3a13dc5cd6496aa9 /include | |
parent | ec95a4ae45e9bff1a92627372fd771b389813fec (diff) |
export flags on the state of the world when a picture was serialized.
e.g. don't read/write functionptrs in that case (sizeof may be different for one)
Review URL: https://codereview.appspot.com/6331050
git-svn-id: http://skia.googlecode.com/svn/trunk@4318 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'include')
-rw-r--r-- | include/core/SkFlattenable.h | 17 | ||||
-rw-r--r-- | include/core/SkPicture.h | 4 |
2 files changed, 20 insertions, 1 deletions
diff --git a/include/core/SkFlattenable.h b/include/core/SkFlattenable.h index e6c56a330e..1828b42a45 100644 --- a/include/core/SkFlattenable.h +++ b/include/core/SkFlattenable.h @@ -127,9 +127,21 @@ class SkTypeface; class SkFlattenableReadBuffer { public: + enum Flags { + kCrossProcess_Flag = 1 << 0, + kScalarIsFloat_Flag = 1 << 1, + kPtrIs64Bit_Flag = 1 << 2, + }; + SkFlattenableReadBuffer(); virtual ~SkFlattenableReadBuffer() {} + void setFlags(uint32_t flags) { fFlags = flags; } + uint32_t getFlags() const { return fFlags; } + + bool isCrossProcess() const { return SkToBool(fFlags & kCrossProcess_Flag); } + bool isScalarFloat() const { return SkToBool(fFlags & kScalarIsFloat_Flag); } + bool isPtr64Bit() const { return SkToBool(fFlags & kPtrIs64Bit_Flag); } virtual uint8_t readU8() = 0; virtual uint16_t readU16() = 0; @@ -192,7 +204,7 @@ public: virtual SkRefCnt* readRefCnt() = 0; virtual void* readFunctionPtr() = 0; virtual SkFlattenable* readFlattenable() = 0; - + protected: SkRefCnt** fRCArray; int fRCCount; @@ -203,6 +215,9 @@ protected: SkTDArray<SkFlattenable::Factory>* fFactoryTDArray; SkFlattenable::Factory* fFactoryArray; int fFactoryCount; + +private: + uint32_t fFlags; }; /////////////////////////////////////////////////////////////////////////////// diff --git a/include/core/SkPicture.h b/include/core/SkPicture.h index 51ed0d71ac..976c594cad 100644 --- a/include/core/SkPicture.h +++ b/include/core/SkPicture.h @@ -37,6 +37,10 @@ public: this call, those elements will not appear in this picture. */ SkPicture(const SkPicture& src); + /** + * Recreate a picture that was serialized into a stream. If an error occurs + * the picture will be "empty" : width and height == 0 + */ explicit SkPicture(SkStream*); virtual ~SkPicture(); |