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 "SkColorTable.h" | |
10 #include "SkImageInfo.h" | |
11 #include "SkSwizzler.h" | |
12 #include "SkTypes.h" | |
13 | |
14 /* | |
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. | |
17 */ | |
18 class SkBmpStandardCodec : public SkBmpCodec { | |
19 public: | |
20 | |
21 /* | |
22 * Creates an instance of the decoder | |
23 * Called only by SkBmpCodec::NewFromStream | |
24 * | |
25 * @param srcInfo contains the source width and height | |
26 * @param stream the stream of image data | |
27 * @param bitsPerPixel the number of bits used to store each pixel | |
28 * @param format the format of the bmp file | |
29 * @param numColors the number of colors in the color table | |
30 * @param bytesPerColor the number of bytes in the stream used to represent | |
31 each color in the color table | |
32 * @param offset the offset of the image pixel data from the end of the | |
33 * headers | |
34 * @param rowOrder indicates whether rows are ordered top-down or bottom-up | |
scroggo
2015/08/04 16:16:47
@param isIco Whether this is part of an ICO image.
msarett
2015/08/04 23:14:45
Agreed
| |
35 */ | |
36 SkBmpStandardCodec(const SkImageInfo& srcInfo, SkStream* stream, | |
37 uint16_t bitsPerPixel, uint32_t numColors, uint32_t bytesPerColor , | |
38 uint32_t offset, SkBmpCodec::RowOrder rowOrder, bool isIco); | |
39 | |
40 protected: | |
41 | |
42 Result onGetPixels(const SkImageInfo& dstInfo, void* dst, | |
43 size_t dstRowBytes, const Options&, SkPMColor*, | |
44 int*) override; | |
45 | |
46 private: | |
47 | |
48 /* | |
49 * Creates the color table | |
50 * Sets colorCount to the new color count if it is non-NULL | |
51 */ | |
52 bool createColorTable(SkAlphaType alphaType, int* colorCount); | |
msarett
2015/08/03 22:52:36
Used to be in SkBmpCodec. Simplified given that w
| |
53 | |
54 bool initializeSwizzler(const SkImageInfo& dstInfo, const Options& opts); | |
msarett
2015/08/03 22:52:36
Factored out of decode() in SkBmpCodec. Will be u
| |
55 | |
56 Result decode(const SkImageInfo& dstInfo, void* dst, size_t dstRowBytes, con st Options& opts); | |
msarett
2015/08/03 22:52:36
Used to be decode() in SkBmpCodec.
| |
57 | |
58 SkAutoTUnref<SkColorTable> fColorTable; // owned | |
59 uint32_t fNumColors; | |
60 const uint32_t fBytesPerColor; | |
61 const uint32_t fOffset; | |
62 SkAutoTDelete<SkSwizzler> fSwizzler; | |
63 SkAutoTDeleteArray<uint8_t> fSrcBuffer; | |
64 const bool fIsIco; | |
scroggo
2015/08/04 16:16:47
So, if I understand correctly, only standard BMPs
msarett
2015/08/04 23:14:45
You understand correctly. I will add checks for t
| |
65 bool fIsTransparent; | |
66 | |
67 typedef SkBmpCodec INHERITED; | |
68 }; | |
OLD | NEW |