Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(700)

Unified Diff: src/images/SkImageDecoder_libgif.cpp

Issue 670453002: Remove image decoder and encoder autoregistration (Closed) Base URL: https://skia.googlesource.com/skia.git@separate-image-decoder-01-skpicture
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/images/SkImageDecoder_libgif.h ('k') | src/images/SkImageDecoder_libico.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
+}
« no previous file with comments | « src/images/SkImageDecoder_libgif.h ('k') | src/images/SkImageDecoder_libico.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698