Chromium Code Reviews| Index: src/images/SkImageDecoder_libico.cpp |
| diff --git a/src/images/SkImageDecoder_libico.cpp b/src/images/SkImageDecoder_libico.cpp |
| index 7855546a2ccb5d849e4405c184a6d9a671d99b55..5a797a5cce95e6c17f7ba250a6d76fc044ceea63 100644 |
| --- a/src/images/SkImageDecoder_libico.cpp |
| +++ b/src/images/SkImageDecoder_libico.cpp |
| @@ -5,6 +5,8 @@ |
| * found in the LICENSE file. |
| */ |
| +#include "SkImageDecoder_libico.h" |
| + |
| #include "SkColorPriv.h" |
| #include "SkImageDecoder.h" |
| #include "SkStream.h" |
| @@ -25,7 +27,6 @@ protected: |
| private: |
| typedef SkImageDecoder INHERITED; |
| }; |
| - |
|
scroggo
2014/11/12 18:00:12
Why the delete?
Kimmo Kinnunen
2014/11/18 08:29:45
Done.
|
| ///////////////////////////////////////////////////////////////////////////////////////// |
| //read bytes starting from the begin-th index in the buffer |
| @@ -389,11 +390,7 @@ static void editPixelBit32(const int pixelNo, const unsigned char* buf, |
| *address = SkPreMultiplyARGB(alpha, red, green, blue); |
| } |
| -/////////////////////////////////////////////////////////////////////////////// |
| -DEFINE_DECODER_CREATOR(ICOImageDecoder); |
| -///////////////////////////////////////////////////////////////////////////////////////// |
| - |
| -static bool is_ico(SkStreamRewindable* stream) { |
| +SkImageDecoder::Format SkDetectFormatICOImageDecoder(SkStreamRewindable* stream) { |
| // Check to see if the first four bytes are 0,0,1,0 |
| // FIXME: Is that required and sufficient? |
| SkAutoMalloc autoMal(4); |
| @@ -403,25 +400,15 @@ static bool is_ico(SkStreamRewindable* stream) { |
| int type = read2Bytes(buf, 2); |
| if (reserved != 0 || type != 1) { |
| // This stream does not represent an ICO image. |
| - return false; |
| + return SkImageDecoder::kUnknown_Format; |
| } |
| - return true; |
| + return SkImageDecoder::kICO_Format; |
| } |
| -static SkImageDecoder* sk_libico_dfactory(SkStreamRewindable* stream) { |
| - if (is_ico(stream)) { |
| +SkImageDecoder* SkCreateICOImageDecoder(SkStreamRewindable* stream) { |
| + if (SkDetectFormatICOImageDecoder(stream) == SkImageDecoder::kICO_Format) { |
| return SkNEW(SkICOImageDecoder); |
| } |
| return NULL; |
| } |
| -static SkImageDecoder_DecodeReg gReg(sk_libico_dfactory); |
| - |
| -static SkImageDecoder::Format get_format_ico(SkStreamRewindable* stream) { |
| - if (is_ico(stream)) { |
| - return SkImageDecoder::kICO_Format; |
| - } |
| - return SkImageDecoder::kUnknown_Format; |
| -} |
| - |
| -static SkImageDecoder_FormatReg gFormatReg(get_format_ico); |