aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/core/SkImageEncoder.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/core/SkImageEncoder.h')
-rw-r--r--include/core/SkImageEncoder.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/include/core/SkImageEncoder.h b/include/core/SkImageEncoder.h
index fc999dcc18..5fa69f7992 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