Chromium Code Reviews| Index: src/codec/SkBmpCodec.h |
| diff --git a/src/codec/SkBmpCodec.h b/src/codec/SkBmpCodec.h |
| index 71006f73153ea3028529b0c51daa999b498bc86e..dfa5a3c0a2167174ef6465bfaa108547dab4c676 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,19 @@ protected: |
| } |
| /* |
| + * Get the destination row number corresponsing to the encoded row number. |
|
scroggo
2015/08/27 20:14:22
corresponding*
msarett
2015/08/27 21:21:46
Sorry. Fixed!
|
| + * For kTopDown, we simply return y, but for kBottomUp, the rows will be |
| + * decoded in reverse order. |
| + * |
| + * @param y Iterates from 0 to height, indicating the current row. |
| + * @param height The height of the current subset of the image that we are |
| + * decoding. This is generally equal to the full height |
| + * when we want to decode the full or one when we are |
| + * sampling. |
| + */ |
| + int32_t getDstRow(int32_t y, int32_t 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, |
| @@ -96,6 +117,24 @@ protected: |
| uint16_t bitsPerPixel() const { return fBitsPerPixel; } |
| RowOrder rowOrder() const { return fRowOrder; } |
| + /* |
| + * To be overriden by bmp subclasses, which provide unique implementations. |
| + * Performs subclass specific setup. |
| + * |
| + * @param dstInfo Contains output information. Height specifies |
| + * the total number of rows that can be decoded. |
|
scroggo
2015/08/27 20:14:23
will be decoded?
msarett
2015/08/27 21:21:46
Done.
|
| + * @param optoins Additonal options to pass to the decoder. |
|
scroggo
2015/08/27 20:14:23
options*
msarett
2015/08/27 21:21:46
Done.
|
| + * @param inputColorPtr Client provides memory for a color table. This |
|
scroggo
2015/08/27 20:14:22
Maybe this should be
Client-provided memory for a
msarett
2015/08/27 21:21:46
Done.
|
| + * will be populated with colors if the encoded |
| + * image uses a color table. |
| + * @param inputColorCount If the encoded image uses a color table, this |
| + * will be set to the number of colors in the |
| + * color table. |
| + */ |
| + virtual SkCodec::Result prepareToDecode(const SkImageInfo& dstInfo, |
| + const SkCodec::Options& options, SkPMColor inputColorPtr[], |
| + int* inputColorCount) = 0; |
| + |
| private: |
| /* |
| @@ -104,8 +143,27 @@ private: |
| */ |
| static SkCodec* NewFromStream(SkStream*, bool inIco); |
| - const uint16_t fBitsPerPixel; |
| - const RowOrder fRowOrder; |
| + /* |
| + * 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 decodeRows(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; |
| }; |