Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(125)

Unified Diff: src/core/SkPictureFlat.h

Issue 138803005: Set write buffer flags only in SkWriteBuffer and SkFlatController constructors. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: INHERITED Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/core/SkFlattenableSerialization.cpp ('k') | src/core/SkPictureFlat.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
}
« no previous file with comments | « src/core/SkFlattenableSerialization.cpp ('k') | src/core/SkPictureFlat.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698