really fix gif movie registration

git-svn-id: http://skia.googlecode.com/svn/trunk@223 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
reed@android.com 2009-06-18 20:26:58 +00:00
parent 5df93eada5
commit a16cb97c89
2 changed files with 6 additions and 0 deletions

View File

@ -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();
}

View File

@ -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));
}
}