Chromium Code Reviews| Index: include/core/SkFlattenableBuffers.h |
| diff --git a/include/core/SkFlattenableBuffers.h b/include/core/SkFlattenableBuffers.h |
| index 03c03f3877e6f8e3f508d29e371d5c7ebd91624e..dd51e08967e8c9ea1552d5aa66daad770cdb7d2c 100644 |
| --- a/include/core/SkFlattenableBuffers.h |
| +++ b/include/core/SkFlattenableBuffers.h |
| @@ -10,6 +10,7 @@ |
| #define SkFlattenableBuffers_DEFINED |
| #include "SkColor.h" |
| +#include "SkData.h" |
| #include "SkPaint.h" |
| #include "SkPoint.h" |
| @@ -97,6 +98,13 @@ public: |
| this->readPoint(&point); |
| return point; |
| } |
| + |
| + SkData* readByteArrayAsData() { |
|
mtklein
2013/10/10 21:32:03
Mentioning byte array here seems weird to me. rea
sugoi
2013/10/11 12:03:35
Shouldn't it be pure virtual and defined in SkOrde
sugoi
2013/10/11 12:03:35
+1
reed1
2013/10/14 13:32:14
I think there is no value-added to storing SkData
|
| + size_t len = this->getArrayCount(); |
| + void* buffer = sk_malloc_throw(len); |
| + (void)this->readByteArray(buffer); |
| + return SkData::NewFromMalloc(buffer, len); |
| + } |
| template <typename T> T* readFlattenableT() { |
| return static_cast<T*>(this->readFlattenable()); |
| @@ -165,6 +173,10 @@ public: |
| bool persistTypeface() const { return (fFlags & kCrossProcess_Flag) != 0; } |
| + void writeDataAsByteArray(SkData* data) { |
| + this->writeByteArray(data->data(), data->size()); |
| + } |
| + |
| protected: |
| // A helper function so that each subclass does not have to be a friend of SkFlattenable |
| void flattenObject(SkFlattenable* obj, SkFlattenableWriteBuffer& buffer); |