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

Unified Diff: include/core/SkImageDeserializer.h

Issue 2187613002: Deserialize pictures with custom image-deserializer (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix legacy case, remove null-check 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
« no previous file with comments | « no previous file | include/core/SkPicture.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/core/SkImageDeserializer.h
diff --git a/include/core/SkImageDeserializer.h b/include/core/SkImageDeserializer.h
new file mode 100644
index 0000000000000000000000000000000000000000..ba1422647b37c33da4465fe83a5507a227f25c27
--- /dev/null
+++ b/include/core/SkImageDeserializer.h
@@ -0,0 +1,36 @@
+/*
+ * 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 SkImageDeserializer_DEFINED
+#define SkImageDeserializer_DEFINED
+
+#include "SkRefCnt.h"
+
+struct SkIRect;
+class SkData;
+class SkImage;
+
+class SK_API SkImageDeserializer {
+public:
+ virtual ~SkImageDeserializer() {}
+
+ /**
+ * Given a data containing serialized content, return an SkImage from it.
+ *
+ * @param data The data containing the encoded image. The subclass may ref this for later
+ * decoding, or read it and process it immediately.
+ * @param subset Optional rectangle represent the subset of the encoded data that is being
+ * requested to be turned into an image.
+ * @return The new image, or nullptr on failure.
+ *
+ * The default implementation is to call SkImage::MakeFromEncoded(...)
+ */
+ virtual sk_sp<SkImage> makeFromData(SkData*, const SkIRect* subset);
+ virtual sk_sp<SkImage> makeFromMemory(const void* data, size_t length, const SkIRect* subset);
+};
+
+#endif
« no previous file with comments | « no previous file | include/core/SkPicture.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698