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

Unified Diff: src/codec/SkSampler.h

Issue 1332053002: Fill incomplete images in SkCodec parent class (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Forgot to add SkSampler.cpp Created 5 years, 2 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 d7b4c98f235ad1ccb15afa7ff77997aa6d621372..1e7659e9e8623aade960dc388baec4ce09ebb51e 100644
--- a/src/codec/SkSampler.h
+++ b/src/codec/SkSampler.h
@@ -19,8 +19,49 @@ public:
return this->onSetSampleX(sampleX);
}
+ /**
+ * Fill the remainder of the destination with a single color
+ *
+ * @param dst
+ * The destination row to fill from.
+ *
+ * @param colorType
+ * The color type of the rows to fill.
+ *
+ * @param numRows
+ * The number of rows that we need to fill.
+ *
+ * @param rowBytes
+ * Stride in bytes of the destination.
+ *
+ * @param colorOrIndex
+ * If colorType is kN32, colorOrIndex is treated as a 32-bit color.
+ * If colorType is k565, colorOrIndex is treated as a 16-bit color.
+ * If colorType is kGray, colorOrIndex is treated as an 8-bit color.
+ * If colorType is kIndex, colorOrIndex is treated as an 8-bit index.
+ * Other SkColorTypes are not supported.
+ *
+ * @param zeroInit
+ * Indicates whether memory is already zero initialized.
+ *
+ */
+ void fill(void* dst, SkColorType colorType, int numRows, size_t rowBytes, uint32_t colorOrIndex,
+ SkCodec::ZeroInitialized zeroInit);
+
virtual ~SkSampler() {}
private:
+ /**
+ * Get the the scaled width of the image.
+ *
+ * SkSampler needs the scaled width to fill uninitialized memory in
+ * incomplete images.
+ */
+ int getScaledWidth() {
+ return this->onGetScaledWidth();
+ }
+
+ virtual int onGetScaledWidth() = 0;
+
virtual int onSetSampleX(int) = 0;
};

Powered by Google App Engine
This is Rietveld 408576698