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

Unified Diff: include/codec/SkCodec.h

Issue 1240143002: Add the ability to decode a subset to SkCodec. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix some conversion warning/errors. Created 5 years, 5 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 | « dm/DMSrcSink.cpp ('k') | src/codec/SkCodec_libbmp.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/codec/SkCodec.h
diff --git a/include/codec/SkCodec.h b/include/codec/SkCodec.h
index cc635e012ca82bd2c11839ab10fe51ab5f9625a7..1cdc88d4adcfc0dc4e028913348dd21c287e50e7 100644
--- a/include/codec/SkCodec.h
+++ b/include/codec/SkCodec.h
@@ -58,6 +58,25 @@ public:
}
/**
+ * Return (via desiredSubset) a subset which can decoded from this codec,
+ * or false if this codec cannot decode subsets or anything similar to
+ * desiredSubset.
+ *
+ * @param desiredSubset In/out parameter. As input, a desired subset of
+ * the original bounds (as specified by getInfo). If true is returned,
+ * desiredSubset may have been modified to a subset which is
+ * supported. Although a particular change may have been made to
+ * desiredSubset to create something supported, it is possible other
+ * changes could result in a valid subset.
+ * If false is returned, desiredSubset's value is undefined.
+ * @return true if this codec supports decoding desiredSubset (as
+ * returned, potentially modified)
+ */
+ bool getValidSubset(SkIRect* desiredSubset) const {
+ return this->onGetValidSubset(desiredSubset);
+ }
+
+ /**
* Format of the encoded data.
*/
SkEncodedFormat getEncodedFormat() const { return this->onGetEncodedFormat(); }
@@ -128,9 +147,20 @@ public:
*/
struct Options {
Options()
- : fZeroInitialized(kNo_ZeroInitialized) {}
+ : fZeroInitialized(kNo_ZeroInitialized)
+ , fSubset(NULL)
+ {}
ZeroInitialized fZeroInitialized;
+ /**
+ * If not NULL, represents a subset of the original image to decode.
+ *
+ * Must be within the bounds returned by getInfo().
+ *
+ * If the EncodedFormat is kWEBP_SkEncodedFormat (the only one which
+ * currently supports subsets), the top and left values must be even.
+ */
+ SkIRect* fSubset;
};
/**
@@ -228,6 +258,11 @@ protected:
void* pixels, size_t rowBytes, const Options&,
SkPMColor ctable[], int* ctableCount) = 0;
+ virtual bool onGetValidSubset(SkIRect* /* desiredSubset */) const {
+ // By default, subsets are not supported.
+ return false;
+ }
+
/**
* Override if your codec supports scanline decoding.
*
« no previous file with comments | « dm/DMSrcSink.cpp ('k') | src/codec/SkCodec_libbmp.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698