Index: src/images/SkImageDecoder_libgif.cpp |
diff --git a/src/images/SkImageDecoder_libgif.cpp b/src/images/SkImageDecoder_libgif.cpp |
index fb5d18fc0870b1be25caf18aaea110aa5867186a..4c0e181331a1a16d945664ab4ae09ba716b11ffc 100644 |
--- a/src/images/SkImageDecoder_libgif.cpp |
+++ b/src/images/SkImageDecoder_libgif.cpp |
@@ -5,10 +5,10 @@ |
* 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" |
@@ -502,36 +502,19 @@ SkImageDecoder::Result SkGIFImageDecoder::onDecode(SkStream* sk_stream, SkBitmap |
return kSuccess; |
} |
-/////////////////////////////////////////////////////////////////////////////// |
-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; |
-} |
- |
-static SkImageDecoder* sk_libgif_dfactory(SkStreamRewindable* stream) { |
- if (is_gif(stream)) { |
- 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); |
+SkImageDecoder* SkCreateGIFImageDecoder(SkImageDecoder::Format format) { |
+ SkASSERT(SkImageDecoder::kGIF_Format == format); |
+ return SkNEW(SkGIFImageDecoder); |
+} |