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

Unified Diff: src/codec/SkSampler.h

Issue 1997703003: Make SkPngCodec decode progressively. (Closed) Base URL: https://skia.googlesource.com/skia.git@foil
Patch Set: Rebase 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/codec/SkSampledCodec.cpp ('k') | tests/CodecPartialTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/codec/SkSampler.h
diff --git a/src/codec/SkSampler.h b/src/codec/SkSampler.h
index b233c32be22942577fb4502c7e722662417c2b82..00015585a11dda1fcf74e9ecc02ad9bec7f58662 100644
--- a/src/codec/SkSampler.h
+++ b/src/codec/SkSampler.h
@@ -21,6 +21,30 @@ public:
}
/**
+ * Update the sampler to sample every sampleY'th row.
+ */
+ void setSampleY(int sampleY) {
+ fSampleY = sampleY;
+ }
+
+ /**
+ * Retrieve the value set for sampleY.
+ */
+ int sampleY() const {
+ return fSampleY;
+ }
+
+ /**
+ * Based on fSampleY, return whether this row belongs in the output.
+ *
+ * @param row Row of the image, starting with the first row used in the
+ * output.
+ */
+ bool rowNeeded(int row) const {
+ return row % fSampleY == 0;
+ }
+
+ /**
* Fill the remainder of the destination with a single color
*
* @param info
@@ -55,8 +79,13 @@ public:
virtual void fill(const SkImageInfo& info, void* dst, size_t rowBytes,
uint64_t colorOrIndex, SkCodec::ZeroInitialized zeroInit) {}
+ SkSampler()
+ : fSampleY(1)
+ {}
+
virtual ~SkSampler() {}
private:
+ int fSampleY;
virtual int onSetSampleX(int) = 0;
};
« no previous file with comments | « src/codec/SkSampledCodec.cpp ('k') | tests/CodecPartialTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698