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

Unified Diff: src/core/SkPictureFlat.h

Issue 134163010: Refactor read and write buffers. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: whoops, read buffers have .size() 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/SkPathHeap.cpp ('k') | src/core/SkPicturePlayback.h » ('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 d92e4c45df6982cfb545a6e3c6cb564f27c6f9ef..431fa960370b00b4dab52670734b86c599587fa1 100644
--- a/src/core/SkPictureFlat.h
+++ b/src/core/SkPictureFlat.h
@@ -13,8 +13,8 @@
#include "SkBitmapHeap.h"
#include "SkChecksum.h"
#include "SkChunkAlloc.h"
-#include "SkOrderedReadBuffer.h"
-#include "SkOrderedWriteBuffer.h"
+#include "SkReadBuffer.h"
+#include "SkWriteBuffer.h"
#include "SkPaint.h"
#include "SkPicture.h"
#include "SkPtrRecorder.h"
@@ -107,7 +107,7 @@ public:
void setCount(int count);
SkRefCnt* set(int index, SkRefCnt*);
- void setupBuffer(SkOrderedReadBuffer& buffer) const {
+ void setupBuffer(SkReadBuffer& buffer) const {
buffer.setTypefaceArray((SkTypeface**)fArray, fCount);
}
@@ -128,7 +128,7 @@ public:
SkFlattenable::Factory* base() const { return fArray; }
- void setupBuffer(SkOrderedReadBuffer& buffer) const {
+ void setupBuffer(SkReadBuffer& buffer) const {
buffer.setFactoryPlayback(fArray, fCount);
}
@@ -264,7 +264,7 @@ 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];
- SkOrderedWriteBuffer buffer(storage, sizeof(storage));
+ SkWriteBuffer buffer(storage, sizeof(storage));
buffer.setBitmapHeap(controller->getBitmapHeap());
buffer.setTypefaceRecorder(controller->getTypefaceSet());
@@ -272,7 +272,7 @@ public:
buffer.setFlags(controller->getWriteBufferFlags());
Traits::flatten(buffer, obj);
- size_t size = buffer.size();
+ size_t size = buffer.bytesWritten();
SkASSERT(SkIsAlign4(size));
// Allocate enough memory to hold SkFlatData struct and the flat data itself.
@@ -291,7 +291,7 @@ public:
void unflatten(T* result,
SkBitmapHeap* bitmapHeap = NULL,
SkTypefacePlayback* facePlayback = NULL) const {
- SkOrderedReadBuffer buffer(this->data(), fFlatSize);
+ SkReadBuffer buffer(this->data(), fFlatSize);
if (bitmapHeap) {
buffer.setBitmapStorage(bitmapHeap);
@@ -556,7 +556,7 @@ private:
// All SkFlatData* stored in fIndexedData and fHash are owned by the controller.
SkAutoTUnref<SkFlatController> fController;
- SkOrderedWriteBuffer fScratch;
+ SkWriteBuffer fScratch;
bool fReady;
// For index -> SkFlatData. 0-based, while all indices in the API are 1-based. Careful!
@@ -568,10 +568,10 @@ private:
};
struct SkPaintTraits {
- static void flatten(SkOrderedWriteBuffer& buffer, const SkPaint& paint) {
+ static void flatten(SkWriteBuffer& buffer, const SkPaint& paint) {
paint.flatten(buffer);
}
- static void unflatten(SkOrderedReadBuffer& buffer, SkPaint* paint) {
+ static void unflatten(SkReadBuffer& buffer, SkPaint* paint) {
paint->unflatten(buffer);
}
};
« no previous file with comments | « src/core/SkPathHeap.cpp ('k') | src/core/SkPicturePlayback.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698