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

Unified Diff: src/core/SkPipe.h

Issue 2201323003: add pipecanvas (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: add test for writeImage Created 4 years, 3 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/SkDeduper.h ('k') | src/core/SkReadBuffer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkPipe.h
diff --git a/src/core/SkPipe.h b/src/core/SkPipe.h
new file mode 100644
index 0000000000000000000000000000000000000000..d3d5a362e7af1822f841650368fc46681a33d983
--- /dev/null
+++ b/src/core/SkPipe.h
@@ -0,0 +1,74 @@
+/*
+ * Copyright 2016 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef SkPipe_DEFINED
+#define SkPipe_DEFINED
+
+#include "SkTypes.h"
+
+class SkCanvas;
+class SkImage;
+class SkPicture;
+class SkTypefaceSerializer;
+class SkTypefaceDeserializer;
+class SkWStream;
+
+class SkPipeSerializer {
+public:
+ SkPipeSerializer();
+ ~SkPipeSerializer();
+
+ // Ownership is not transferred, so caller must ceep the serializer alive
hal.canary 2016/09/13 15:52:54 s/ceep/keep/
+ void setTypefaceSerializer(SkTypefaceSerializer*);
+
+ void resetCache();
+
+ void write(SkPicture*, SkWStream*);
+ void write(SkImage*, SkWStream*);
+
+ SkCanvas* beginWrite(const SkRect& cullBounds, SkWStream*);
+ void endWrite();
+
+private:
+ class Impl;
+ std::unique_ptr<Impl> fImpl;
+};
+
+class SkPipeDeserializer {
+public:
+ SkPipeDeserializer();
+ ~SkPipeDeserializer();
+
+ // Ownership is not transferred, so caller must ceep the deserializer alive
+ void setTypefaceDeserializer(SkTypefaceDeserializer*);
+
+ sk_sp<SkPicture> readPicture(const void*, size_t);
+ sk_sp<SkImage> readImage(const void*, size_t);
+ bool playback(const void*, size_t, SkCanvas*);
+
+private:
+ class Impl;
+ std::unique_ptr<Impl> fImpl;
+};
+
+//////////////////////////////////////////////////////////////////////////////////////////////////
+
+class SkTypefaceSerializer {
+public:
+ virtual ~SkTypefaceSerializer() {}
+
+ virtual sk_sp<SkData> serialize(SkTypeface*) = 0;
+};
+
+class SkTypefaceDeserializer {
+public:
+ virtual ~SkTypefaceDeserializer() {}
+
+ virtual sk_sp<SkTypeface> deserialize(const void* data, size_t size) = 0;
+};
+
+#endif
« no previous file with comments | « src/core/SkDeduper.h ('k') | src/core/SkReadBuffer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698