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

Unified Diff: src/images/SkImageDecoder_libico.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_libico.h ('k') | src/images/SkImageDecoder_libjpeg.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/images/SkImageDecoder_libico.cpp
diff --git a/src/images/SkImageDecoder_libico.cpp b/src/images/SkImageDecoder_libico.cpp
index 5240d09b8672dbdd1980b27bf7d959b8dbcb425f..66e56ce8228593a96b9ae42849cf5e7f1c1f85d1 100644
--- a/src/images/SkImageDecoder_libico.cpp
+++ b/src/images/SkImageDecoder_libico.cpp
@@ -5,6 +5,7 @@
* found in the LICENSE file.
*/
+#include "SkImageDecoder_libico.h"
#include "SkColorPriv.h"
#include "SkImageDecoder.h"
#include "SkStream.h"
@@ -398,36 +399,23 @@ 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?
char buf[4];
if (stream->read((void*)buf, 4) != 4) {
- return false;
+ return SkImageDecoder::kUnknown_Format;
}
int reserved = read2Bytes(buf, 0);
int type = read2Bytes(buf, 2);
- return 0 == reserved && 1 == type;
-}
-
-static SkImageDecoder* sk_libico_dfactory(SkStreamRewindable* stream) {
- if (is_ico(stream)) {
- return SkNEW(SkICOImageDecoder);
+ if (0 != reserved || 1 != type) {
+ return SkImageDecoder::kUnknown_Format;
}
- return NULL;
+ return SkImageDecoder::kICO_Format;
}
-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;
+SkImageDecoder* SkCreateICOImageDecoder(SkImageDecoder::Format format) {
+ SkASSERT(SkImageDecoder::kICO_Format == format);
+ return SkNEW(SkICOImageDecoder);
}
-static SkImageDecoder_FormatReg gFormatReg(get_format_ico);
« no previous file with comments | « src/images/SkImageDecoder_libico.h ('k') | src/images/SkImageDecoder_libjpeg.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698