diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/images/SkImageDecoder_Factory.cpp | 31 | ||||
-rw-r--r-- | src/images/SkImageDecoder_libbmp.cpp | 4 | ||||
-rw-r--r-- | src/images/SkImageDecoder_libgif.cpp | 2 | ||||
-rw-r--r-- | src/images/SkImageDecoder_libico.cpp | 2 | ||||
-rw-r--r-- | src/images/SkImageDecoder_libjpeg.cpp | 5 | ||||
-rw-r--r-- | src/images/SkImageDecoder_libpng.cpp | 3 | ||||
-rw-r--r-- | src/images/SkImageDecoder_wbmp.cpp | 2 |
7 files changed, 17 insertions, 32 deletions
diff --git a/src/images/SkImageDecoder_Factory.cpp b/src/images/SkImageDecoder_Factory.cpp index 2825f0d505..f3cb120a47 100644 --- a/src/images/SkImageDecoder_Factory.cpp +++ b/src/images/SkImageDecoder_Factory.cpp @@ -12,37 +12,6 @@ #include "SkStream.h" #include "SkTRegistry.h" -//extern SkImageDecoder* sk_libbmp_dfactory(SkStream*); -//extern SkImageDecoder* sk_libgif_dfactory(SkStream*); -//extern SkImageDecoder* sk_libico_dfactory(SkStream*); -//extern SkImageDecoder* sk_libjpeg_dfactory(SkStream*); -//extern SkImageDecoder* sk_libpng_dfactory(SkStream*); -//extern SkImageDecoder* sk_wbmp_dfactory(SkStream*); - -// To get the various image decoding classes to register themselves -// pre-main we need to ensure they are linked into the application. -// Ultimately we need to move to using DLLs rather than tightly -// coupling the factory with the file format classes. -void ForceLinking() -{ - SkImageDecoder* codec = NULL; - - // TODO: rather than force the linking here expose a - // "Sk*ImageDecoderCreate" function for each codec - // and let the app add these calls to force the linking. - // Besides decoupling the codecs from the factory this - // will also give the app the ability to circumvent the - // factory and explicitly create a decoder w/o reaching - // into Skia's guts - -// codec = sk_libbmp_dfactory(NULL); -// codec = sk_libgif_dfactory(NULL); -// codec = sk_libico_dfactory(NULL); -// codec = sk_libjpeg_dfactory(NULL); -// codec = sk_libpng_dfactory(NULL); -// codec = sk_wbmp_dfactory(NULL); -} - typedef SkTRegistry<SkImageDecoder*, SkStream*> DecodeReg; // N.B. You can't use "DecodeReg::gHead here" due to complex C++ diff --git a/src/images/SkImageDecoder_libbmp.cpp b/src/images/SkImageDecoder_libbmp.cpp index 8683e21a7f..fa752956ea 100644 --- a/src/images/SkImageDecoder_libbmp.cpp +++ b/src/images/SkImageDecoder_libbmp.cpp @@ -27,6 +27,10 @@ protected: virtual bool onDecode(SkStream* stream, SkBitmap* bm, Mode mode); }; +/////////////////////////////////////////////////////////////////////////////// +DEFINE_DECODER_CREATOR(BMPImageDecoder); +/////////////////////////////////////////////////////////////////////////////// + SkImageDecoder* sk_libbmp_dfactory(SkStream* stream) { static const char kBmpMagic[] = { 'B', 'M' }; diff --git a/src/images/SkImageDecoder_libgif.cpp b/src/images/SkImageDecoder_libgif.cpp index 3bc33c3d07..cd4ee223f5 100644 --- a/src/images/SkImageDecoder_libgif.cpp +++ b/src/images/SkImageDecoder_libgif.cpp @@ -327,6 +327,8 @@ DONE: } /////////////////////////////////////////////////////////////////////////////// +DEFINE_DECODER_CREATOR(GIFImageDecoder); +/////////////////////////////////////////////////////////////////////////////// #include "SkTRegistry.h" diff --git a/src/images/SkImageDecoder_libico.cpp b/src/images/SkImageDecoder_libico.cpp index 226c84af54..347334430e 100644 --- a/src/images/SkImageDecoder_libico.cpp +++ b/src/images/SkImageDecoder_libico.cpp @@ -366,6 +366,8 @@ static void editPixelBit32(const int pixelNo, const unsigned char* buf, *address = SkPreMultiplyARGB(alpha, red, green, blue); } +/////////////////////////////////////////////////////////////////////////////// +DEFINE_DECODER_CREATOR(ICOImageDecoder); ///////////////////////////////////////////////////////////////////////////////////////// #include "SkTRegistry.h" diff --git a/src/images/SkImageDecoder_libjpeg.cpp b/src/images/SkImageDecoder_libjpeg.cpp index 5cb45a2e0a..8bc6f3d9bc 100644 --- a/src/images/SkImageDecoder_libjpeg.cpp +++ b/src/images/SkImageDecoder_libjpeg.cpp @@ -653,11 +653,14 @@ protected: }; /////////////////////////////////////////////////////////////////////////////// +DEFINE_DECODER_CREATOR(JPEGImageDecoder); +DEFINE_ENCODER_CREATOR(JPEGImageEncoder); +/////////////////////////////////////////////////////////////////////////////// #include "SkTRegistry.h" SkImageDecoder* sk_libjpeg_dfactory(SkStream* stream) { - static const char gHeader[] = { 0xFF, 0xD8, 0xFF }; + static const unsigned char gHeader[] = { 0xFF, 0xD8, 0xFF }; static const size_t HEADER_SIZE = sizeof(gHeader); char buffer[HEADER_SIZE]; diff --git a/src/images/SkImageDecoder_libpng.cpp b/src/images/SkImageDecoder_libpng.cpp index cefbe5e71c..8fe342301a 100644 --- a/src/images/SkImageDecoder_libpng.cpp +++ b/src/images/SkImageDecoder_libpng.cpp @@ -852,6 +852,9 @@ bool SkPNGImageEncoder::doEncode(SkWStream* stream, const SkBitmap& bitmap, } /////////////////////////////////////////////////////////////////////////////// +DEFINE_DECODER_CREATOR(PNGImageDecoder); +DEFINE_ENCODER_CREATOR(PNGImageEncoder); +/////////////////////////////////////////////////////////////////////////////// #include "SkTRegistry.h" diff --git a/src/images/SkImageDecoder_wbmp.cpp b/src/images/SkImageDecoder_wbmp.cpp index 262cf547cd..28a370550b 100644 --- a/src/images/SkImageDecoder_wbmp.cpp +++ b/src/images/SkImageDecoder_wbmp.cpp @@ -148,6 +148,8 @@ bool SkWBMPImageDecoder::onDecode(SkStream* stream, SkBitmap* decodedBitmap, } /////////////////////////////////////////////////////////////////////////////// +DEFINE_DECODER_CREATOR(WBMPImageDecoder); +/////////////////////////////////////////////////////////////////////////////// #include "SkTRegistry.h" |