Handle SkStream::rewind properly.
include/core/SkStream.h:
Update documentation to state that rewinding a stream at the beginning
should return true. This is important because our decoders fail if
rewind returns false, assuming that the stream is not at the beginning.
src/images/SkImageDecoder_libpng.cpp:
If rewind fails, call png_error.
src/images/SkImageDecoder_libwebp.cpp:
If rewind fails, report an error and return false.
src/images/SkImageRef.cpp:
If rewind fails report an error and return false.
FIXME: Need to handle flattening properly. Should I perhaps move
writeStream into SkOrderedWriteBuffer?
src/images/SkJpegUtility.cpp:
Report a jpeg error on failure to rewind.
BUG=https://b.corp.google.com/issue?id=8432093
R=bungeman@google.com, djsollen@google.com, reed@google.com
Review URL: https://codereview.chromium.org/22861028
git-svn-id: http://skia.googlecode.com/svn/trunk@10977 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/include/core/SkStream.h b/include/core/SkStream.h
index d7a105d..27f8ead 100644
--- a/include/core/SkStream.h
+++ b/include/core/SkStream.h
@@ -96,7 +96,9 @@
SkData* readData();
//SkStreamRewindable
- /** Rewinds to the beginning of the stream. If this cannot be done, return false. */
+ /** Rewinds to the beginning of the stream. Returns true if the stream is known
+ * to be at the beginning after this call returns.
+ */
virtual bool rewind() { return false; }
/** Duplicates this stream. If this cannot be done, returns NULL.