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

Unified Diff: src/core/SkPicturePlayback.cpp

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/SkPicturePlayback.h ('k') | src/core/SkPixelRef.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkPicturePlayback.cpp
diff --git a/src/core/SkPicturePlayback.cpp b/src/core/SkPicturePlayback.cpp
index 38f7deb111ba296f5a560810d1381b0c498329da..02d882897738f4d5b02a31ecd3a7d1615d1a9d2e 100644
--- a/src/core/SkPicturePlayback.cpp
+++ b/src/core/SkPicturePlayback.cpp
@@ -8,8 +8,8 @@
#include "SkPicturePlayback.h"
#include "SkPictureRecord.h"
#include "SkTypeface.h"
-#include "SkOrderedReadBuffer.h"
-#include "SkOrderedWriteBuffer.h"
+#include "SkReadBuffer.h"
+#include "SkWriteBuffer.h"
#include <new>
#include "SkBBoxHierarchy.h"
#include "SkPictureStateTree.h"
@@ -322,7 +322,7 @@ bool SkPicturePlayback::containsBitmaps() const {
#include "SkStream.h"
-static void writeTagSize(SkOrderedWriteBuffer& buffer, uint32_t tag,
+static void writeTagSize(SkWriteBuffer& buffer, uint32_t tag,
uint32_t size) {
buffer.writeUInt(tag);
buffer.writeUInt(size);
@@ -370,7 +370,7 @@ static void writeTypefaces(SkWStream* stream, const SkRefCntSet& rec) {
}
}
-void SkPicturePlayback::flattenToBuffer(SkOrderedWriteBuffer& buffer) const {
+void SkPicturePlayback::flattenToBuffer(SkWriteBuffer& buffer) const {
int i, n;
if ((n = SafeCount(fBitmaps)) > 0) {
@@ -411,8 +411,8 @@ void SkPicturePlayback::serialize(SkWStream* stream,
SkRefCntSet typefaceSet;
SkFactorySet factSet;
- SkOrderedWriteBuffer buffer;
- buffer.setFlags(SkFlattenableWriteBuffer::kCrossProcess_Flag);
+ SkWriteBuffer buffer;
+ buffer.setFlags(SkWriteBuffer::kCrossProcess_Flag);
buffer.setTypefaceRecorder(&typefaceSet);
buffer.setFactoryRecorder(&factSet);
buffer.setBitmapEncoder(encoder);
@@ -425,7 +425,7 @@ void SkPicturePlayback::serialize(SkWStream* stream,
writeFactories(stream, factSet);
writeTypefaces(stream, typefaceSet);
- writeTagSize(stream, PICT_BUFFER_SIZE_TAG, buffer.size());
+ writeTagSize(stream, PICT_BUFFER_SIZE_TAG, buffer.bytesWritten());
buffer.writeToStream(stream);
}
@@ -435,7 +435,7 @@ void SkPicturePlayback::serialize(SkWStream* stream,
///////////////////////////////////////////////////////////////////////////////
/**
- * Return the corresponding SkFlattenableReadBuffer flags, given a set of
+ * Return the corresponding SkReadBuffer flags, given a set of
* SkPictInfo flags.
*/
static uint32_t pictInfoFlagsToReadBufferFlags(uint32_t pictInfoFlags) {
@@ -443,9 +443,9 @@ static uint32_t pictInfoFlagsToReadBufferFlags(uint32_t pictInfoFlags) {
uint32_t fSrc;
uint32_t fDst;
} gSD[] = {
- { SkPictInfo::kCrossProcess_Flag, SkFlattenableReadBuffer::kCrossProcess_Flag },
- { SkPictInfo::kScalarIsFloat_Flag, SkFlattenableReadBuffer::kScalarIsFloat_Flag },
- { SkPictInfo::kPtrIs64Bit_Flag, SkFlattenableReadBuffer::kPtrIs64Bit_Flag },
+ { SkPictInfo::kCrossProcess_Flag, SkReadBuffer::kCrossProcess_Flag },
+ { SkPictInfo::kScalarIsFloat_Flag, SkReadBuffer::kScalarIsFloat_Flag },
+ { SkPictInfo::kPtrIs64Bit_Flag, SkReadBuffer::kPtrIs64Bit_Flag },
};
uint32_t rbMask = 0;
@@ -534,7 +534,7 @@ bool SkPicturePlayback::parseStreamTag(SkStream* stream, const SkPictInfo& info,
return false;
}
- SkOrderedReadBuffer buffer(storage.get(), size);
+ SkReadBuffer buffer(storage.get(), size);
buffer.setFlags(pictInfoFlagsToReadBufferFlags(info.fFlags));
fFactoryPlayback->setupBuffer(buffer);
@@ -554,7 +554,7 @@ bool SkPicturePlayback::parseStreamTag(SkStream* stream, const SkPictInfo& info,
return true; // success
}
-bool SkPicturePlayback::parseBufferTag(SkOrderedReadBuffer& buffer,
+bool SkPicturePlayback::parseBufferTag(SkReadBuffer& buffer,
uint32_t tag, size_t size) {
switch (tag) {
case PICT_BITMAP_BUFFER_TAG: {
« no previous file with comments | « src/core/SkPicturePlayback.h ('k') | src/core/SkPixelRef.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698