Index: src/images/SkImageDecoder_libgif.cpp |
diff --git a/src/images/SkImageDecoder_libgif.cpp b/src/images/SkImageDecoder_libgif.cpp |
index 81071c95158be16957e20d3fdfb0ad3554ade7ce..f3a267c7fdf430c8763609c12963292cf93e9181 100644 |
--- a/src/images/SkImageDecoder_libgif.cpp |
+++ b/src/images/SkImageDecoder_libgif.cpp |
@@ -5,10 +5,11 @@ |
* found in the LICENSE file. |
*/ |
+#include "SkImageDecoder_libgif.h" |
+ |
#include "SkColor.h" |
#include "SkColorPriv.h" |
#include "SkColorTable.h" |
-#include "SkImageDecoder.h" |
#include "SkRTConf.h" |
#include "SkScaledBitmapSampler.h" |
#include "SkStream.h" |
@@ -501,36 +502,21 @@ bool SkGIFImageDecoder::onDecode(SkStream* sk_stream, SkBitmap* bm, Mode mode) { |
return true; |
} |
-/////////////////////////////////////////////////////////////////////////////// |
-DEFINE_DECODER_CREATOR(GIFImageDecoder); |
-/////////////////////////////////////////////////////////////////////////////// |
- |
-static bool is_gif(SkStreamRewindable* stream) { |
+SkImageDecoder::Format SkDetectFormatGIFImageDecoder(SkStreamRewindable* stream) { |
char buf[GIF_STAMP_LEN]; |
if (stream->read(buf, GIF_STAMP_LEN) == GIF_STAMP_LEN) { |
if (memcmp(GIF_STAMP, buf, GIF_STAMP_LEN) == 0 || |
memcmp(GIF87_STAMP, buf, GIF_STAMP_LEN) == 0 || |
memcmp(GIF89_STAMP, buf, GIF_STAMP_LEN) == 0) { |
- return true; |
+ return SkImageDecoder::kGIF_Format; |
} |
} |
- return false; |
+ return SkImageDecoder::kUnknown_Format; |
} |
-static SkImageDecoder* sk_libgif_dfactory(SkStreamRewindable* stream) { |
- if (is_gif(stream)) { |
+SkImageDecoder* SkCreateGIFImageDecoder(SkStreamRewindable* stream) { |
+ if (SkDetectFormatGIFImageDecoder(stream) == SkImageDecoder::kGIF_Format) { |
return SkNEW(SkGIFImageDecoder); |
} |
return NULL; |
} |
- |
-static SkImageDecoder_DecodeReg gReg(sk_libgif_dfactory); |
- |
-static SkImageDecoder::Format get_format_gif(SkStreamRewindable* stream) { |
- if (is_gif(stream)) { |
- return SkImageDecoder::kGIF_Format; |
- } |
- return SkImageDecoder::kUnknown_Format; |
-} |
- |
-static SkImageDecoder_FormatReg gFormatReg(get_format_gif); |