Change SkImageDecoders to take an SkStreamRewindable.

Only affects factories, static functions that will use the factories,
and subset decoding, which all require rewinding. The decoders
themselves continue to take an SkStream. This is merely documentation
stating which functions will possibly rewind the passed in SkStream.

This is part of the general change to coordinate SkStreams with
Android's streams, which don't necessarily support rewinding in all
cases.

Update callers to use SkStreamRewindable.

BUG=skia:1572
R=bungeman@google.com, reed@google.com

Review URL: https://codereview.chromium.org/23477009

git-svn-id: http://skia.googlecode.com/svn/trunk@11460 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/images/SkImageDecoder.cpp b/src/images/SkImageDecoder.cpp
index 7c4c477..1544edf 100644
--- a/src/images/SkImageDecoder.cpp
+++ b/src/images/SkImageDecoder.cpp
@@ -213,8 +213,8 @@
     return this->onDecodeSubset(bm, rect);
 }
 
-bool SkImageDecoder::buildTileIndex(SkStream* stream,
-                                int *width, int *height) {
+bool SkImageDecoder::buildTileIndex(SkStreamRewindable* stream,
+                                    int *width, int *height) {
     // we reset this to false before calling onBuildTileIndex
     fShouldCancelDecode = false;
 
@@ -276,7 +276,7 @@
     SkASSERT(file);
     SkASSERT(bm);
 
-    SkAutoTUnref<SkStream> stream(SkStream::NewFromFile(file));
+    SkAutoTUnref<SkStreamRewindable> stream(SkStream::NewFromFile(file));
     if (stream.get()) {
         if (SkImageDecoder::DecodeStream(stream, bm, pref, mode, format)) {
             bm->pixelRef()->setURI(file);
@@ -445,8 +445,9 @@
 }
 
 
-bool SkImageDecoder::DecodeStream(SkStream* stream, SkBitmap* bm,
-                          SkBitmap::Config pref, Mode mode, Format* format) {
+bool SkImageDecoder::DecodeStream(SkStreamRewindable* stream, SkBitmap* bm,
+                                  SkBitmap::Config pref, Mode mode,
+                                  Format* format) {
     SkASSERT(stream);
     SkASSERT(bm);
 
diff --git a/src/images/SkImageDecoder_FactoryDefault.cpp b/src/images/SkImageDecoder_FactoryDefault.cpp
index 247f571..e959c8b 100644
--- a/src/images/SkImageDecoder_FactoryDefault.cpp
+++ b/src/images/SkImageDecoder_FactoryDefault.cpp
@@ -10,17 +10,17 @@
 #include "SkMovie.h"
 #include "SkStream.h"
 
-extern SkImageDecoder* image_decoder_from_stream(SkStream*);
+extern SkImageDecoder* image_decoder_from_stream(SkStreamRewindable*);
 
-SkImageDecoder* SkImageDecoder::Factory(SkStream* stream) {
+SkImageDecoder* SkImageDecoder::Factory(SkStreamRewindable* stream) {
     return image_decoder_from_stream(stream);
 }
 
 /////////////////////////////////////////////////////////////////////////
 
-typedef SkTRegistry<SkMovie*(*)(SkStream*)> MovieReg;
+typedef SkTRegistry<SkMovie*(*)(SkStreamRewindable*)> MovieReg;
 
-SkMovie* SkMovie::DecodeStream(SkStream* stream) {
+SkMovie* SkMovie::DecodeStream(SkStreamRewindable* stream) {
     const MovieReg* curr = MovieReg::Head();
     while (curr) {
         SkMovie* movie = curr->factory()(stream);
diff --git a/src/images/SkImageDecoder_FactoryRegistrar.cpp b/src/images/SkImageDecoder_FactoryRegistrar.cpp
index 9ed17e0..b47a6d5 100644
--- a/src/images/SkImageDecoder_FactoryRegistrar.cpp
+++ b/src/images/SkImageDecoder_FactoryRegistrar.cpp
@@ -12,13 +12,13 @@
 
 // This file is used for registration of SkImageDecoders. It also holds a function
 // for checking all the the registered SkImageDecoders for one that matches an
-// input SkStream.
+// input SkStreamRewindable.
 
 template SkImageDecoder_DecodeReg* SkImageDecoder_DecodeReg::gHead;
 
-SkImageDecoder* image_decoder_from_stream(SkStream*);
+SkImageDecoder* image_decoder_from_stream(SkStreamRewindable*);
 
-SkImageDecoder* image_decoder_from_stream(SkStream* stream) {
+SkImageDecoder* image_decoder_from_stream(SkStreamRewindable* stream) {
     SkImageDecoder* codec = NULL;
     const SkImageDecoder_DecodeReg* curr = SkImageDecoder_DecodeReg::Head();
     while (curr) {
@@ -45,7 +45,7 @@
 
 template SkImageDecoder_FormatReg* SkImageDecoder_FormatReg::gHead;
 
-SkImageDecoder::Format SkImageDecoder::GetStreamFormat(SkStream* stream) {
+SkImageDecoder::Format SkImageDecoder::GetStreamFormat(SkStreamRewindable* stream) {
     const SkImageDecoder_FormatReg* curr = SkImageDecoder_FormatReg::Head();
     while (curr != NULL) {
         Format format = curr->factory()(stream);
diff --git a/src/images/SkImageDecoder_libbmp.cpp b/src/images/SkImageDecoder_libbmp.cpp
index 2edd57c..3eb181f 100644
--- a/src/images/SkImageDecoder_libbmp.cpp
+++ b/src/images/SkImageDecoder_libbmp.cpp
@@ -34,7 +34,7 @@
 DEFINE_DECODER_CREATOR(BMPImageDecoder);
 ///////////////////////////////////////////////////////////////////////////////
 
-static bool is_bmp(SkStream* stream) {
+static bool is_bmp(SkStreamRewindable* stream) {
     static const char kBmpMagic[] = { 'B', 'M' };
 
 
@@ -44,7 +44,7 @@
         !memcmp(buffer, kBmpMagic, sizeof(kBmpMagic));
 }
 
-static SkImageDecoder* sk_libbmp_dfactory(SkStream* stream) {
+static SkImageDecoder* sk_libbmp_dfactory(SkStreamRewindable* stream) {
     if (is_bmp(stream)) {
         return SkNEW(SkBMPImageDecoder);
     }
@@ -53,7 +53,7 @@
 
 static SkImageDecoder_DecodeReg gReg(sk_libbmp_dfactory);
 
-static SkImageDecoder::Format get_format_bmp(SkStream* stream) {
+static SkImageDecoder::Format get_format_bmp(SkStreamRewindable* stream) {
     if (is_bmp(stream)) {
         return SkImageDecoder::kBMP_Format;
     }
diff --git a/src/images/SkImageDecoder_libgif.cpp b/src/images/SkImageDecoder_libgif.cpp
index 21d95aa..1d25120 100644
--- a/src/images/SkImageDecoder_libgif.cpp
+++ b/src/images/SkImageDecoder_libgif.cpp
@@ -356,7 +356,7 @@
 DEFINE_DECODER_CREATOR(GIFImageDecoder);
 ///////////////////////////////////////////////////////////////////////////////
 
-static bool is_gif(SkStream* stream) {
+static bool is_gif(SkStreamRewindable* 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 ||
@@ -368,7 +368,7 @@
     return false;
 }
 
-static SkImageDecoder* sk_libgif_dfactory(SkStream* stream) {
+static SkImageDecoder* sk_libgif_dfactory(SkStreamRewindable* stream) {
     if (is_gif(stream)) {
         return SkNEW(SkGIFImageDecoder);
     }
@@ -377,7 +377,7 @@
 
 static SkImageDecoder_DecodeReg gReg(sk_libgif_dfactory);
 
-static SkImageDecoder::Format get_format_gif(SkStream* stream) {
+static SkImageDecoder::Format get_format_gif(SkStreamRewindable* stream) {
     if (is_gif(stream)) {
         return SkImageDecoder::kGIF_Format;
     }
diff --git a/src/images/SkImageDecoder_libico.cpp b/src/images/SkImageDecoder_libico.cpp
index c0f0f91..2b65a36 100644
--- a/src/images/SkImageDecoder_libico.cpp
+++ b/src/images/SkImageDecoder_libico.cpp
@@ -383,7 +383,7 @@
 DEFINE_DECODER_CREATOR(ICOImageDecoder);
 /////////////////////////////////////////////////////////////////////////////////////////
 
-static bool is_ico(SkStream* stream) {
+static bool is_ico(SkStreamRewindable* stream) {
     // Check to see if the first four bytes are 0,0,1,0
     // FIXME: Is that required and sufficient?
     SkAutoMalloc autoMal(4);
@@ -398,7 +398,7 @@
     return true;
 }
 
-static SkImageDecoder* sk_libico_dfactory(SkStream* stream) {
+static SkImageDecoder* sk_libico_dfactory(SkStreamRewindable* stream) {
     if (is_ico(stream)) {
         return SkNEW(SkICOImageDecoder);
     }
@@ -407,7 +407,7 @@
 
 static SkImageDecoder_DecodeReg gReg(sk_libico_dfactory);
 
-static SkImageDecoder::Format get_format_ico(SkStream* stream) {
+static SkImageDecoder::Format get_format_ico(SkStreamRewindable* stream) {
     if (is_ico(stream)) {
         return SkImageDecoder::kICO_Format;
     }
diff --git a/src/images/SkImageDecoder_libjpeg.cpp b/src/images/SkImageDecoder_libjpeg.cpp
index 107441b..37be2a7 100644
--- a/src/images/SkImageDecoder_libjpeg.cpp
+++ b/src/images/SkImageDecoder_libjpeg.cpp
@@ -65,7 +65,7 @@
 #ifdef SK_BUILD_FOR_ANDROID
 class SkJPEGImageIndex {
 public:
-    SkJPEGImageIndex(SkStream* stream, SkImageDecoder* decoder)
+    SkJPEGImageIndex(SkStreamRewindable* stream, SkImageDecoder* decoder)
         : fSrcMgr(stream, decoder)
         , fInfoInitialized(false)
         , fHuffmanCreated(false)
@@ -195,7 +195,7 @@
 
 protected:
 #ifdef SK_BUILD_FOR_ANDROID
-    virtual bool onBuildTileIndex(SkStream *stream, int *width, int *height) SK_OVERRIDE;
+    virtual bool onBuildTileIndex(SkStreamRewindable *stream, int *width, int *height) SK_OVERRIDE;
     virtual bool onDecodeSubset(SkBitmap* bitmap, const SkIRect& rect) SK_OVERRIDE;
 #endif
     virtual bool onDecode(SkStream* stream, SkBitmap* bm, Mode) SK_OVERRIDE;
@@ -638,7 +638,7 @@
 }
 
 #ifdef SK_BUILD_FOR_ANDROID
-bool SkJPEGImageDecoder::onBuildTileIndex(SkStream* stream, int *width, int *height) {
+bool SkJPEGImageDecoder::onBuildTileIndex(SkStreamRewindable* stream, int *width, int *height) {
 
     SkAutoTDelete<SkJPEGImageIndex> imageIndex(SkNEW_ARGS(SkJPEGImageIndex, (stream, this)));
     jpeg_decompress_struct* cinfo = imageIndex->cinfo();
@@ -1121,7 +1121,7 @@
 DEFINE_ENCODER_CREATOR(JPEGImageEncoder);
 ///////////////////////////////////////////////////////////////////////////////
 
-static bool is_jpeg(SkStream* stream) {
+static bool is_jpeg(SkStreamRewindable* stream) {
     static const unsigned char gHeader[] = { 0xFF, 0xD8, 0xFF };
     static const size_t HEADER_SIZE = sizeof(gHeader);
 
@@ -1137,14 +1137,15 @@
     return true;
 }
 
-static SkImageDecoder* sk_libjpeg_dfactory(SkStream* stream) {
+
+static SkImageDecoder* sk_libjpeg_dfactory(SkStreamRewindable* stream) {
     if (is_jpeg(stream)) {
         return SkNEW(SkJPEGImageDecoder);
     }
     return NULL;
 }
 
-static SkImageDecoder::Format get_format_jpeg(SkStream* stream) {
+static SkImageDecoder::Format get_format_jpeg(SkStreamRewindable* stream) {
     if (is_jpeg(stream)) {
         return SkImageDecoder::kJPEG_Format;
     }
@@ -1155,7 +1156,6 @@
     return (SkImageEncoder::kJPEG_Type == t) ? SkNEW(SkJPEGImageEncoder) : NULL;
 }
 
-
 static SkImageDecoder_DecodeReg gDReg(sk_libjpeg_dfactory);
 static SkImageDecoder_FormatReg gFormatReg(get_format_jpeg);
 static SkImageEncoder_EncodeReg gEReg(sk_libjpeg_efactory);
diff --git a/src/images/SkImageDecoder_libpng.cpp b/src/images/SkImageDecoder_libpng.cpp
index 56c19fd..b6aa329 100644
--- a/src/images/SkImageDecoder_libpng.cpp
+++ b/src/images/SkImageDecoder_libpng.cpp
@@ -42,7 +42,7 @@
 
 class SkPNGImageIndex {
 public:
-    SkPNGImageIndex(SkStream* stream, png_structp png_ptr, png_infop info_ptr)
+    SkPNGImageIndex(SkStreamRewindable* stream, png_structp png_ptr, png_infop info_ptr)
         : fStream(stream)
         , fPng_ptr(png_ptr)
         , fInfo_ptr(info_ptr)
@@ -56,10 +56,10 @@
         }
     }
 
-    SkAutoTUnref<SkStream>  fStream;
-    png_structp             fPng_ptr;
-    png_infop               fInfo_ptr;
-    SkBitmap::Config        fConfig;
+    SkAutoTUnref<SkStreamRewindable>    fStream;
+    png_structp                         fPng_ptr;
+    png_infop                           fInfo_ptr;
+    SkBitmap::Config                    fConfig;
 };
 
 class SkPNGImageDecoder : public SkImageDecoder {
@@ -77,7 +77,7 @@
 
 protected:
 #ifdef SK_BUILD_FOR_ANDROID
-    virtual bool onBuildTileIndex(SkStream *stream, int *width, int *height) SK_OVERRIDE;
+    virtual bool onBuildTileIndex(SkStreamRewindable *stream, int *width, int *height) SK_OVERRIDE;
     virtual bool onDecodeSubset(SkBitmap* bitmap, const SkIRect& region) SK_OVERRIDE;
 #endif
     virtual bool onDecode(SkStream* stream, SkBitmap* bm, Mode) SK_OVERRIDE;
@@ -123,7 +123,7 @@
 
 #ifdef SK_BUILD_FOR_ANDROID
 static void sk_seek_fn(png_structp png_ptr, png_uint_32 offset) {
-    SkStream* sk_stream = (SkStream*) png_get_io_ptr(png_ptr);
+    SkStreamRewindable* sk_stream = (SkStreamRewindable*) png_get_io_ptr(png_ptr);
     if (!sk_stream->rewind()) {
         png_error(png_ptr, "Failed to rewind stream!");
     }
@@ -667,7 +667,7 @@
 
 #ifdef SK_BUILD_FOR_ANDROID
 
-bool SkPNGImageDecoder::onBuildTileIndex(SkStream* sk_stream, int *width, int *height) {
+bool SkPNGImageDecoder::onBuildTileIndex(SkStreamRewindable* sk_stream, int *width, int *height) {
     png_structp png_ptr;
     png_infop   info_ptr;
 
@@ -1174,7 +1174,7 @@
 DEFINE_ENCODER_CREATOR(PNGImageEncoder);
 ///////////////////////////////////////////////////////////////////////////////
 
-static bool is_png(SkStream* stream) {
+static bool is_png(SkStreamRewindable* stream) {
     char buf[PNG_BYTES_TO_CHECK];
     if (stream->read(buf, PNG_BYTES_TO_CHECK) == PNG_BYTES_TO_CHECK &&
         !png_sig_cmp((png_bytep) buf, (png_size_t)0, PNG_BYTES_TO_CHECK)) {
@@ -1183,14 +1183,14 @@
     return false;
 }
 
-SkImageDecoder* sk_libpng_dfactory(SkStream* stream) {
+SkImageDecoder* sk_libpng_dfactory(SkStreamRewindable* stream) {
     if (is_png(stream)) {
         return SkNEW(SkPNGImageDecoder);
     }
     return NULL;
 }
 
-static SkImageDecoder::Format get_format_png(SkStream* stream) {
+static SkImageDecoder::Format get_format_png(SkStreamRewindable* stream) {
     if (is_png(stream)) {
         return SkImageDecoder::kPNG_Format;
     }
diff --git a/src/images/SkImageDecoder_libwebp.cpp b/src/images/SkImageDecoder_libwebp.cpp
index a6a6991..625e96e 100644
--- a/src/images/SkImageDecoder_libwebp.cpp
+++ b/src/images/SkImageDecoder_libwebp.cpp
@@ -110,7 +110,7 @@
     }
 
 protected:
-    virtual bool onBuildTileIndex(SkStream *stream, int *width, int *height) SK_OVERRIDE;
+    virtual bool onBuildTileIndex(SkStreamRewindable *stream, int *width, int *height) SK_OVERRIDE;
     virtual bool onDecodeSubset(SkBitmap* bitmap, const SkIRect& rect) SK_OVERRIDE;
     virtual bool onDecode(SkStream* stream, SkBitmap* bm, Mode) SK_OVERRIDE;
 
@@ -300,7 +300,7 @@
     return true;
 }
 
-bool SkWEBPImageDecoder::onBuildTileIndex(SkStream* stream,
+bool SkWEBPImageDecoder::onBuildTileIndex(SkStreamRewindable* stream,
                                           int *width, int *height) {
     int origWidth, origHeight, hasAlpha;
     if (!webp_parse_header(stream, &origWidth, &origHeight, &hasAlpha)) {
@@ -575,7 +575,7 @@
 DEFINE_ENCODER_CREATOR(WEBPImageEncoder);
 ///////////////////////////////////////////////////////////////////////////////
 
-static SkImageDecoder* sk_libwebp_dfactory(SkStream* stream) {
+static SkImageDecoder* sk_libwebp_dfactory(SkStreamRewindable* stream) {
     int width, height, hasAlpha;
     if (!webp_parse_header(stream, &width, &height, &hasAlpha)) {
         return NULL;
@@ -585,7 +585,7 @@
     return SkNEW(SkWEBPImageDecoder);
 }
 
-static SkImageDecoder::Format get_format_webp(SkStream* stream) {
+static SkImageDecoder::Format get_format_webp(SkStreamRewindable* stream) {
     int width, height, hasAlpha;
     if (webp_parse_header(stream, &width, &height, &hasAlpha)) {
         return SkImageDecoder::kWEBP_Format;
diff --git a/src/images/SkImageDecoder_wbmp.cpp b/src/images/SkImageDecoder_wbmp.cpp
index 9460d55..4a9944d 100644
--- a/src/images/SkImageDecoder_wbmp.cpp
+++ b/src/images/SkImageDecoder_wbmp.cpp
@@ -152,7 +152,7 @@
 DEFINE_DECODER_CREATOR(WBMPImageDecoder);
 ///////////////////////////////////////////////////////////////////////////////
 
-static SkImageDecoder* sk_wbmp_dfactory(SkStream* stream) {
+static SkImageDecoder* sk_wbmp_dfactory(SkStreamRewindable* stream) {
     wbmp_head   head;
 
     if (head.init(stream)) {
@@ -161,7 +161,7 @@
     return NULL;
 }
 
-static SkImageDecoder::Format get_format_wbmp(SkStream* stream) {
+static SkImageDecoder::Format get_format_wbmp(SkStreamRewindable* stream) {
     wbmp_head head;
     if (head.init(stream)) {
         return SkImageDecoder::kWBMP_Format;
diff --git a/src/images/SkImageRef.cpp b/src/images/SkImageRef.cpp
index bd4a739..9093b05 100644
--- a/src/images/SkImageRef.cpp
+++ b/src/images/SkImageRef.cpp
@@ -18,7 +18,7 @@
 
 ///////////////////////////////////////////////////////////////////////////////
 
-SkImageRef::SkImageRef(SkStream* stream, SkBitmap::Config config,
+SkImageRef::SkImageRef(SkStreamRewindable* stream, SkBitmap::Config config,
                        int sampleSize, SkBaseMutex* mutex)
         : SkPixelRef(mutex), fErrorInDecoding(false) {
     SkASSERT(stream);
@@ -79,7 +79,7 @@
 
 ///////////////////////////////////////////////////////////////////////////////
 
-bool SkImageRef::onDecode(SkImageDecoder* codec, SkStream* stream,
+bool SkImageRef::onDecode(SkImageDecoder* codec, SkStreamRewindable* stream,
                           SkBitmap* bitmap, SkBitmap::Config config,
                           SkImageDecoder::Mode mode) {
     return codec->decode(stream, bitmap, config, mode);
diff --git a/src/images/SkImageRef_GlobalPool.cpp b/src/images/SkImageRef_GlobalPool.cpp
index 6af8653..352dd42 100644
--- a/src/images/SkImageRef_GlobalPool.cpp
+++ b/src/images/SkImageRef_GlobalPool.cpp
@@ -24,7 +24,7 @@
     return gPool;
 }
 
-SkImageRef_GlobalPool::SkImageRef_GlobalPool(SkStream* stream,
+SkImageRef_GlobalPool::SkImageRef_GlobalPool(SkStreamRewindable* stream,
                                              SkBitmap::Config config,
                                              int sampleSize)
         : SkImageRef(stream, config, sampleSize, &gGlobalPoolMutex) {
@@ -44,7 +44,7 @@
  *  that we also are already inside the mutex. Hence, we can reference
  *  the global-pool directly.
  */
-bool SkImageRef_GlobalPool::onDecode(SkImageDecoder* codec, SkStream* stream,
+bool SkImageRef_GlobalPool::onDecode(SkImageDecoder* codec, SkStreamRewindable* stream,
                                      SkBitmap* bitmap, SkBitmap::Config config,
                                      SkImageDecoder::Mode mode) {
     if (!this->INHERITED::onDecode(codec, stream, bitmap, config, mode)) {
diff --git a/src/images/SkImageRef_ashmem.cpp b/src/images/SkImageRef_ashmem.cpp
index a4058ff..0186bf6 100644
--- a/src/images/SkImageRef_ashmem.cpp
+++ b/src/images/SkImageRef_ashmem.cpp
@@ -31,7 +31,7 @@
     return newsize;
 }
 
-SkImageRef_ashmem::SkImageRef_ashmem(SkStream* stream,
+SkImageRef_ashmem::SkImageRef_ashmem(SkStreamRewindable* stream,
                                              SkBitmap::Config config,
                                              int sampleSize)
         : SkImageRef(stream, config, sampleSize) {
@@ -126,7 +126,7 @@
     const char*  fName;
 };
 
-bool SkImageRef_ashmem::onDecode(SkImageDecoder* codec, SkStream* stream,
+bool SkImageRef_ashmem::onDecode(SkImageDecoder* codec, SkStreamRewindable* stream,
                                  SkBitmap* bitmap, SkBitmap::Config config,
                                  SkImageDecoder::Mode mode) {
 
diff --git a/src/images/SkImageRef_ashmem.h b/src/images/SkImageRef_ashmem.h
index f98507a..efee5e7 100644
--- a/src/images/SkImageRef_ashmem.h
+++ b/src/images/SkImageRef_ashmem.h
@@ -19,7 +19,7 @@
 
 class SkImageRef_ashmem : public SkImageRef {
 public:
-    SkImageRef_ashmem(SkStream*, SkBitmap::Config, int sampleSize = 1);
+    SkImageRef_ashmem(SkStreamRewindable*, SkBitmap::Config, int sampleSize = 1);
     virtual ~SkImageRef_ashmem();
 
     SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkImageRef_ashmem)
@@ -28,7 +28,7 @@
     SkImageRef_ashmem(SkFlattenableReadBuffer&);
     virtual void flatten(SkFlattenableWriteBuffer&) const SK_OVERRIDE;
 
-    virtual bool onDecode(SkImageDecoder* codec, SkStream* stream,
+    virtual bool onDecode(SkImageDecoder* codec, SkStreamRewindable* stream,
                           SkBitmap* bitmap, SkBitmap::Config config,
                           SkImageDecoder::Mode mode);
 
diff --git a/src/images/SkMovie.cpp b/src/images/SkMovie.cpp
index 2560014..d2439eb 100644
--- a/src/images/SkMovie.cpp
+++ b/src/images/SkMovie.cpp
@@ -92,6 +92,6 @@
 }
 
 SkMovie* SkMovie::DecodeFile(const char path[]) {
-    SkAutoTUnref<SkStream> stream(SkStream::NewFromFile(path));
+    SkAutoTUnref<SkStreamRewindable> stream(SkStream::NewFromFile(path));
     return stream.get() ? SkMovie::DecodeStream(stream) : NULL;
 }
diff --git a/src/images/SkMovie_gif.cpp b/src/images/SkMovie_gif.cpp
index e4c7003..b6d068a 100644
--- a/src/images/SkMovie_gif.cpp
+++ b/src/images/SkMovie_gif.cpp
@@ -432,7 +432,7 @@
 
 #include "SkTRegistry.h"
 
-SkMovie* Factory(SkStream* stream) {
+SkMovie* Factory(SkStreamRewindable* 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 ||
@@ -446,4 +446,4 @@
     return NULL;
 }
 
-static SkTRegistry<SkMovie*(*)(SkStream*)> gReg(Factory);
+static SkTRegistry<SkMovie*(*)(SkStreamRewindable*)> gReg(Factory);