blob: e6ae16f0bd4c2cc73b79e4df94883412d85733c0 [file] [log] [blame]
epoger@google.comec3ed6a2011-07-28 14:26:00 +00001/*
2 * Copyright 2006 The Android Open Source Project
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
scroggo@google.comdbf9f882013-08-21 15:01:48 +00008#include "SkColorPriv.h"
reed@android.com8a1c16f2008-12-17 15:59:43 +00009#include "SkImageDecoder.h"
10#include "SkStream.h"
scroggo@google.comdbf9f882013-08-21 15:01:48 +000011#include "SkStreamHelpers.h"
reed@android.com8a1c16f2008-12-17 15:59:43 +000012#include "SkTypes.h"
13
14class SkICOImageDecoder : public SkImageDecoder {
15public:
16 SkICOImageDecoder();
rmistry@google.comd6176b02012-08-23 18:14:13 +000017
commit-bot@chromium.orga936e372013-03-14 14:42:18 +000018 virtual Format getFormat() const SK_OVERRIDE {
reed@android.com8a1c16f2008-12-17 15:59:43 +000019 return kICO_Format;
20 }
21
22protected:
commit-bot@chromium.orga936e372013-03-14 14:42:18 +000023 virtual bool onDecode(SkStream* stream, SkBitmap* bm, Mode) SK_OVERRIDE;
reed@android.com8a1c16f2008-12-17 15:59:43 +000024
commit-bot@chromium.orga936e372013-03-14 14:42:18 +000025private:
26 typedef SkImageDecoder INHERITED;
27};
reed@google.com3bbee322011-08-05 16:13:09 +000028
reed@android.com8a1c16f2008-12-17 15:59:43 +000029/////////////////////////////////////////////////////////////////////////////////////////
30
31//read bytes starting from the begin-th index in the buffer
32//read in Intel order, and return an integer
33
34#define readByte(buffer,begin) buffer[begin]
35#define read2Bytes(buffer,begin) buffer[begin]+(buffer[begin+1]<<8)
36#define read4Bytes(buffer,begin) buffer[begin]+(buffer[begin+1]<<8)+(buffer[begin+2]<<16)+(buffer[begin+3]<<24)
37
38/////////////////////////////////////////////////////////////////////////////////////////
39
reed@android.com8a1c16f2008-12-17 15:59:43 +000040SkICOImageDecoder::SkICOImageDecoder()
41{
42}
43
44//helpers - my function pointer will call one of these, depending on the bitCount, each time through the inner loop
rmistry@google.comd6176b02012-08-23 18:14:13 +000045static void editPixelBit1(const int pixelNo, const unsigned char* buf,
46 const int xorOffset, int& x, int y, const int w,
reed@android.com8a1c16f2008-12-17 15:59:43 +000047 SkBitmap* bm, int alphaByte, int m, int shift, SkPMColor* colors);
rmistry@google.comd6176b02012-08-23 18:14:13 +000048static void editPixelBit4(const int pixelNo, const unsigned char* buf,
49 const int xorOffset, int& x, int y, const int w,
reed@android.com8a1c16f2008-12-17 15:59:43 +000050 SkBitmap* bm, int alphaByte, int m, int shift, SkPMColor* colors);
rmistry@google.comd6176b02012-08-23 18:14:13 +000051static void editPixelBit8(const int pixelNo, const unsigned char* buf,
52 const int xorOffset, int& x, int y, const int w,
reed@android.com8a1c16f2008-12-17 15:59:43 +000053 SkBitmap* bm, int alphaByte, int m, int shift, SkPMColor* colors);
rmistry@google.comd6176b02012-08-23 18:14:13 +000054static void editPixelBit24(const int pixelNo, const unsigned char* buf,
55 const int xorOffset, int& x, int y, const int w,
reed@android.com8a1c16f2008-12-17 15:59:43 +000056 SkBitmap* bm, int alphaByte, int m, int shift, SkPMColor* colors);
rmistry@google.comd6176b02012-08-23 18:14:13 +000057static void editPixelBit32(const int pixelNo, const unsigned char* buf,
58 const int xorOffset, int& x, int y, const int w,
reed@android.com8a1c16f2008-12-17 15:59:43 +000059 SkBitmap* bm, int alphaByte, int m, int shift, SkPMColor* colors);
rmistry@google.comd6176b02012-08-23 18:14:13 +000060
61
reed@android.com8a1c16f2008-12-17 15:59:43 +000062static int calculateRowBytesFor8888(int w, int bitCount)
63{
64 // Default rowBytes is w << 2 for kARGB_8888
65 // In the case of a 4 bit image with an odd width, we need to add some
66 // so we can go off the end of the drawn bitmap.
67 // Add 4 to ensure that it is still a multiple of 4.
68 if (4 == bitCount && (w & 0x1)) {
69 return (w + 1) << 2;
70 }
71 // Otherwise return 0, which will allow it to be calculated automatically.
72 return 0;
73}
74
reed@android.com3f1f06a2010-03-03 21:04:12 +000075bool SkICOImageDecoder::onDecode(SkStream* stream, SkBitmap* bm, Mode mode)
reed@android.com8a1c16f2008-12-17 15:59:43 +000076{
scroggo@google.comdbf9f882013-08-21 15:01:48 +000077 SkAutoMalloc autoMal;
78 const size_t length = CopyStreamToStorage(&autoMal, stream);
79 if (0 == length) {
reed@android.com8a1c16f2008-12-17 15:59:43 +000080 return false;
81 }
rmistry@google.comd6176b02012-08-23 18:14:13 +000082
scroggo@google.comdbf9f882013-08-21 15:01:48 +000083 unsigned char* buf = (unsigned char*)autoMal.get();
84
reed@android.com8a1c16f2008-12-17 15:59:43 +000085 //these should always be the same - should i use for error checking? - what about files that have some
86 //incorrect values, but still decode properly?
87 int reserved = read2Bytes(buf, 0); // 0
88 int type = read2Bytes(buf, 2); // 1
89 if (reserved != 0 || type != 1)
90 return false;
91 int count = read2Bytes(buf, 4);
rmistry@google.comd6176b02012-08-23 18:14:13 +000092
reed@android.com8a1c16f2008-12-17 15:59:43 +000093 //need to at least have enough space to hold the initial table of info
94 if (length < (size_t)(6 + count*16))
95 return false;
rmistry@google.comd6176b02012-08-23 18:14:13 +000096
reed5926b862014-06-11 10:33:13 -070097#ifdef SK_SUPPORT_LEGACY_IMAGEDECODER_CHOOSER
reed@android.com8a1c16f2008-12-17 15:59:43 +000098 int choice;
99 Chooser* chooser = this->getChooser();
100 //FIXME:if no chooser, consider providing the largest color image
101 //what are the odds that the largest image would be monochrome?
102 if (NULL == chooser) {
103 choice = 0;
104 } else {
105 chooser->begin(count);
106 for (int i = 0; i < count; i++)
107 {
108 //need to find out the config, width, and height from the stream
109 int width = readByte(buf, 6 + i*16);
110 int height = readByte(buf, 7 + i*16);
111 int offset = read4Bytes(buf, 18 + i*16);
112 int bitCount = read2Bytes(buf, offset+14);
113 SkBitmap::Config c;
114 //currently only provide ARGB_8888_, but maybe we want kIndex8_Config for 1 and 4, and possibly 8?
115 //or maybe we'll determine this based on the provided config
116 switch (bitCount)
117 {
118 case 1:
119 case 4:
120 // In reality, at least for the moment, these will be decoded into kARGB_8888 bitmaps.
rmistry@google.comd6176b02012-08-23 18:14:13 +0000121 // However, this will be used to distinguish between the lower quality 1bpp and 4 bpp
reed@android.com8a1c16f2008-12-17 15:59:43 +0000122 // images and the higher quality images.
123 c = SkBitmap::kIndex8_Config;
124 break;
125 case 8:
126 case 24:
127 case 32:
128 c = SkBitmap::kARGB_8888_Config;
129 break;
130 default:
131 SkDEBUGF(("Image with %ibpp not supported\n", bitCount));
132 continue;
133 }
134 chooser->inspect(i, c, width, height);
135 }
136 choice = chooser->choose();
137 }
rmistry@google.comd6176b02012-08-23 18:14:13 +0000138
reed@android.com8a1c16f2008-12-17 15:59:43 +0000139 //you never know what the chooser is going to supply
rmistry@google.comd6176b02012-08-23 18:14:13 +0000140 if (choice >= count || choice < 0)
reed@android.com8a1c16f2008-12-17 15:59:43 +0000141 return false;
reed5926b862014-06-11 10:33:13 -0700142#else
143 const int choice = 0; // TODO: fold this value into the expressions below
144#endif
rmistry@google.comd6176b02012-08-23 18:14:13 +0000145
reed@android.com8a1c16f2008-12-17 15:59:43 +0000146 //skip ahead to the correct header
147 //commented out lines are not used, but if i switch to other read method, need to know how many to skip
148 //otherwise, they could be used for error checking
149 int w = readByte(buf, 6 + choice*16);
150 int h = readByte(buf, 7 + choice*16);
151 int colorCount = readByte(buf, 8 + choice*16);
152 //int reservedToo = readByte(buf, 9 + choice*16); //0
153 //int planes = read2Bytes(buf, 10 + choice*16); //1 - but often 0
154 //int fakeBitCount = read2Bytes(buf, 12 + choice*16); //should be real - usually 0
155 int size = read4Bytes(buf, 14 + choice*16); //matters?
156 int offset = read4Bytes(buf, 18 + choice*16);
157 if ((size_t)(offset + size) > length)
158 return false;
scroggo@google.com468142b2013-07-09 15:48:24 +0000159
160 // Check to see if this is a PNG image inside the ICO
161 {
162 SkMemoryStream subStream(buf + offset, size, false);
163 SkAutoTDelete<SkImageDecoder> otherDecoder(SkImageDecoder::Factory(&subStream));
164 if (otherDecoder.get() != NULL) {
165 // Set fields on the other decoder to be the same as this one.
166 this->copyFieldsToOther(otherDecoder.get());
167 if(otherDecoder->decode(&subStream, bm, this->getDefaultPref(), mode)) {
168 return true;
169 }
170 }
171 }
172
reed@android.com8a1c16f2008-12-17 15:59:43 +0000173 //int infoSize = read4Bytes(buf, offset); //40
174 //int width = read4Bytes(buf, offset+4); //should == w
175 //int height = read4Bytes(buf, offset+8); //should == 2*h
176 //int planesToo = read2Bytes(buf, offset+12); //should == 1 (does it?)
177 int bitCount = read2Bytes(buf, offset+14);
rmistry@google.comd6176b02012-08-23 18:14:13 +0000178
179 void (*placePixel)(const int pixelNo, const unsigned char* buf,
180 const int xorOffset, int& x, int y, const int w,
reed@android.com8a1c16f2008-12-17 15:59:43 +0000181 SkBitmap* bm, int alphaByte, int m, int shift, SkPMColor* colors) = NULL;
182 switch (bitCount)
183 {
184 case 1:
185 placePixel = &editPixelBit1;
186 colorCount = 2;
187 break;
188 case 4:
189 placePixel = &editPixelBit4;
190 colorCount = 16;
191 break;
192 case 8:
193 placePixel = &editPixelBit8;
194 colorCount = 256;
195 break;
196 case 24:
197 placePixel = &editPixelBit24;
198 colorCount = 0;
199 break;
200 case 32:
201 placePixel = &editPixelBit32;
202 colorCount = 0;
203 break;
204 default:
205 SkDEBUGF(("Decoding %ibpp is unimplemented\n", bitCount));
206 return false;
207 }
rmistry@google.comd6176b02012-08-23 18:14:13 +0000208
reed@android.com8a1c16f2008-12-17 15:59:43 +0000209 //these should all be zero, but perhaps are not - need to check
210 //int compression = read4Bytes(buf, offset+16); //0
211 //int imageSize = read4Bytes(buf, offset+20); //0 - sometimes has a value
212 //int xPixels = read4Bytes(buf, offset+24); //0
213 //int yPixels = read4Bytes(buf, offset+28); //0
214 //int colorsUsed = read4Bytes(buf, offset+32) //0 - might have an actual value though
215 //int colorsImportant = read4Bytes(buf, offset+36); //0
rmistry@google.comd6176b02012-08-23 18:14:13 +0000216
reed@android.com8a1c16f2008-12-17 15:59:43 +0000217 int begin = offset + 40;
218 //this array represents the colortable
219 //if i allow other types of bitmaps, it may actually be used as a part of the bitmap
220 SkPMColor* colors = NULL;
221 int blue, green, red;
rmistry@google.comd6176b02012-08-23 18:14:13 +0000222 if (colorCount)
reed@android.com8a1c16f2008-12-17 15:59:43 +0000223 {
224 colors = new SkPMColor[colorCount];
225 for (int j = 0; j < colorCount; j++)
226 {
227 //should this be a function - maybe a #define?
228 blue = readByte(buf, begin + 4*j);
229 green = readByte(buf, begin + 4*j + 1);
230 red = readByte(buf, begin + 4*j + 2);
231 colors[j] = SkPackARGB32(0xFF, red & 0xFF, green & 0xFF, blue & 0xFF);
232 }
233 }
234 int bitWidth = w*bitCount;
235 int test = bitWidth & 0x1F;
236 int mask = -(((test >> 4) | (test >> 3) | (test >> 2) | (test >> 1) | test) & 0x1); //either 0xFFFFFFFF or 0
237 int lineBitWidth = (bitWidth & 0xFFFFFFE0) + (0x20 & mask);
238 int lineWidth = lineBitWidth/bitCount;
rmistry@google.comd6176b02012-08-23 18:14:13 +0000239
reed@android.com8a1c16f2008-12-17 15:59:43 +0000240 int xorOffset = begin + colorCount*4; //beginning of the color bitmap
241 //other read method means we will just be here already
242 int andOffset = xorOffset + ((lineWidth*h*bitCount) >> 3);
rmistry@google.comd6176b02012-08-23 18:14:13 +0000243
reed@android.com8a1c16f2008-12-17 15:59:43 +0000244 /*int */test = w & 0x1F; //the low 5 bits - we are rounding up to the next 32 (2^5)
245 /*int */mask = -(((test >> 4) | (test >> 3) | (test >> 2) | (test >> 1) | test) & 0x1); //either 0xFFFFFFFF or 0
246 int andLineWidth = (w & 0xFFFFFFE0) + (0x20 & mask);
247 //if we allow different Configs, everything is the same til here
248 //change the config, and use different address getter, and place index vs color, and add the color table
249 //FIXME: what is the tradeoff in size?
250 //if the andbitmap (mask) is all zeroes, then we can easily do an index bitmap
251 //however, with small images with large colortables, maybe it's better to still do argb_8888
252
reed6c225732014-06-09 19:52:07 -0700253 bm->setInfo(SkImageInfo::MakeN32Premul(w, h), calculateRowBytesFor8888(w, bitCount));
scroggo@google.combc69ce92013-07-09 15:45:14 +0000254
reed@android.com8a1c16f2008-12-17 15:59:43 +0000255 if (SkImageDecoder::kDecodeBounds_Mode == mode) {
256 delete[] colors;
257 return true;
258 }
259
260 if (!this->allocPixelRef(bm, NULL))
261 {
262 delete[] colors;
263 return false;
264 }
rmistry@google.comd6176b02012-08-23 18:14:13 +0000265
reed@android.com8a1c16f2008-12-17 15:59:43 +0000266 SkAutoLockPixels alp(*bm);
267
268 for (int y = 0; y < h; y++)
269 {
270 for (int x = 0; x < w; x++)
271 {
272 //U32* address = bm->getAddr32(x, y);
rmistry@google.comd6176b02012-08-23 18:14:13 +0000273
reed@android.com8a1c16f2008-12-17 15:59:43 +0000274 //check the alpha bit first, but pass it along to the function to figure out how to deal with it
275 int andPixelNo = andLineWidth*(h-y-1)+x;
276 //only need to get a new alphaByte when x %8 == 0
277 //but that introduces an if and a mod - probably much slower
278 //that's ok, it's just a read of an array, not a stream
279 int alphaByte = readByte(buf, andOffset + (andPixelNo >> 3));
280 int shift = 7 - (andPixelNo & 0x7);
281 int m = 1 << shift;
rmistry@google.comd6176b02012-08-23 18:14:13 +0000282
reed@android.com8a1c16f2008-12-17 15:59:43 +0000283 int pixelNo = lineWidth*(h-y-1)+x;
284 placePixel(pixelNo, buf, xorOffset, x, y, w, bm, alphaByte, m, shift, colors);
285
286 }
287 }
288
289 delete [] colors;
290 //ensure we haven't read off the end?
291 //of course this doesn't help us if the andOffset was a lie...
292 //return andOffset + (andLineWidth >> 3) <= length;
293 return true;
294} //onDecode
295
296//function to place the pixel, determined by the bitCount
rmistry@google.comd6176b02012-08-23 18:14:13 +0000297static void editPixelBit1(const int pixelNo, const unsigned char* buf,
298 const int xorOffset, int& x, int y, const int w,
reed@android.com8a1c16f2008-12-17 15:59:43 +0000299 SkBitmap* bm, int alphaByte, int m, int shift, SkPMColor* colors)
300{
301 // note that this should be the same as/similar to the AND bitmap
302 SkPMColor* address = bm->getAddr32(x,y);
303 int byte = readByte(buf, xorOffset + (pixelNo >> 3));
304 int colorBit;
305 int alphaBit;
rmistry@google.comd6176b02012-08-23 18:14:13 +0000306 // Read all of the bits in this byte.
reed@android.com8a1c16f2008-12-17 15:59:43 +0000307 int i = x + 8;
rmistry@google.comd6176b02012-08-23 18:14:13 +0000308 // Pin to the width so we do not write outside the bounds of
reed@android.com8a1c16f2008-12-17 15:59:43 +0000309 // our color table.
310 i = i > w ? w : i;
311 // While loop to check all 8 bits individually.
312 while (x < i)
313 {
rmistry@google.comd6176b02012-08-23 18:14:13 +0000314
reed@android.com8a1c16f2008-12-17 15:59:43 +0000315 colorBit = (byte & m) >> shift;
316 alphaBit = (alphaByte & m) >> shift;
317 *address = (alphaBit-1)&(colors[colorBit]);
318 x++;
319 // setup for the next pixel
320 address = address + 1;
321 m = m >> 1;
322 shift -= 1;
323 }
324 x--;
325}
rmistry@google.comd6176b02012-08-23 18:14:13 +0000326static void editPixelBit4(const int pixelNo, const unsigned char* buf,
327 const int xorOffset, int& x, int y, const int w,
reed@android.com8a1c16f2008-12-17 15:59:43 +0000328 SkBitmap* bm, int alphaByte, int m, int shift, SkPMColor* colors)
329{
330 SkPMColor* address = bm->getAddr32(x, y);
331 int byte = readByte(buf, xorOffset + (pixelNo >> 1));
332 int pixel = (byte >> 4) & 0xF;
333 int alphaBit = (alphaByte & m) >> shift;
334 *address = (alphaBit-1)&(colors[pixel]);
335 x++;
336 //if w is odd, x may be the same as w, which means we are writing to an unused portion of the bitmap
337 //but that's okay, since i've added an extra rowByte for just this purpose
338 address = address + 1;
339 pixel = byte & 0xF;
340 m = m >> 1;
341 alphaBit = (alphaByte & m) >> (shift-1);
342 //speed up trick here
343 *address = (alphaBit-1)&(colors[pixel]);
344}
345
rmistry@google.comd6176b02012-08-23 18:14:13 +0000346static void editPixelBit8(const int pixelNo, const unsigned char* buf,
347 const int xorOffset, int& x, int y, const int w,
reed@android.com8a1c16f2008-12-17 15:59:43 +0000348 SkBitmap* bm, int alphaByte, int m, int shift, SkPMColor* colors)
349{
350 SkPMColor* address = bm->getAddr32(x, y);
351 int pixel = readByte(buf, xorOffset + pixelNo);
352 int alphaBit = (alphaByte & m) >> shift;
353 *address = (alphaBit-1)&(colors[pixel]);
rmistry@google.comd6176b02012-08-23 18:14:13 +0000354}
reed@android.com8a1c16f2008-12-17 15:59:43 +0000355
rmistry@google.comd6176b02012-08-23 18:14:13 +0000356static void editPixelBit24(const int pixelNo, const unsigned char* buf,
357 const int xorOffset, int& x, int y, const int w,
reed@android.com8a1c16f2008-12-17 15:59:43 +0000358 SkBitmap* bm, int alphaByte, int m, int shift, SkPMColor* colors)
359{
360 SkPMColor* address = bm->getAddr32(x, y);
361 int blue = readByte(buf, xorOffset + 3*pixelNo);
362 int green = readByte(buf, xorOffset + 3*pixelNo + 1);
363 int red = readByte(buf, xorOffset + 3*pixelNo + 2);
364 int alphaBit = (alphaByte & m) >> shift;
365 //alphaBit == 1 => alpha = 0
366 int alpha = (alphaBit-1) & 0xFF;
rmistry@google.comd6176b02012-08-23 18:14:13 +0000367 *address = SkPreMultiplyARGB(alpha, red, green, blue);
reed@android.com8a1c16f2008-12-17 15:59:43 +0000368}
369
rmistry@google.comd6176b02012-08-23 18:14:13 +0000370static void editPixelBit32(const int pixelNo, const unsigned char* buf,
371 const int xorOffset, int& x, int y, const int w,
reed@android.com8a1c16f2008-12-17 15:59:43 +0000372 SkBitmap* bm, int alphaByte, int m, int shift, SkPMColor* colors)
373{
374 SkPMColor* address = bm->getAddr32(x, y);
375 int blue = readByte(buf, xorOffset + 4*pixelNo);
376 int green = readByte(buf, xorOffset + 4*pixelNo + 1);
377 int red = readByte(buf, xorOffset + 4*pixelNo + 2);
378 int alphaBit = (alphaByte & m) >> shift;
reed@google.com3bbee322011-08-05 16:13:09 +0000379#if 1 // don't trust the alphaBit for 32bit images <mrr>
380 alphaBit = 0;
381#endif
reed@android.com8a1c16f2008-12-17 15:59:43 +0000382 int alpha = readByte(buf, xorOffset + 4*pixelNo + 3) & ((alphaBit-1)&0xFF);
reed@android.comca776972010-04-13 14:03:27 +0000383 *address = SkPreMultiplyARGB(alpha, red, green, blue);
reed@android.com8a1c16f2008-12-17 15:59:43 +0000384}
385
robertphillips@google.comec51cb82012-03-23 18:13:47 +0000386///////////////////////////////////////////////////////////////////////////////
387DEFINE_DECODER_CREATOR(ICOImageDecoder);
reed@android.com00bf85a2009-01-22 13:04:56 +0000388/////////////////////////////////////////////////////////////////////////////////////////
389
scroggo@google.comb5571b32013-09-25 21:34:24 +0000390static bool is_ico(SkStreamRewindable* stream) {
reed@android.com00bf85a2009-01-22 13:04:56 +0000391 // Check to see if the first four bytes are 0,0,1,0
392 // FIXME: Is that required and sufficient?
393 SkAutoMalloc autoMal(4);
394 unsigned char* buf = (unsigned char*)autoMal.get();
395 stream->read((void*)buf, 4);
396 int reserved = read2Bytes(buf, 0);
397 int type = read2Bytes(buf, 2);
398 if (reserved != 0 || type != 1) {
399 // This stream does not represent an ICO image.
scroggo@google.com39edf4c2013-04-25 17:33:51 +0000400 return false;
reed@android.com00bf85a2009-01-22 13:04:56 +0000401 }
scroggo@google.com39edf4c2013-04-25 17:33:51 +0000402 return true;
403}
404
scroggo@google.comb5571b32013-09-25 21:34:24 +0000405static SkImageDecoder* sk_libico_dfactory(SkStreamRewindable* stream) {
scroggo@google.com39edf4c2013-04-25 17:33:51 +0000406 if (is_ico(stream)) {
407 return SkNEW(SkICOImageDecoder);
408 }
409 return NULL;
reed@android.com00bf85a2009-01-22 13:04:56 +0000410}
411
mtklein@google.combd6343b2013-09-04 17:20:18 +0000412static SkImageDecoder_DecodeReg gReg(sk_libico_dfactory);
scroggo@google.com39edf4c2013-04-25 17:33:51 +0000413
scroggo@google.comb5571b32013-09-25 21:34:24 +0000414static SkImageDecoder::Format get_format_ico(SkStreamRewindable* stream) {
scroggo@google.com39edf4c2013-04-25 17:33:51 +0000415 if (is_ico(stream)) {
416 return SkImageDecoder::kICO_Format;
417 }
418 return SkImageDecoder::kUnknown_Format;
419}
420
mtklein@google.combd6343b2013-09-04 17:20:18 +0000421static SkImageDecoder_FormatReg gFormatReg(get_format_ico);