Chromium Code Reviews| Index: src/codec/SkSwizzler.h |
| diff --git a/src/codec/SkSwizzler.h b/src/codec/SkSwizzler.h |
| index 691dc77aa6a99f20cc676f7b3f854b8655a060f1..f17b97bd62790c5f3ec484ae50064b9cbd7a3075 100644 |
| --- a/src/codec/SkSwizzler.h |
| +++ b/src/codec/SkSwizzler.h |
| @@ -127,10 +127,15 @@ public: |
| * implementation may choose to skip writing zeroes |
| * if set to kYes_ZeroInitialized. |
| * Contains subset information. |
| + * @param frame Indicates if the source pixels represent an image frame |
| + * that is a subset of the full image. This is subtlely |
| + * different than if the client requests a subset decode, |
|
scroggo
2015/11/17 14:56:26
Maybe explain how it's different? Or where an expl
msarett
2015/11/17 18:00:50
Done.
|
| + * and must be handled differently. |
| * @return A new SkSwizzler or nullptr on failure. |
| */ |
| static SkSwizzler* CreateSwizzler(SrcConfig, const SkPMColor* ctable, |
| - const SkImageInfo& dstInfo, const SkCodec::Options&); |
| + const SkImageInfo& dstInfo, const SkCodec::Options&, |
| + const SkIRect* frame = nullptr); |
| /** |
| * Swizzle a line. Generally this will be called height times, once |
| @@ -151,7 +156,7 @@ public: |
| */ |
| void fill(const SkImageInfo& info, void* dst, size_t rowBytes, uint32_t colorOrIndex, |
| SkCodec::ZeroInitialized zeroInit) override { |
| - const SkImageInfo fillInfo = info.makeWH(fDstWidth, info.height()); |
| + const SkImageInfo fillInfo = info.makeWH(fAllocatedWidth, info.height()); |
| SkSampler::Fill(fillInfo, dst, rowBytes, colorOrIndex, zeroInit); |
| } |
| @@ -178,17 +183,28 @@ private: |
| const SkPMColor* fColorTable; // Unowned pointer |
| 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 fSubsetWidth; // Width of the subset of the source before any sampling. |
| - int fDstWidth; // Width of dst, which may differ with sampling. |
| + const int fDstOffset; // Offset of the dst in pixels, allows the src to be |
|
scroggo
2015/11/17 14:56:26
a* partial frame... ?
msarett
2015/11/17 18:00:50
Acknowledged.
|
| + // partial frame of the dst. |
| + int fSrcOffsetBytes; // Byte offset of the src, takes sampling into account. |
| + int fDstOffsetBytes; // Byte offset of the dst, takes sampling into account. |
| + const int fSrcWidth; // Pixel width of src before any sampling, accounting |
| + // for subset decodes. |
|
scroggo
2015/11/17 14:56:26
When you say "accounting for subset decodes", what
msarett
2015/11/17 18:00:50
Acknowledged.
|
| + const int fDstWidth; // Pixel width of dst before any sampling, accounting |
| + // subset decodes or image frame subsets. |
| + int fSwizzleWidth; // The number of pixels that will be written by the |
| + // RowProc. Scaled version of fSrcWidth. |
| + int fAllocatedWidth; // The pixel width of destination memory. Scaled version |
| + // of fDstWidth. |
| int fSampleX; // step between X samples |
| - const int fBPP; // if bitsPerPixel % 8 == 0 |
| + const int fSrcBPP; // Bits/bytes per pixel for the SrcConfig |
| + // if bitsPerPixel % 8 == 0 |
| // fBPP is bytesPerPixel |
| // else |
| // fBPP is bitsPerPixel |
| + const int fDstBPP; // Bytes per pixel for the destination color type |
| - SkSwizzler(RowProc proc, const SkPMColor* ctable, int srcOffset, int subsetWidth, int bpp); |
| + SkSwizzler(RowProc proc, const SkPMColor* ctable, int srcOffset, int srcWidth, int dstOffset, |
| + int dstWidth, int srcBPP, int dstBPP); |
| int onSetSampleX(int) override; |