OLD | NEW |
(Empty) | |
| 1 /* |
| 2 * Copyright 2015 Google Inc. |
| 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. |
| 6 */ |
| 7 |
| 8 #include "SkBmpCodec.h" |
| 9 #include "SkImageInfo.h" |
| 10 #include "SkMaskSwizzler.h" |
| 11 #include "SkTypes.h" |
| 12 |
| 13 /* |
| 14 * This class implements the decoding for bmp images using bit masks |
| 15 */ |
| 16 class SkBmpMaskCodec : public SkBmpCodec { |
| 17 public: |
| 18 |
| 19 /* |
| 20 * Creates an instance of the decoder |
| 21 * |
| 22 * Called only by SkBmpCodec::NewFromStream |
| 23 * There should be no other callers despite this being public |
| 24 * |
| 25 * @param srcInfo contains the source width and height |
| 26 * @param stream the stream of encoded image data |
| 27 * @param bitsPerPixel the number of bits used to store each pixel |
| 28 * @param masks color masks for certain bmp formats |
| 29 * @param rowOrder indicates whether rows are ordered top-down or bottom-up |
| 30 */ |
| 31 SkBmpMaskCodec(const SkImageInfo& srcInfo, SkStream* stream, |
| 32 uint16_t bitsPerPixel, SkMasks* masks, RowOrder rowOrder); |
| 33 |
| 34 protected: |
| 35 |
| 36 Result onGetPixels(const SkImageInfo& dstInfo, void* dst, |
| 37 size_t dstRowBytes, const Options&, SkPMColor*, |
| 38 int*) override; |
| 39 |
| 40 private: |
| 41 |
| 42 bool initializeSwizzler(const SkImageInfo& dstInfo); |
| 43 |
| 44 Result decode(const SkImageInfo& dstInfo, void* dst, size_t dstRowBytes, |
| 45 const Options& opts); |
| 46 |
| 47 SkAutoTDelete<SkMasks> fMasks; // owned |
| 48 SkAutoTDelete<SkMaskSwizzler> fMaskSwizzler; |
| 49 SkAutoTDeleteArray<uint8_t> fSrcBuffer; |
| 50 |
| 51 typedef SkBmpCodec INHERITED; |
| 52 }; |
OLD | NEW |