Index: src/core/SkPictureFlat.h |
diff --git a/src/core/SkPictureFlat.h b/src/core/SkPictureFlat.h |
index 431fa960370b00b4dab52670734b86c599587fa1..7973e65398188d720fd06db7fedcb25512a3a438 100644 |
--- a/src/core/SkPictureFlat.h |
+++ b/src/core/SkPictureFlat.h |
@@ -168,7 +168,7 @@ class SkFlatController : public SkRefCnt { |
public: |
SK_DECLARE_INST_COUNT(SkFlatController) |
- SkFlatController(); |
+ SkFlatController(uint32_t writeBufferFlags = 0); |
virtual ~SkFlatController(); |
/** |
* Return a new block of memory for the SkFlatDictionary to use. |
@@ -242,17 +242,12 @@ protected: |
*/ |
SkNamedFactorySet* setNamedFactorySet(SkNamedFactorySet*); |
- /** |
- * Set the flags to be used during flattening. |
- */ |
- void setWriteBufferFlags(uint32_t flags) { fWriteBufferFlags = flags; } |
- |
private: |
SkBitmapHeap* fBitmapHeap; |
SkRefCntSet* fTypefaceSet; |
SkTypefacePlayback* fTypefacePlayback; |
SkNamedFactorySet* fFactorySet; |
- uint32_t fWriteBufferFlags; |
+ const uint32_t fWriteBufferFlags; |
typedef SkRefCnt INHERITED; |
}; |
@@ -264,12 +259,11 @@ public: |
static SkFlatData* Create(SkFlatController* controller, const T& obj, int index) { |
// A buffer of 256 bytes should fit most paints, regions, and matrices. |
uint32_t storage[64]; |
- SkWriteBuffer buffer(storage, sizeof(storage)); |
+ SkWriteBuffer buffer(storage, sizeof(storage), controller->getWriteBufferFlags()); |
buffer.setBitmapHeap(controller->getBitmapHeap()); |
buffer.setTypefaceRecorder(controller->getTypefaceSet()); |
buffer.setNamedFactoryRecorder(controller->getNamedFactorySet()); |
- buffer.setFlags(controller->getWriteBufferFlags()); |
Traits::flatten(buffer, obj); |
size_t size = buffer.bytesWritten(); |
@@ -367,6 +361,7 @@ class SkFlatDictionary { |
public: |
explicit SkFlatDictionary(SkFlatController* controller) |
: fController(SkRef(controller)) |
+ , fScratch(controller->getWriteBufferFlags()) |
, fReady(false) { |
this->reset(); |
} |
@@ -496,7 +491,6 @@ private: |
fScratch.setBitmapHeap(fController->getBitmapHeap()); |
fScratch.setTypefaceRecorder(fController->getTypefaceSet()); |
fScratch.setNamedFactoryRecorder(fController->getNamedFactorySet()); |
- fScratch.setFlags(fController->getWriteBufferFlags()); |
fReady = true; |
} |