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

Unified Diff: include/core/SkImageEncoder.h

Issue 1373683003: change pixel-serializer to support reencoding existing data Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: I hate this warning Created 5 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 | « gyp/core.gypi ('k') | include/core/SkPixelSerializer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « gyp/core.gypi ('k') | include/core/SkPixelSerializer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698