Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(665)

Unified Diff: src/images/SkImageDecoder.cpp

Issue 23477009: Change SkImageDecoders to take an SkStreamRewindable. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Remove accidental whitespace change Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/images/SkImageDecoder.cpp
diff --git a/src/images/SkImageDecoder.cpp b/src/images/SkImageDecoder.cpp
index 7c4c477e078c40fbb584da79590e775a30229775..a9204f1f8bb252441203f89b0ebc47a7d32b4a4a 100644
--- a/src/images/SkImageDecoder.cpp
+++ b/src/images/SkImageDecoder.cpp
@@ -186,7 +186,7 @@ SkBitmap::Config SkImageDecoder::getPrefConfig(SrcDepth srcDepth,
return config;
}
-bool SkImageDecoder::decode(SkStream* stream, SkBitmap* bm,
+bool SkImageDecoder::decode(SkStreamRewindable* stream, SkBitmap* bm,
SkBitmap::Config pref, Mode mode) {
// we reset this to false before calling onDecode
fShouldCancelDecode = false;
@@ -213,8 +213,8 @@ bool SkImageDecoder::decodeSubset(SkBitmap* bm, const SkIRect& rect,
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 @@ bool SkImageDecoder::DecodeFile(const char file[], SkBitmap* bm,
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);
@@ -337,7 +337,7 @@ private:
* @return True if the bounds were decoded and the bitmap is 8888 or can be
* copied to 8888.
*/
-static bool decode_bounds_to_8888(SkImageDecoder* decoder, SkStream* stream,
+static bool decode_bounds_to_8888(SkImageDecoder* decoder, SkStreamRewindable* stream,
SkBitmap* bitmap) {
SkASSERT(decoder != NULL);
SkASSERT(stream != NULL);
@@ -370,7 +370,7 @@ static bool decode_bounds_to_8888(SkImageDecoder* decoder, SkStream* stream,
* @param target Preallocated memory for storing pixels.
* @return bool Whether the decode (and copy, if necessary) succeeded.
*/
-static bool decode_pixels_to_8888(SkImageDecoder* decoder, SkStream* stream,
+static bool decode_pixels_to_8888(SkImageDecoder* decoder, SkStreamRewindable* stream,
SkBitmap* bitmap, void* target) {
SkASSERT(decoder != NULL);
SkASSERT(stream != NULL);
@@ -445,8 +445,9 @@ bool SkImageDecoder::DecodeMemoryToTarget(const void* buffer, size_t size,
}
-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);

Powered by Google App Engine
This is Rietveld 408576698