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 "SkCodec.h" | 8 #include "SkCodec.h" |
9 #include "SkColorTable.h" | 9 #include "SkColorTable.h" |
10 #include "SkImageInfo.h" | 10 #include "SkImageInfo.h" |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 enum BitmapInputFormat { | 79 enum BitmapInputFormat { |
80 kStandard_BitmapInputFormat, | 80 kStandard_BitmapInputFormat, |
81 kRLE_BitmapInputFormat, | 81 kRLE_BitmapInputFormat, |
82 kBitMask_BitmapInputFormat, | 82 kBitMask_BitmapInputFormat, |
83 kUnknown_BitmapInputFormat | 83 kUnknown_BitmapInputFormat |
84 }; | 84 }; |
85 | 85 |
86 /* | 86 /* |
87 * | 87 * |
88 * Creates the color table | 88 * Creates the color table |
89 * | 89 * Sets colorCount to the new color count if it is non-NULL |
90 */ | 90 */ |
91 bool createColorTable(SkAlphaType alphaType); | 91 bool createColorTable(SkAlphaType alphaType, int* colorCount); |
92 | 92 |
93 /* | 93 /* |
94 * | 94 * |
95 * Creates a bmp decoder | 95 * Creates a bmp decoder |
96 * Reads enough of the stream to determine the image format | 96 * Reads enough of the stream to determine the image format |
97 * | 97 * |
98 */ | 98 */ |
99 static SkCodec* NewFromStream(SkStream*, bool isIco); | 99 static SkCodec* NewFromStream(SkStream*, bool isIco); |
100 | 100 |
101 /* | 101 /* |
(...skipping 11 matching lines...) Expand all Loading... |
113 * | 113 * |
114 */ | 114 */ |
115 Result decodeMask(const SkImageInfo& dstInfo, void* dst, | 115 Result decodeMask(const SkImageInfo& dstInfo, void* dst, |
116 size_t dstRowBytes); | 116 size_t dstRowBytes); |
117 | 117 |
118 /* | 118 /* |
119 * | 119 * |
120 * Set an RLE pixel using the color table | 120 * Set an RLE pixel using the color table |
121 * | 121 * |
122 */ | 122 */ |
123 void setRLEPixel(SkPMColor* dst, size_t dstRowBytes, | 123 void setRLEPixel(void* dst, size_t dstRowBytes, |
124 const SkImageInfo& dstInfo, uint32_t x, uint32_t y, | 124 const SkImageInfo& dstInfo, uint32_t x, uint32_t y, |
125 uint8_t index); | 125 uint8_t index); |
126 /* | 126 /* |
127 * | 127 * |
128 * Set an RLE24 pixel from R, G, B values | 128 * Set an RLE24 pixel from R, G, B values |
129 * | 129 * |
130 */ | 130 */ |
131 void setRLE24Pixel(SkPMColor* dst, size_t dstRowBytes, | 131 void setRLE24Pixel(void* dst, size_t dstRowBytes, |
132 const SkImageInfo& dstInfo, uint32_t x, uint32_t y, | 132 const SkImageInfo& dstInfo, uint32_t x, uint32_t y, |
133 uint8_t red, uint8_t green, uint8_t blue); | 133 uint8_t red, uint8_t green, uint8_t blue); |
134 | 134 |
135 /* | 135 /* |
136 * | 136 * |
137 * Performs the bitmap decoding for RLE input format | 137 * Performs the bitmap decoding for RLE input format |
138 * | 138 * |
139 */ | 139 */ |
140 Result decodeRLE(const SkImageInfo& dstInfo, void* dst, | 140 Result decodeRLE(const SkImageInfo& dstInfo, void* dst, |
141 size_t dstRowBytes); | 141 size_t dstRowBytes, const Options& opts); |
142 | 142 |
143 /* | 143 /* |
144 * | 144 * |
145 * Performs the bitmap decoding for standard input format | 145 * Performs the bitmap decoding for standard input format |
146 * | 146 * |
147 */ | 147 */ |
148 Result decode(const SkImageInfo& dstInfo, void* dst, size_t dstRowBytes); | 148 Result decode(const SkImageInfo& dstInfo, void* dst, size_t dstRowBytes); |
149 | 149 |
150 /* | 150 /* |
151 * | 151 * |
(...skipping 21 matching lines...) Expand all Loading... |
173 SkBmpCodec(const SkImageInfo& srcInfo, SkStream* stream, | 173 SkBmpCodec(const SkImageInfo& srcInfo, SkStream* stream, |
174 uint16_t bitsPerPixel, BitmapInputFormat format, | 174 uint16_t bitsPerPixel, BitmapInputFormat format, |
175 SkMasks* masks, uint32_t numColors, uint32_t bytesPerColor, | 175 SkMasks* masks, uint32_t numColors, uint32_t bytesPerColor, |
176 uint32_t offset, RowOrder rowOrder, size_t RLEBytes, | 176 uint32_t offset, RowOrder rowOrder, size_t RLEBytes, |
177 bool isIco); | 177 bool isIco); |
178 | 178 |
179 // Fields | 179 // Fields |
180 const uint16_t fBitsPerPixel; | 180 const uint16_t fBitsPerPixel; |
181 const BitmapInputFormat fInputFormat; | 181 const BitmapInputFormat fInputFormat; |
182 SkAutoTDelete<SkMasks> fMasks; // owned | 182 SkAutoTDelete<SkMasks> fMasks; // owned |
183 SkAutoTDelete<SkColorTable> fColorTable; // owned | 183 SkAutoTUnref<SkColorTable> fColorTable; // owned |
184 uint32_t fNumColors; | 184 uint32_t fNumColors; |
185 const uint32_t fBytesPerColor; | 185 const uint32_t fBytesPerColor; |
186 const uint32_t fOffset; | 186 const uint32_t fOffset; |
187 const RowOrder fRowOrder; | 187 const RowOrder fRowOrder; |
188 const size_t fRLEBytes; | 188 const size_t fRLEBytes; |
189 const bool fIsIco; | 189 const bool fIsIco; |
190 | 190 |
191 typedef SkCodec INHERITED; | 191 typedef SkCodec INHERITED; |
192 }; | 192 }; |
OLD | NEW |