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

Unified Diff: include/core/SkWriteBuffer.h

Issue 2201323003: add pipecanvas (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: initial reader Created 4 years, 4 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
Index: include/core/SkWriteBuffer.h
diff --git a/include/core/SkWriteBuffer.h b/include/core/SkWriteBuffer.h
index 87ac8bf21494aa3ea8ec2aec7823a03bf74a0bea..83af4419ba00f2113c6ac1fbbe9bb49ff8b37727 100644
--- a/include/core/SkWriteBuffer.h
+++ b/include/core/SkWriteBuffer.h
@@ -19,6 +19,7 @@
#include "../private/SkTHash.h"
class SkBitmap;
+class SkDeduper;
class SkFactorySet;
class SkFlattenable;
class SkRefCntSet;
@@ -30,6 +31,8 @@ public:
virtual bool isCrossProcess() const = 0;
+ virtual void write(const void*, size_t) { sk_throw(); }
mtklein 2016/08/04 12:50:37 The other implementation of SkWriteBuffer isn't wr
reed1 2016/08/04 13:18:41 Makes sense. I hadn't internalized that I was goin
+
virtual void writeByteArray(const void* data, size_t size) = 0;
void writeDataAsByteArray(SkData* data) {
this->writeByteArray(data->data(), data->size());
@@ -60,12 +63,24 @@ public:
virtual void writeImage(const SkImage*) = 0;
virtual void writeTypeface(SkTypeface* typeface) = 0;
virtual void writePaint(const SkPaint& paint) = 0;
+
+ void setDedupers(SkDeduper* images, SkDeduper* typefaces) {
mtklein 2016/08/04 12:50:37 We can probably just put these on SkBinaryWriteBuf
+ fImageDeduper = images;
+ fTypefaceDeduper = typefaces;
+ }
+
+protected:
+ bool newWriteImage(const SkImage*);
+ bool newWriteTypeface(SkTypeface*);
+
+ SkDeduper* fImageDeduper = nullptr;
+ SkDeduper* fTypefaceDeduper = nullptr;
};
/**
* Concrete implementation that serializes to a flat binary blob.
*/
-class SkBinaryWriteBuffer final : public SkWriteBuffer {
+class SkBinaryWriteBuffer : public SkWriteBuffer {
public:
enum Flags {
kCrossProcess_Flag = 1 << 0,
@@ -79,6 +94,10 @@ public:
return SkToBool(fFlags & kCrossProcess_Flag);
}
+ void write(const void* buffer, size_t bytes) override {
+ fWriter.write(buffer, bytes);
+ }
+
void reset(void* storage = NULL, size_t storageSize = 0) {
fWriter.reset(storage, storageSize);
}
« no previous file with comments | « gyp/core.gypi ('k') | src/core/SkWriteBuffer.cpp » ('j') | src/pipe/SkPipeCanvas.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698