Chromium Code Reviews| Index: src/codec/SkBmpCodec.h |
| diff --git a/src/codec/SkBmpCodec.h b/src/codec/SkBmpCodec.h |
| index 71006f73153ea3028529b0c51daa999b498bc86e..17973490fea06e31fe4b16137a0d4449c8f028ec 100644 |
| --- a/src/codec/SkBmpCodec.h |
| +++ b/src/codec/SkBmpCodec.h |
| @@ -11,6 +11,7 @@ |
| #include "SkColorTable.h" |
| #include "SkImageInfo.h" |
| #include "SkMaskSwizzler.h" |
| +#include "SkScanlineDecoder.h" |
| #include "SkStream.h" |
| #include "SkSwizzler.h" |
| #include "SkTypes.h" |
| @@ -48,6 +49,13 @@ public: |
| */ |
| static SkCodec* NewFromIco(SkStream*); |
| + /* |
| + * Assumes IsBmp was called and returned true |
| + * Creates a bmp scanline decoder |
| + * Takes ownership of the stream |
| + */ |
| + static SkScanlineDecoder* NewSDFromStream(SkStream* stream); |
| + |
| protected: |
| SkBmpCodec(const SkImageInfo& info, SkStream* stream, uint16_t bitsPerPixel, |
| @@ -77,6 +85,13 @@ protected: |
| } |
| /* |
| + * Get the destination row number corresponsing to the encoded row number. |
| + * For kTopDown, we simply return y, but for kBottomUp, the rows will be |
| + * decoded in reverse order. |
| + */ |
| + int32_t getDstRow(int32_t y, int32_t height); |
|
scroggo
2015/08/26 22:40:09
Can you explain what height means? I suppose it is
msarett
2015/08/27 15:00:27
Adding comments. It used to mean the full height
|
| + |
| + /* |
| * Get the destination row to start filling from |
| * Used to fill the remainder of the image on incomplete input for bmps |
| * This is tricky since bmps may be kTopDown or kBottomUp. For kTopDown, |
| @@ -104,8 +119,35 @@ private: |
| */ |
| static SkCodec* NewFromStream(SkStream*, bool inIco); |
| - const uint16_t fBitsPerPixel; |
| - const RowOrder fRowOrder; |
| + /* |
| + * To be overriden by bmp subclasses, which provide unique implementations. |
| + * Performs subclass specific setup. |
| + */ |
| + virtual SkCodec::Result prepareToDecode(const SkImageInfo& dstInfo, |
| + const SkCodec::Options& options, SkPMColor inputColorPtr[], |
| + int* inputColorCount) = 0; |
| + |
| + /* |
| + * Decodes the next dstInfo.height() lines. |
| + * |
| + * onGetPixels() uses this for full image decodes. |
| + * SkScaledCodec::onGetPixels() uses the scanline decoder to call this with |
| + * dstInfo.height() = 1, in order to implement sampling. |
| + * A potential future use is to allow the caller to decode a subset of the |
| + * lines in the image. |
| + * |
| + * @param dstInfo Contains output information. Height specifies the |
| + * number of rows to decode at this time. |
| + * @param dst Memory location to store output pixels |
| + * @param dstRowBytes Bytes in a row of the destination |
| + */ |
| + virtual Result decode(const SkImageInfo& dstInfo, void* dst, size_t dstRowBytes, |
| + const Options& opts) = 0; |
| + |
| + const uint16_t fBitsPerPixel; |
| + const RowOrder fRowOrder; |
| + |
| + friend class SkBmpScanlineDecoder; |
| typedef SkCodec INHERITED; |
| }; |