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

Unified Diff: include/core/SkImage.h

Issue 1310633006: Add a SkPixelSerializer SkImage encode variant (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: updated 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 | « no previous file | src/core/SkWriteBuffer.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/core/SkImage.h
diff --git a/include/core/SkImage.h b/include/core/SkImage.h
index 5b9e2031758f8ebc317041289a0603f8113d1ece..763ccc6882815b941cdf0996c3d83e8fbcb5b16f 100644
--- a/include/core/SkImage.h
+++ b/include/core/SkImage.h
@@ -21,6 +21,7 @@ class SkColorTable;
class SkImageGenerator;
class SkPaint;
class SkPicture;
+class SkPixelSerializer;
class SkString;
class SkSurface;
class SkSurfaceProps;
@@ -223,9 +224,16 @@ public:
*/
SkData* encode(SkImageEncoder::Type, int quality) const;
- SkData* encode() const {
- return this->encode(SkImageEncoder::kPNG_Type, 100);
- }
+ /**
+ * Encode the image's pixels using an optional SkPixelSerializer, and return the result
+ * as a caller-managed SkData.
+ *
+ * If the serializer is NULL, a default PNG encoder (with quality == 100) will be used.
reed1 2015/09/03 02:36:13 How about this as a way to organize this wackiness
f(malita) 2015/09/03 14:10:27 (this looks truncated, did you have more text whic
+ *
+ * This method may return exising encoded data (from refEncoded) if it passes the
+ * serializer's useEncodedData() test, or the serializer itself is NULL.
+ */
+ SkData* encode(SkPixelSerializer* = nullptr) const;
/**
* If the image already has its contents in encoded form (e.g. PNG or JPEG), return a ref
« no previous file with comments | « no previous file | src/core/SkWriteBuffer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698