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

Unified Diff: include/core/SkPicture.h

Issue 15489004: New API for encoding bitmaps during serialization. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Remove dead code, keep original data in rerecord. Created 7 years, 7 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/SkBitmap.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/core/SkPicture.h
diff --git a/include/core/SkPicture.h b/include/core/SkPicture.h
index b2c2b62edec4ee3684dc4ef4ef3129a1e29f2ad8..f3057016e19443c9e5be961e9ac7cca264cee4b0 100644
--- a/include/core/SkPicture.h
+++ b/include/core/SkPicture.h
@@ -15,6 +15,7 @@
class SkBBoxHierarchy;
class SkCanvas;
+class SkData;
class SkPicturePlayback;
class SkPictureRecord;
class SkStream;
@@ -168,14 +169,28 @@ public:
*/
int height() const { return fHeight; }
+ enum RecordPixelRefOffset {
+ kYes_RecordPixelRefOffset,
+ kNo_RecordPixelRefOffset,
+ };
+
/**
- * Function to encode an SkBitmap to an SkWStream. A function with this
- * signature can be passed to serialize() and SkOrderedWriteBuffer. The
- * function should return true if it succeeds. Otherwise it should return
- * false so that SkOrderedWriteBuffer can switch to another method of
- * storing SkBitmaps.
+ * Function to encode an SkBitmap to an SkData. A function with this
+ * signature can be passed to serialize() and SkOrderedWriteBuffer.
+ * Returning NULL will tell the SkOrderedWriteBuffer to use
+ * SkBitmap::flatten() to store the bitmap.
+ * @param RecordPixelRefOffset Output parameter, telling the
+ * SkOrderedWriteBuffer whether to record the bitmap's pixelRefOffset.
+ * If set to kYes_RecordPixelRefOffset, the returned SkData contains
+ * compressed data containing the entire image, so the pixelRefOffset
+ * should also be recorded to the stream. If set to
+ * kNo_RecordPixelRefOffset, only the extracted subset is written to
+ * the returned SkData, so the offset should not be written to the
+ * stream.
+ * @return SkData If non-NULL, holds encoded data representing the passed
+ * in bitmap. The caller is responsible for calling unref().
*/
- typedef bool (*EncodeBitmap)(SkWStream*, const SkBitmap&);
+ typedef SkData* (*EncodeBitmap)(RecordPixelRefOffset*, const SkBitmap&);
scroggo 2013/05/20 19:50:52 Mike, you mentioned perhaps wanting to use the sam
/**
* Serialize to a stream. If non NULL, encoder will be used to encode
« no previous file with comments | « no previous file | src/core/SkBitmap.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698