diff options
author | msarett <msarett@google.com> | 2015-08-06 15:34:42 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-08-06 15:34:42 -0700 |
commit | 4ab9d5f1bc6d05c49dc765c3de5ade816f4c968e (patch) | |
tree | ecab1b0e6d12a892197f81a89b3bd1df3e0e7a58 /src/codec/SkBmpMaskCodec.h | |
parent | 74992b579422a5e31fa07705d1f9206e0d919706 (diff) |
Split SkBmpCodec into three separate classes
Will regress behavior on gold on test32bfv4.bmp, where we
will no longer fix transparent decodes.
TODO: Start fixing transparent decodes again, or decide
that we don't want to fix them and remove isTransparent
from SkSwizzler. I think this may become more clear when I
start implementing the scanline decoder.
BUG=skia:
Review URL: https://codereview.chromium.org/1258863008
Diffstat (limited to 'src/codec/SkBmpMaskCodec.h')
-rw-r--r-- | src/codec/SkBmpMaskCodec.h | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/src/codec/SkBmpMaskCodec.h b/src/codec/SkBmpMaskCodec.h new file mode 100644 index 0000000000..6f43bb3f85 --- /dev/null +++ b/src/codec/SkBmpMaskCodec.h @@ -0,0 +1,52 @@ +/* + * 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 + * There should be no other callers despite this being public + * + * @param srcInfo contains the source width and height + * @param stream the stream of encoded 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); + + Result decode(const SkImageInfo& dstInfo, void* dst, size_t dstRowBytes, + const Options& opts); + + SkAutoTDelete<SkMasks> fMasks; // owned + SkAutoTDelete<SkMaskSwizzler> fMaskSwizzler; + SkAutoTDeleteArray<uint8_t> fSrcBuffer; + + typedef SkBmpCodec INHERITED; +}; |