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

Unified Diff: include/core/SkEncodedFormat.h

Issue 1862133002: Add whitelist parameter to refEncodedData (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Make test pass regardless of CTX build flag Created 4 years, 8 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/SkEncodedFormat.h
diff --git a/include/core/SkEncodedFormat.h b/include/core/SkEncodedFormat.h
new file mode 100644
index 0000000000000000000000000000000000000000..4751c90a8fe7bc2e90b1db788b1cdf039779d686
--- /dev/null
+++ b/include/core/SkEncodedFormat.h
@@ -0,0 +1,51 @@
+/*
+ * Copyright 2015 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef SkEncodedFormat_DEFINED
+#define SkEncodedFormat_DEFINED
+
+/**
+ * Enum describing format of encoded data.
+ */
+enum SkEncodedFormat {
+ kUnknown_SkEncodedFormat,
reed1 2016/04/07 13:27:31 why do we have an unknown value. From the API, its
scroggo_chromium 2016/04/08 18:16:36 This is unchanged. But FWIW, it mirrors how we hav
scroggo_chromium 2016/04/12 14:41:19 Removed until we discover we need it.
+ kBMP_SkEncodedFormat,
+ kGIF_SkEncodedFormat,
+ kICO_SkEncodedFormat,
+ kJPEG_SkEncodedFormat,
+ kPNG_SkEncodedFormat,
+ kWBMP_SkEncodedFormat,
+ kWEBP_SkEncodedFormat,
+ kPKM_SkEncodedFormat, // ETC1
+ kKTX_SkEncodedFormat,
+ kASTC_SkEncodedFormat,
+ kDNG_SkEncodedFormat,
+};
+
+class SkEncodedFormatQuery {
reed1 2016/04/07 13:27:31 may need a block comment summarizing why we have t
scroggo_chromium 2016/04/08 18:16:36 Acknowledged.
scroggo_chromium 2016/04/12 14:41:19 I've moved this class into SkImageGenerator. I don
+public:
+ virtual ~SkEncodedFormatQuery() {}
+
+ /**
+ * Returns true if the specified format is supported.
reed1 2016/04/07 13:27:31 ... supported where/how?
scroggo_chromium 2016/04/08 18:16:36 Acknowledged.
+ */
+ virtual bool supportedFormat(SkEncodedFormat) = 0;
+
+ /**
+ * Given the beginning of an encoded image, returns true if that format is supported.
+ *
+ * @param data points to the beginning of the encoded image.
+ *
+ * @param length The number of bytes available to read. It need not be the entire image,
+ * but if it is too small to make a format determination, the query may return
+ * false where if given more data, it might have returned true.
+ */
+ virtual bool supportedFormatFromData(const void* data, size_t length) = 0;
reed1 2016/04/07 13:27:31 Not sure what supported means here. "I can encode
scroggo_chromium 2016/04/08 18:16:36 Acknowledged.
scroggo_chromium 2016/04/12 14:41:19 This version has been removed from the new class.
+};
+
+
+#endif // SkEncodedFormat_DEFINED

Powered by Google App Engine
This is Rietveld 408576698