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

Unified Diff: include/core/SkImageDecoder.h

Issue 23477009: Change SkImageDecoders to take an SkStreamRewindable. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Only switch to SkStreamRewindable when necessary. Created 7 years, 3 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
« no previous file with comments | « no previous file | include/images/SkImageRef.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/core/SkImageDecoder.h
diff --git a/include/core/SkImageDecoder.h b/include/core/SkImageDecoder.h
index a8cbe6341332e4efcffe751589736c7b67d01758..bff749538f9176ea1eb644efbdda04cf2b53d00c 100644
--- a/include/core/SkImageDecoder.h
+++ b/include/core/SkImageDecoder.h
@@ -19,6 +19,7 @@
#include "SkTypes.h"
class SkStream;
+class SkStreamRewindable;
/** \class SkImageDecoder
@@ -46,10 +47,10 @@ public:
*/
virtual Format getFormat() const;
- /** Return the format of the SkStream or kUnknown_Format if it cannot be determined. Rewinds the
- stream before returning.
+ /** Return the format of the SkStreamRewindable or kUnknown_Format if it cannot be determined.
+ Rewinds the stream before returning.
*/
- static Format GetStreamFormat(SkStream*);
+ static Format GetStreamFormat(SkStreamRewindable*);
/** Return a readable string of the Format provided.
*/
@@ -290,7 +291,7 @@ public:
*
* Return true for success or false on failure.
*/
- bool buildTileIndex(SkStream*, int *width, int *height);
+ bool buildTileIndex(SkStreamRewindable*, int *width, int *height);
/**
* Decode a rectangle subset in the image.
@@ -312,7 +313,7 @@ public:
/** Given a stream, this will try to find an appropriate decoder object.
If none is found, the method returns NULL.
*/
- static SkImageDecoder* Factory(SkStream*);
+ static SkImageDecoder* Factory(SkStreamRewindable*);
/** Decode the image stored in the specified file, and store the result
in bitmap. Return true for success or false on failure.
@@ -374,7 +375,7 @@ public:
static bool DecodeMemoryToTarget(const void* buffer, size_t size, SkImage::Info* info,
const SkBitmapFactory::Target* target);
- /** Decode the image stored in the specified SkStream, and store the result
+ /** Decode the image stored in the specified SkStreamRewindable, and store the result
in bitmap. Return true for success or false on failure.
@param prefConfig If the PrefConfigTable is not set, prefer this config.
@@ -383,10 +384,10 @@ public:
@param format On success, if format is non-null, it is set to the format
of the decoded stream. On failure it is ignored.
*/
- static bool DecodeStream(SkStream* stream, SkBitmap* bitmap,
+ static bool DecodeStream(SkStreamRewindable* stream, SkBitmap* bitmap,
SkBitmap::Config prefConfig, Mode,
Format* format = NULL);
- static bool DecodeStream(SkStream* stream, SkBitmap* bitmap) {
+ static bool DecodeStream(SkStreamRewindable* stream, SkBitmap* bitmap) {
return DecodeStream(stream, bitmap, SkBitmap::kNo_Config,
kDecodePixels_Mode, NULL);
}
@@ -411,7 +412,7 @@ protected:
// If the decoder wants to support tiled based decoding,
// this method must be overridden. This guy is called by buildTileIndex(...)
- virtual bool onBuildTileIndex(SkStream*, int *width, int *height) {
+ virtual bool onBuildTileIndex(SkStreamRewindable*, int *width, int *height) {
return false;
}
@@ -522,7 +523,7 @@ class SkImageDecoderFactory : public SkRefCnt {
public:
SK_DECLARE_INST_COUNT(SkImageDecoderFactory)
- virtual SkImageDecoder* newDecoder(SkStream*) = 0;
+ virtual SkImageDecoder* newDecoder(SkStreamRewindable*) = 0;
private:
typedef SkRefCnt INHERITED;
@@ -531,7 +532,7 @@ private:
class SkDefaultImageDecoderFactory : SkImageDecoderFactory {
public:
// calls SkImageDecoder::Factory(stream)
- virtual SkImageDecoder* newDecoder(SkStream* stream) {
+ virtual SkImageDecoder* newDecoder(SkStreamRewindable* stream) {
return SkImageDecoder::Factory(stream);
}
};
@@ -561,7 +562,7 @@ DECLARE_DECODER_CREATOR(WEBPImageDecoder);
// Typedefs to make registering decoder and formatter callbacks easier.
// These have to be defined outside SkImageDecoder. :(
-typedef SkTRegistry<SkImageDecoder*(*)(SkStream*)> SkImageDecoder_DecodeReg;
-typedef SkTRegistry<SkImageDecoder::Format(*)(SkStream*)> SkImageDecoder_FormatReg;
+typedef SkTRegistry<SkImageDecoder*(*)(SkStreamRewindable*)> SkImageDecoder_DecodeReg;
+typedef SkTRegistry<SkImageDecoder::Format(*)(SkStreamRewindable*)> SkImageDecoder_FormatReg;
#endif
« no previous file with comments | « no previous file | include/images/SkImageRef.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698