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

Unified Diff: src/codec/SkSampler.h

Issue 1997703003: Make SkPngCodec decode progressively. (Closed) Base URL: https://skia.googlesource.com/skia.git@foil
Patch Set: Switch statement for setjmp Created 4 years, 7 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: src/codec/SkSampler.h
diff --git a/src/codec/SkSampler.h b/src/codec/SkSampler.h
index 73e11c986e2949981a4f215678582fdfce060e8c..1a75d482fb7495e6b9c94ea37e5fd8a39fe2be73 100644
--- a/src/codec/SkSampler.h
+++ b/src/codec/SkSampler.h
@@ -21,6 +21,28 @@ 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 Zero-based index into the subset.
+ */
+ bool rowNeeded(int row) const {
+ return row % fSampleY == 0;
msarett 2016/05/24 13:14:07 Is this correct? I think we don't start at row 0.
scroggo 2016/05/24 14:24:50 I believe it's used correctly by SkPngCodec, but i
msarett 2016/05/24 14:28:33 Gotcha thanks.
+ }
+
+ /**
* Fill the remainder of the destination with a single color
*
* @param info
@@ -54,8 +76,13 @@ public:
virtual void fill(const SkImageInfo& info, void* dst, size_t rowBytes,
uint32_t colorOrIndex, SkCodec::ZeroInitialized zeroInit) {}
+ SkSampler()
+ : fSampleY(1)
+ {}
+
virtual ~SkSampler() {}
private:
+ int fSampleY;
virtual int onSetSampleX(int) = 0;
};

Powered by Google App Engine
This is Rietveld 408576698