Chromium Code Reviews| Index: src/codec/SkBmpMaskCodec.h |
| diff --git a/src/codec/SkBmpMaskCodec.h b/src/codec/SkBmpMaskCodec.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..a771b5c9325cec6d83567f56489ffd2668b6460a |
| --- /dev/null |
| +++ b/src/codec/SkBmpMaskCodec.h |
| @@ -0,0 +1,51 @@ |
| +/* |
| + * 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 "SkImageInfo.h" |
| +#include "SkMaskSwizzler.h" |
| +#include "SkTypes.h" |
| + |
| +/* |
| + * This class implements the decoding for bmp images using bit masks |
| + */ |
| +class SkBmpMaskCodec : 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 masks color masks for certain bmp formats |
| + * @param rowOrder indicates whether rows are ordered top-down or bottom-up |
| + */ |
| + SkBmpMaskCodec(const SkImageInfo& srcInfo, SkStream* stream, |
| + uint16_t bitsPerPixel, SkMasks* masks, RowOrder rowOrder); |
| + |
| +protected: |
| + |
| + Result onGetPixels(const SkImageInfo& dstInfo, void* dst, |
| + size_t dstRowBytes, const Options&, SkPMColor*, |
| + int*) override; |
| + |
| +private: |
| + |
| + bool initializeSwizzler(const SkImageInfo& dstInfo); |
|
msarett
2015/08/03 22:52:36
Creation of the swizzler has been factored out of
|
| + |
| + Result decode(const SkImageInfo& dstInfo, void* dst, size_t dstRowBytes, |
|
msarett
2015/08/03 22:52:36
This used to be decodeMask() in SkBmpCodec.
|
| + const Options& opts); |
| + |
| + SkAutoTDelete<SkMasks> fMasks; // owned |
| + SkAutoTDelete<SkMaskSwizzler> fMaskSwizzler; |
| + SkAutoTDeleteArray<uint8_t> fSrcBuffer; |
| + bool fIsTransparent; |
| + |
| + typedef SkBmpCodec INHERITED; |
| +}; |