Index: include/core/SkImageEncoder.h |
diff --git a/include/core/SkImageEncoder.h b/include/core/SkImageEncoder.h |
index fc999dcc189d4177de70c6b0a4810bb1e0165de1..5fa69f799297560b473d922b3872c397ccfab680 100644 |
--- a/include/core/SkImageEncoder.h |
+++ b/include/core/SkImageEncoder.h |
@@ -13,6 +13,8 @@ |
class SkBitmap; |
class SkData; |
+class SkPixmap; |
+class SkPixelSerializer; |
class SkWStream; |
class SkImageEncoder { |
@@ -60,8 +62,11 @@ public: |
*/ |
bool encodeStream(SkWStream* stream, const SkBitmap& bm, int quality); |
+ SkPixelSerializer* refSerializer(); |
+ |
static SkData* EncodeData(const SkImageInfo&, const void* pixels, size_t rowBytes, |
Type, int quality); |
+ static SkData* EncodeData(const SkPixmap&, Type, int quality); |
static SkData* EncodeData(const SkBitmap&, Type, int quality); |
static bool EncodeFile(const char file[], const SkBitmap&, Type, |
@@ -69,6 +74,12 @@ public: |
static bool EncodeStream(SkWStream*, const SkBitmap&, Type, |
int quality); |
+ /** |
+ * If the existing data can be re-encoded into the specified type (efficiently), this |
+ * returns that new data (which the caller must unref()). If not, this returns null. |
+ */ |
+ static SkData* ReencodeData(SkData* encoded, Type); |
+ |
protected: |
/** |
* Encode bitmap 'bm' in the desired format, writing results to |
@@ -78,6 +89,8 @@ protected: |
* This must be overridden by each SkImageEncoder implementation. |
*/ |
virtual bool onEncode(SkWStream* stream, const SkBitmap& bm, int quality) = 0; |
+ |
+ virtual SkData* onReencodeData(SkData*) { return nullptr; } |
}; |
// This macro declares a global (i.e., non-class owned) creation entry point |