diff options
author | reed@android.com <reed@android.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2009-06-18 17:53:12 +0000 |
---|---|---|
committer | reed@android.com <reed@android.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2009-06-18 17:53:12 +0000 |
commit | 8540a79396e9fd2d3dbc1c409b4e5cd1b95f018e (patch) | |
tree | 75285a88cd9c7d36a9b0a9364a4031c31aa11251 | |
parent | 81aaa9d8c097f6c5116a85ba6abbd8b3bdab4019 (diff) |
add registrar for gif movie
git-svn-id: http://skia.googlecode.com/svn/trunk@221 2bbb7eff-a529-9590-31e7-b0007b416f81
-rw-r--r-- | src/images/SkMovie_gif.cpp | 32 |
1 files changed, 19 insertions, 13 deletions
diff --git a/src/images/SkMovie_gif.cpp b/src/images/SkMovie_gif.cpp index ca9c812712..253c242499 100644 --- a/src/images/SkMovie_gif.cpp +++ b/src/images/SkMovie_gif.cpp @@ -38,19 +38,6 @@ private: SavedImage* fCurrSavedImage; }; -SkMovie* SkMovie_GIF_Factory(SkStream* 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) { - stream->rewind(); - return SkNEW_ARGS(SkGIFMovie, (stream)); - } - } - return NULL; -} - static int Decode(GifFileType* fileType, GifByteType* out, int size) { SkStream* stream = (SkStream*) fileType->UserData; return (int) stream->read(out, size); @@ -222,3 +209,22 @@ bool SkGIFMovie::onGetBitmap(SkBitmap* bm) } return true; } + +/////////////////////////////////////////////////////////////////////////////// + +#include "SkTRegistry.h" + +SkMovie* Factory(SkStream* 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) { + stream->rewind(); + return SkNEW_ARGS(SkGIFMovie, (stream)); + } + } + return NULL; +} + +static SkTRegistry<SkMovie*, SkStream*> gReg(Factory); |