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

Unified Diff: include/core/SkImageDecoder.h

Issue 1018953003: Add SkEncodedFormat, used by SkCodec. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Use a common enum for SkImageEncoder and SkImageDecoder and SkCodec Created 5 years, 9 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: include/core/SkImageDecoder.h
diff --git a/include/core/SkImageDecoder.h b/include/core/SkImageDecoder.h
index 4dfd3c24e091e67067fa04c1ace149223bf5e07f..94428c0dc43a1de41d9921b229bf1bf091b26546 100644
--- a/include/core/SkImageDecoder.h
+++ b/include/core/SkImageDecoder.h
@@ -9,6 +9,7 @@
#define SkImageDecoder_DEFINED
#include "SkBitmap.h"
+#include "SkEncodedFormat.h"
#include "SkImage.h"
#include "SkRect.h"
#include "SkRefCnt.h"
@@ -26,26 +27,10 @@ class SkImageDecoder : SkNoncopyable {
public:
virtual ~SkImageDecoder();
- enum Format {
scroggo 2015/03/19 20:00:21 I could leave this unchanged, since we're removing
- kUnknown_Format,
- kBMP_Format,
- kGIF_Format,
- kICO_Format,
- kJPEG_Format,
- kPNG_Format,
- kWBMP_Format,
- kWEBP_Format,
- kPKM_Format,
- kKTX_Format,
- kASTC_Format,
-
- kLastKnownFormat = kKTX_Format,
- };
-
/** Return the format of image this decoder can decode. If this decoder can decode multiple
formats, kUnknown_Format will be returned.
*/
- virtual Format getFormat() const;
+ virtual SkEncodedFormat getFormat() const;
/** If planes or rowBytes is NULL, decodes the header and computes componentSizes
for memory allocation.
@@ -56,14 +41,15 @@ public:
bool decodeYUV8Planes(SkStream* stream, SkISize componentSizes[3], void* planes[3],
size_t rowBytes[3], SkYUVColorSpace*);
- /** Return the format of the SkStreamRewindable or kUnknown_Format if it cannot be determined.
+ /** Return the format of the SkStreamRewindable or kUnknown_SkEncodedFormat if it cannot be
+ determined.
Rewinds the stream before returning.
*/
- static Format GetStreamFormat(SkStreamRewindable*);
+ static SkEncodedFormat GetStreamFormat(SkStreamRewindable*);
/** Return a readable string of the Format provided.
*/
- static const char* GetFormatName(Format);
+ static const char* GetFormatName(SkEncodedFormat);
/** Return a readable string of the value returned by getFormat().
*/
@@ -272,7 +258,7 @@ public:
of the decoded file. On failure it is ignored.
*/
static bool DecodeFile(const char file[], SkBitmap* bitmap, SkColorType pref, Mode,
- Format* format = NULL);
+ SkEncodedFormat* format = NULL);
static bool DecodeFile(const char file[], SkBitmap* bitmap) {
return DecodeFile(file, bitmap, kUnknown_SkColorType, kDecodePixels_Mode, NULL);
}
@@ -286,7 +272,7 @@ public:
of the decoded buffer. On failure it is ignored.
*/
static bool DecodeMemory(const void* buffer, size_t size, SkBitmap* bitmap, SkColorType pref,
- Mode, Format* format = NULL);
+ Mode, SkEncodedFormat* format = NULL);
static bool DecodeMemory(const void* buffer, size_t size, SkBitmap* bitmap){
return DecodeMemory(buffer, size, bitmap, kUnknown_SkColorType, kDecodePixels_Mode, NULL);
}
@@ -300,7 +286,7 @@ public:
of the decoded stream. On failure it is ignored.
*/
static bool DecodeStream(SkStreamRewindable* stream, SkBitmap* bitmap, SkColorType pref, Mode,
- Format* format = NULL);
+ SkEncodedFormat* format = NULL);
static bool DecodeStream(SkStreamRewindable* stream, SkBitmap* bitmap) {
return DecodeStream(stream, bitmap, kUnknown_SkColorType, kDecodePixels_Mode, NULL);
}
@@ -463,7 +449,7 @@ DECLARE_DECODER_CREATOR(ASTCImageDecoder);
// Typedefs to make registering decoder and formatter callbacks easier.
// These have to be defined outside SkImageDecoder. :(
-typedef SkTRegistry<SkImageDecoder*(*)(SkStreamRewindable*)> SkImageDecoder_DecodeReg;
-typedef SkTRegistry<SkImageDecoder::Format(*)(SkStreamRewindable*)> SkImageDecoder_FormatReg;
+typedef SkTRegistry<SkImageDecoder*(*)(SkStreamRewindable*)> SkImageDecoder_DecodeReg;
+typedef SkTRegistry<SkEncodedFormat(*)(SkStreamRewindable*)> SkImageDecoder_FormatReg;
#endif

Powered by Google App Engine
This is Rietveld 408576698