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