diff options
author | 2009-06-18 20:26:58 +0000 | |
---|---|---|
committer | 2009-06-18 20:26:58 +0000 | |
commit | a16cb97c89fedcd521aeaadfa94feddbcb6729b1 (patch) | |
tree | f59a0e44365796119c603348d50e1481bdb1942e | |
parent | 5df93eada5bf8c977c433c0189df7079fc60509c (diff) |
really fix gif movie registration
git-svn-id: http://skia.googlecode.com/svn/trunk@223 2bbb7eff-a529-9590-31e7-b0007b416f81
-rw-r--r-- | src/images/SkImageDecoder_Factory.cpp | 4 | ||||
-rw-r--r-- | src/images/SkMovie_gif.cpp | 2 |
2 files changed, 6 insertions, 0 deletions
diff --git a/src/images/SkImageDecoder_Factory.cpp b/src/images/SkImageDecoder_Factory.cpp index 9dd9913bb5..bd81d1fc1d 100644 --- a/src/images/SkImageDecoder_Factory.cpp +++ b/src/images/SkImageDecoder_Factory.cpp @@ -28,6 +28,8 @@ SkImageDecoder* SkImageDecoder::Factory(SkStream* stream) { const DecodeReg* curr = DecodeReg::Head(); while (curr) { SkImageDecoder* codec = curr->factory()(stream); + // we rewind here, because we promise later when we call "decode", that + // the stream will be at its beginning. stream->rewind(); if (codec) { return codec; @@ -48,6 +50,8 @@ SkMovie* SkMovie::DecodeStream(SkStream* stream) { if (movie) { return movie; } + // we must rewind only if we got NULL, since we gave the stream to the + // movie, who may have already started reading from it stream->rewind(); curr = curr->next(); } diff --git a/src/images/SkMovie_gif.cpp b/src/images/SkMovie_gif.cpp index 68af85a94b..113804462a 100644 --- a/src/images/SkMovie_gif.cpp +++ b/src/images/SkMovie_gif.cpp @@ -220,6 +220,8 @@ SkMovie* Factory(SkStream* stream) { 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) { + // must rewind here, since our construct wants to re-read the data + stream->rewind(); return SkNEW_ARGS(SkGIFMovie, (stream)); } } |