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

Unified Diff: include/codec/SkScanlineDecoder.h

Issue 1260673002: SkScaledCodec class (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Use SkTAbs, update comments Created 5 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/codec/SkScanlineDecoder.h
diff --git a/include/codec/SkScanlineDecoder.h b/include/codec/SkScanlineDecoder.h
index 8376e57c09d84bb48c1d7ae295ccd441a7feab48..3854f05a7118397ef6a9795b9c554d8a2ef044f6 100644
--- a/include/codec/SkScanlineDecoder.h
+++ b/include/codec/SkScanlineDecoder.h
@@ -75,6 +75,18 @@ public:
return this->onReallyHasAlpha();
}
+ /**
+ * returns true if the image must be scaled, in the y direction, after reading, not during.
+ * To scale afterwards, we first decode every line and then sample the lines we want afterwards.
+ * An example is interlaced pngs, where calling getScanlines once (regardless of the count
+ * used) needs to read the entire image, therefore it is inefficient to call
+ * getScanlines more than once. Instead, it should only ever be called with all the
+ * rows needed.
+ */
+ bool requiresPostYSampling() {
+ return this->onRequiresPostYSampling();
+ }
+
protected:
SkScanlineDecoder(const SkImageInfo& requested)
: fDstInfo(requested)
@@ -82,6 +94,12 @@ protected:
virtual bool onReallyHasAlpha() const { return false; }
+ /**
+ * returns true if the image type is hard to sample and must be scaled after reading, not during
+ * An example is interlaced pngs, where the entire image must be read for each decode
+ */
+ virtual bool onRequiresPostYSampling() { return false; }
+
const SkImageInfo& dstInfo() const { return fDstInfo; }
private:

Powered by Google App Engine
This is Rietveld 408576698