Chromium Code Reviews| Index: src/codec/SkBmpCodec.h |
| diff --git a/src/codec/SkBmpCodec.h b/src/codec/SkBmpCodec.h |
| index 71006f73153ea3028529b0c51daa999b498bc86e..b3cd40fa997883a23a17d7cf4633e0b5c1a3c4ff 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" |
| @@ -31,6 +32,16 @@ public: |
| }; |
| /* |
| + * Used to define the input format of the bmp |
| + */ |
| + enum BmpInputFormat { |
| + kStandard_BmpInputFormat, |
| + kRLE_BmpInputFormat, |
| + kBitMask_BmpInputFormat, |
| + kUnknown_BmpInputFormat |
| + }; |
| + |
| + /* |
| * Checks the start of the stream to see if the image is a bmp |
| */ |
| static bool IsBmp(SkStream*); |
| @@ -48,10 +59,17 @@ 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, |
| - RowOrder rowOrder); |
| + SkBmpCodec(const SkImageInfo& info, SkStream* stream, BmpInputFormat inputFormat, |
| + uint16_t bitsPerPixel, RowOrder rowOrder); |
| SkEncodedFormat onGetEncodedFormat() const override { return kBMP_SkEncodedFormat; } |
| @@ -104,8 +122,24 @@ private: |
| */ |
| static SkCodec* NewFromStream(SkStream*, bool inIco); |
| - const uint16_t fBitsPerPixel; |
| - const RowOrder fRowOrder; |
| + /* |
| + * Allow to BmpCodec subclasses to implement unique onStart() functions |
|
scroggo
2015/08/14 21:53:00
Maybe mention that this relates to scanline decodi
msarett
2015/08/17 19:16:13
This is now shared with onGetPixels().
|
| + */ |
| + virtual SkCodec::Result onStart(const SkImageInfo& dstInfo, const SkCodec::Options& options, |
|
scroggo
2015/08/14 21:53:01
I do not know whether it's good or bad that this s
msarett
2015/08/17 19:16:13
I think it makes sense to change the name because
|
| + SkPMColor inputColorPtr[], int* inputColorCount) = 0; |
| + |
| + /* |
| + * Performs the row by row decode |
| + * Unique for each of the bmp subclasses |
| + */ |
| + virtual Result decode(const SkImageInfo& dstInfo, void* dst, size_t dstRowBytes, |
|
scroggo
2015/08/14 21:53:01
Can you add a description for these parameters? I
msarett
2015/08/17 19:16:13
Yeah I'm adding comments, this is awkward. Ideall
|
| + const Options& opts) = 0; |
| + |
| + const BmpInputFormat fInputFormat; |
| + const uint16_t fBitsPerPixel; |
| + const RowOrder fRowOrder; |
| + |
| + friend class SkBmpScanlineDecoder; |
| typedef SkCodec INHERITED; |
| }; |