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 "SkColorTable.h" | 9 #include "SkColorTable.h" |
10 #include "SkImageInfo.h" | 10 #include "SkImageInfo.h" |
11 #include "SkSwizzler.h" | 11 #include "SkSwizzler.h" |
12 #include "SkTypes.h" | 12 #include "SkTypes.h" |
13 | 13 |
14 /* | 14 /* |
15 * This class implements the decoding for bmp images that use "standard" modes, | 15 * This class implements the decoding for bmp images that use "standard" modes, |
16 * which essentially means they do not contain bit masks or RLE codes. | 16 * which essentially means they do not contain bit masks or RLE codes. |
17 */ | 17 */ |
18 class SkBmpStandardCodec : public SkBmpCodec { | 18 class SkBmpStandardCodec : public SkBmpCodec { |
19 public: | 19 public: |
20 | 20 |
21 /* | 21 /* |
22 * Creates an instance of the decoder | 22 * Creates an instance of the decoder |
23 * | 23 * |
24 * Called only by SkBmpCodec::NewFromStream | 24 * Called only by SkBmpCodec::NewFromStream |
25 * There should be no other callers despite this being public | 25 * There should be no other callers despite this being public |
26 * | 26 * |
27 * @param srcInfo contains the source width and height | 27 * @param info contains the source width and height |
28 * @param stream the stream of encoded image data | 28 * @param stream the stream of encoded image data |
29 * @param bitsPerPixel the number of bits used to store each pixel | 29 * @param bitsPerPixel the number of bits used to store each pixel |
30 * @param numColors the number of colors in the color table | 30 * @param numColors the number of colors in the color table |
31 * @param bytesPerColor the number of bytes in the stream used to represent | 31 * @param bytesPerColor the number of bytes in the stream used to represent |
32 each color in the color table | 32 each color in the color table |
33 * @param offset the offset of the image pixel data from the end of the | 33 * @param offset the offset of the image pixel data from the end of the |
34 * headers | 34 * headers |
35 * @param rowOrder indicates whether rows are ordered top-down or bottom-up | 35 * @param rowOrder indicates whether rows are ordered top-down or bottom-up |
36 * @param isOpaque indicates if the bmp itself is opaque (before applying | 36 * @param isOpaque indicates if the bmp itself is opaque (before applying |
37 * the icp mask, if there is one) | 37 * the icp mask, if there is one) |
38 * @param inIco indicates if the bmp is embedded in an ico file | 38 * @param inIco indicates if the bmp is embedded in an ico file |
39 */ | 39 */ |
40 SkBmpStandardCodec(const SkImageInfo& srcInfo, SkStream* stream, | 40 SkBmpStandardCodec(const SkEncodedInfo& info, SkStream* stream, |
41 uint16_t bitsPerPixel, uint32_t numColors, uint32_t bytesPerColor, | 41 uint16_t bitsPerPixel, uint32_t numColors, uint32_t bytesPerColor, |
42 uint32_t offset, SkCodec::SkScanlineOrder rowOrder, bool isOpaque, | 42 uint32_t offset, SkCodec::SkScanlineOrder rowOrder, bool isOpaque, |
43 bool inIco); | 43 bool inIco); |
44 | 44 |
45 protected: | 45 protected: |
46 | 46 |
47 Result onGetPixels(const SkImageInfo& dstInfo, void* dst, | 47 Result onGetPixels(const SkImageInfo& dstInfo, void* dst, |
48 size_t dstRowBytes, const Options&, SkPMColor*, | 48 size_t dstRowBytes, const Options&, SkPMColor*, |
49 int*, int*) override; | 49 int*, int*) override; |
50 | 50 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 const uint32_t fBytesPerColor; | 90 const uint32_t fBytesPerColor; |
91 const uint32_t fOffset; | 91 const uint32_t fOffset; |
92 SkAutoTDelete<SkSwizzler> fSwizzler; | 92 SkAutoTDelete<SkSwizzler> fSwizzler; |
93 SkAutoTDeleteArray<uint8_t> fSrcBuffer; | 93 SkAutoTDeleteArray<uint8_t> fSrcBuffer; |
94 const bool fIsOpaque; | 94 const bool fIsOpaque; |
95 const bool fInIco; | 95 const bool fInIco; |
96 const size_t fAndMaskRowBytes; // only used for fInIc
o decodes | 96 const size_t fAndMaskRowBytes; // only used for fInIc
o decodes |
97 | 97 |
98 typedef SkBmpCodec INHERITED; | 98 typedef SkBmpCodec INHERITED; |
99 }; | 99 }; |
OLD | NEW |