Index: src/codec/SkSampler.h |
diff --git a/src/codec/SkSampler.h b/src/codec/SkSampler.h |
index d7b4c98f235ad1ccb15afa7ff77997aa6d621372..dcbb53f48b184b5f3ababcc1e4eb19c6ac21fbb5 100644 |
--- a/src/codec/SkSampler.h |
+++ b/src/codec/SkSampler.h |
@@ -19,8 +19,62 @@ public: |
return this->onSetSampleX(sampleX); |
} |
+ /** |
+ * 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(); |
+ } |
+ |
+ /** |
+ * 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 width |
+ * The width of the destination 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. |
+ * |
+ */ |
+ static void Fill(void* dst, SkColorType colorType, int width, int numRows, size_t rowBytes, |
+ uint32_t colorOrIndex, SkCodec::ZeroInitialized zeroInit); |
+ |
+ /** |
+ * Alternate version of fill where the sampler provides the scaled width. |
+ */ |
+ void fill(void* dst, SkColorType colorType, int numRows, size_t rowBytes, uint32_t colorOrIndex, |
+ SkCodec::ZeroInitialized zeroInit) { |
+ int width = this->onGetScaledWidth(); |
+ Fill(dst, colorType, width, numRows, rowBytes, colorOrIndex, zeroInit); |
+ } |
+ |
virtual ~SkSampler() {} |
private: |
+ |
+ virtual int onGetScaledWidth() = 0; |
+ |
virtual int onSetSampleX(int) = 0; |
}; |