Index: src/codec/SkSwizzler.h |
diff --git a/src/codec/SkSwizzler.h b/src/codec/SkSwizzler.h |
index aacbadf1788d02e18beef8f78389e3aa81e8a896..60239a7b6af123b5198a77390d0fc44e92fbde35 100644 |
--- a/src/codec/SkSwizzler.h |
+++ b/src/codec/SkSwizzler.h |
@@ -124,10 +124,20 @@ public: |
* @param ZeroInitialized Whether dst is zero-initialized. The |
* implementation may choose to skip writing zeroes |
* if set to kYes_ZeroInitialized. |
+ * @param srcInfo is the info of the source. Used to calculate the width samplesize. |
+ * Width sampling is supported by the swizzler, by skipping pixels when |
+ * swizzling the row. Height sampling is not supported by the swizzler, |
+ * but is implemented in SkScaledCodec. |
+ * Sampling in Y can be done by a client with a scanline decoder, |
+ * but sampling in X allows the swizzler to skip swizzling pixels and |
+ * reading from and writing to memory. |
+ * @param subsetLeft the left offset on the src for each row swizzle. |
+ * @param subsetWidth the width of each swizzle in destination pixels. |
* @return A new SkSwizzler or nullptr on failure. |
*/ |
static SkSwizzler* CreateSwizzler(SrcConfig, const SkPMColor* ctable, |
- const SkImageInfo& dstInfo, SkCodec::ZeroInitialized); |
+ const SkImageInfo& dstInfo, SkCodec::ZeroInitialized, |
+ int subsetLeft, int subsetWidth); |
/** |
* Swizzle a line. Generally this will be called height times, once |
@@ -164,16 +174,19 @@ private: |
const RowProc fRowProc; |
const SkPMColor* fColorTable; // Unowned pointer |
- const int fDeltaSrc; // if bitsPerPixel % 8 == 0 |
- // deltaSrc is bytesPerPixel |
- // else |
- // deltaSrc is bitsPerPixel |
+ const int fSrcOffset; // Offset of the src in pixels, allows for partial |
+ // scanline decodes. |
+ int fX0; // Start coordinate for the src, may be different than |
+ // fSrcOffset if we are sampling. |
const int fSrcWidth; // Width of the source - i.e. before any sampling. |
int fDstWidth; // Width of dst, which may differ with sampling. |
- int fX0; // first X coord to sample |
int fSampleX; // step between X samples |
+ const int fBPP; // if bitsPerPixel % 8 == 0 |
+ // fBPP is bytesPerPixel |
+ // else |
+ // fBPP is bitsPerPixel |
- SkSwizzler(RowProc proc, const SkPMColor* ctable, int deltaSrc, int srcWidth); |
+ SkSwizzler(RowProc proc, const SkPMColor* ctable, int srcOffset, int srcWidth, int bpp); |
int onSetSampleX(int) override; |