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

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: Fix ifdef'd out code 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 83aee4b2be4aea4e3d19fe1165bbe89fe664cd47..837916e58d2ca0131bc3ff69394e066816131c22 100644
--- a/include/core/SkPicture.h
+++ b/include/core/SkPicture.h
@@ -16,6 +16,7 @@
class SkBBoxHierarchy;
class SkCanvas;
class SkDrawPictureCallback;
+class SkData;
class SkPicturePlayback;
class SkPictureRecord;
class SkStream;
@@ -170,17 +171,21 @@ public:
int height() const { return fHeight; }
/**
- * 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 pixelRefOffset Output parameter, telling the deserializer what
+ * offset in the bm's pixelRef corresponds to the encoded data.
+ * @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)(size_t* pixelRefOffset, const SkBitmap& bm);
reed1 2013/05/21 18:30:47 mike nit: I like the output-param to be last, but
/**
* Serialize to a stream. If non NULL, encoder will be used to encode
* any bitmaps in the picture.
+ * encoder will never be called with a NULL pixelRefOffset.
*/
void serialize(SkWStream*, EncodeBitmap encoder = NULL) const;
« 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