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

Unified Diff: src/images/SkImageDecoder_libgif.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_libgif.cpp
diff --git a/src/images/SkImageDecoder_libgif.cpp b/src/images/SkImageDecoder_libgif.cpp
index d368eccd92d629537ae7b8cedf68b1dc29d81970..a15307280e04babc8b877b978d8bac7bfef0d8d2 100644
--- a/src/images/SkImageDecoder_libgif.cpp
+++ b/src/images/SkImageDecoder_libgif.cpp
@@ -23,7 +23,7 @@ public:
}
protected:
- virtual bool onDecode(SkStream* stream, SkBitmap* bm, Mode mode) SK_OVERRIDE;
+ virtual bool onDecode(SkStreamRewindable* stream, SkBitmap* bm, Mode mode) SK_OVERRIDE;
private:
typedef SkImageDecoder INHERITED;
@@ -93,7 +93,7 @@ private:
static int DecodeCallBackProc(GifFileType* fileType, GifByteType* out,
int size) {
- SkStream* stream = (SkStream*) fileType->UserData;
+ SkStreamRewindable* stream = (SkStreamRewindable*) fileType->UserData;
return (int) stream->read(out, size);
}
@@ -154,7 +154,7 @@ static bool error_return(GifFileType* gif, const SkBitmap& bm,
return false;
}
-bool SkGIFImageDecoder::onDecode(SkStream* sk_stream, SkBitmap* bm, Mode mode) {
+bool SkGIFImageDecoder::onDecode(SkStreamRewindable* sk_stream, SkBitmap* bm, Mode mode) {
#if GIFLIB_MAJOR < 5
GifFileType* gif = DGifOpen(sk_stream, DecodeCallBackProc);
#else
@@ -356,7 +356,7 @@ DONE:
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 ||
@@ -370,20 +370,20 @@ static bool is_gif(SkStream* stream) {
#include "SkTRegistry.h"
-static SkImageDecoder* sk_libgif_dfactory(SkStream* stream) {
+static SkImageDecoder* sk_libgif_dfactory(SkStreamRewindable* stream) {
if (is_gif(stream)) {
return SkNEW(SkGIFImageDecoder);
}
return NULL;
}
-static SkTRegistry<SkImageDecoder*, SkStream*> gReg(sk_libgif_dfactory);
+static SkTRegistry<SkImageDecoder*, SkStreamRewindable*> 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;
}
return SkImageDecoder::kUnknown_Format;
}
-static SkTRegistry<SkImageDecoder::Format, SkStream*> gFormatReg(get_format_gif);
+static SkTRegistry<SkImageDecoder::Format, SkStreamRewindable*> gFormatReg(get_format_gif);

Powered by Google App Engine
This is Rietveld 408576698