Chromium Code Reviews| Index: src/codec/SkBmpStandardCodec.h |
| diff --git a/src/codec/SkBmpStandardCodec.h b/src/codec/SkBmpStandardCodec.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..904784a9f23883da542caac6a89700398fd3cd80 |
| --- /dev/null |
| +++ b/src/codec/SkBmpStandardCodec.h |
| @@ -0,0 +1,68 @@ |
| +/* |
| + * Copyright 2015 Google Inc. |
| + * |
| + * Use of this source code is governed by a BSD-style license that can be |
| + * found in the LICENSE file. |
| + */ |
| + |
| +#include "SkBmpCodec.h" |
| +#include "SkColorTable.h" |
| +#include "SkImageInfo.h" |
| +#include "SkSwizzler.h" |
| +#include "SkTypes.h" |
| + |
| +/* |
| + * This class implements the decoding for bmp images that use "standard" modes, |
| + * which essentially means they do not contain bit masks or RLE codes. |
| + */ |
| +class SkBmpStandardCodec : public SkBmpCodec { |
| +public: |
| + |
| + /* |
| + * Creates an instance of the decoder |
| + * Called only by SkBmpCodec::NewFromStream |
| + * |
| + * @param srcInfo contains the source width and height |
| + * @param stream the stream of image data |
| + * @param bitsPerPixel the number of bits used to store each pixel |
| + * @param format the format of the bmp file |
| + * @param numColors the number of colors in the color table |
| + * @param bytesPerColor the number of bytes in the stream used to represent |
| + each color in the color table |
| + * @param offset the offset of the image pixel data from the end of the |
| + * headers |
| + * @param rowOrder indicates whether rows are ordered top-down or bottom-up |
|
scroggo
2015/08/04 16:16:47
@param isIco Whether this is part of an ICO image.
msarett
2015/08/04 23:14:45
Agreed
|
| + */ |
| + SkBmpStandardCodec(const SkImageInfo& srcInfo, SkStream* stream, |
| + uint16_t bitsPerPixel, uint32_t numColors, uint32_t bytesPerColor, |
| + uint32_t offset, SkBmpCodec::RowOrder rowOrder, bool isIco); |
| + |
| +protected: |
| + |
| + Result onGetPixels(const SkImageInfo& dstInfo, void* dst, |
| + size_t dstRowBytes, const Options&, SkPMColor*, |
| + int*) override; |
| + |
| +private: |
| + |
| + /* |
| + * Creates the color table |
| + * Sets colorCount to the new color count if it is non-NULL |
| + */ |
| + bool createColorTable(SkAlphaType alphaType, int* colorCount); |
|
msarett
2015/08/03 22:52:36
Used to be in SkBmpCodec. Simplified given that w
|
| + |
| + bool initializeSwizzler(const SkImageInfo& dstInfo, const Options& opts); |
|
msarett
2015/08/03 22:52:36
Factored out of decode() in SkBmpCodec. Will be u
|
| + |
| + Result decode(const SkImageInfo& dstInfo, void* dst, size_t dstRowBytes, const Options& opts); |
|
msarett
2015/08/03 22:52:36
Used to be decode() in SkBmpCodec.
|
| + |
| + SkAutoTUnref<SkColorTable> fColorTable; // owned |
| + uint32_t fNumColors; |
| + const uint32_t fBytesPerColor; |
| + const uint32_t fOffset; |
| + SkAutoTDelete<SkSwizzler> fSwizzler; |
| + SkAutoTDeleteArray<uint8_t> fSrcBuffer; |
| + const bool fIsIco; |
|
scroggo
2015/08/04 16:16:47
So, if I understand correctly, only standard BMPs
msarett
2015/08/04 23:14:45
You understand correctly. I will add checks for t
|
| + bool fIsTransparent; |
| + |
| + typedef SkBmpCodec INHERITED; |
| +}; |