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

Side by Side 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: Respond to comments. 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | src/core/SkBitmap.cpp » ('j') | src/core/SkBitmap.cpp » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2007 The Android Open Source Project 3 * Copyright 2007 The Android Open Source Project
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 9
10 #ifndef SkPicture_DEFINED 10 #ifndef SkPicture_DEFINED
11 #define SkPicture_DEFINED 11 #define SkPicture_DEFINED
12 12
13 #include "SkBitmap.h" 13 #include "SkBitmap.h"
14 #include "SkRefCnt.h" 14 #include "SkRefCnt.h"
15 15
16 class SkBBoxHierarchy; 16 class SkBBoxHierarchy;
17 class SkCanvas; 17 class SkCanvas;
18 class SkDrawPictureCallback; 18 class SkDrawPictureCallback;
19 class SkData;
19 class SkPicturePlayback; 20 class SkPicturePlayback;
20 class SkPictureRecord; 21 class SkPictureRecord;
21 class SkStream; 22 class SkStream;
22 class SkWStream; 23 class SkWStream;
23 24
24 /** \class SkPicture 25 /** \class SkPicture
25 26
26 The SkPicture class records the drawing commands made to a canvas, to 27 The SkPicture class records the drawing commands made to a canvas, to
27 be played back at a later time. 28 be played back at a later time.
28 */ 29 */
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 int width() const { return fWidth; } 164 int width() const { return fWidth; }
164 165
165 /** Return the height of the picture's recording canvas. This 166 /** Return the height of the picture's recording canvas. This
166 value reflects what was passed to setSize(), and does not necessarily 167 value reflects what was passed to setSize(), and does not necessarily
167 reflect the bounds of what has been recorded into the picture. 168 reflect the bounds of what has been recorded into the picture.
168 @return the height of the picture's recording canvas 169 @return the height of the picture's recording canvas
169 */ 170 */
170 int height() const { return fHeight; } 171 int height() const { return fHeight; }
171 172
172 /** 173 /**
173 * Function to encode an SkBitmap to an SkWStream. A function with this 174 * Function to encode an SkBitmap to an SkData. A function with this
174 * signature can be passed to serialize() and SkOrderedWriteBuffer. The 175 * signature can be passed to serialize() and SkOrderedWriteBuffer.
175 * function should return true if it succeeds. Otherwise it should return 176 * Returning NULL will tell the SkOrderedWriteBuffer to use
176 * false so that SkOrderedWriteBuffer can switch to another method of 177 * SkBitmap::flatten() to store the bitmap.
177 * storing SkBitmaps. 178 * @param pixelRefOffset Output parameter, telling the deserializer what
djsollen 2013/05/21 14:10:44 what happens if this is null? Also we usually put
scroggo 2013/05/21 16:14:15 This is a function signature, so it will depend on
179 * offset in the bm's pixelRef corresponds to the encoded data.
180 * @return SkData If non-NULL, holds encoded data representing the passed
181 * in bitmap. The caller is responsible for calling unref().
178 */ 182 */
179 typedef bool (*EncodeBitmap)(SkWStream*, const SkBitmap&); 183 typedef SkData* (*EncodeBitmap)(size_t* pixelRefOffset, const SkBitmap& bm);
180 184
181 /** 185 /**
182 * Serialize to a stream. If non NULL, encoder will be used to encode 186 * Serialize to a stream. If non NULL, encoder will be used to encode
183 * any bitmaps in the picture. 187 * any bitmaps in the picture.
184 */ 188 */
185 void serialize(SkWStream*, EncodeBitmap encoder = NULL) const; 189 void serialize(SkWStream*, EncodeBitmap encoder = NULL) const;
186 190
187 #ifdef SK_BUILD_FOR_ANDROID 191 #ifdef SK_BUILD_FOR_ANDROID
188 /** Signals that the caller is prematurely done replaying the drawing 192 /** Signals that the caller is prematurely done replaying the drawing
189 commands. This can be called from a canvas virtual while the picture 193 commands. This can be called from a canvas virtual while the picture
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 */ 263 */
260 class SkDrawPictureCallback { 264 class SkDrawPictureCallback {
261 public: 265 public:
262 SkDrawPictureCallback() {} 266 SkDrawPictureCallback() {}
263 virtual ~SkDrawPictureCallback() {} 267 virtual ~SkDrawPictureCallback() {}
264 268
265 virtual bool abortDrawing() = 0; 269 virtual bool abortDrawing() = 0;
266 }; 270 };
267 271
268 #endif 272 #endif
OLDNEW
« no previous file with comments | « no previous file | src/core/SkBitmap.cpp » ('j') | src/core/SkBitmap.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698