aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/images/SkImageDecoder_Factory.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/images/SkImageDecoder_Factory.cpp')
-rw-r--r--src/images/SkImageDecoder_Factory.cpp4
1 files changed, 4 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();
}