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

Side by Side Diff: include/core/SkPicture.h

Issue 176863004: Add new skpinfo tool (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Addressed code review comments Created 6 years, 9 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
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
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 210
211 #ifdef SK_BUILD_FOR_ANDROID 211 #ifdef SK_BUILD_FOR_ANDROID
212 /** Signals that the caller is prematurely done replaying the drawing 212 /** Signals that the caller is prematurely done replaying the drawing
213 commands. This can be called from a canvas virtual while the picture 213 commands. This can be called from a canvas virtual while the picture
214 is drawing. Has no effect if the picture is not drawing. 214 is drawing. Has no effect if the picture is not drawing.
215 @deprecated preserving for legacy purposes 215 @deprecated preserving for legacy purposes
216 */ 216 */
217 void abortPlayback(); 217 void abortPlayback();
218 #endif 218 #endif
219 219
220 // Return true if the SkStream/Buffer represents a serialized picture, and
221 // fills out SkPictInfo. After this function returns, the data source is not
222 // rewound so it will have to be manually reset before passing to
223 // CreateFromStream or CreateFromBuffer. Note, CreateFromStream and
224 // CreateFromBuffer perform this check internally so these entry points are
225 // intended for stand alone tools.
226 // If false is returned, SkPictInfo is unmodified.
reed1 2014/03/03 16:24:28 Do we expect to support these for chrome or other
robertphillips 2014/03/03 18:44:24 Done.
227 static bool StreamIsSKP(SkStream*, SkPictInfo*);
228 static bool BufferIsSKP(SkReadBuffer&, SkPictInfo*);
229
220 protected: 230 protected:
221 // V2 : adds SkPixelRef's generation ID. 231 // V2 : adds SkPixelRef's generation ID.
222 // V3 : PictInfo tag at beginning, and EOF tag at the end 232 // V3 : PictInfo tag at beginning, and EOF tag at the end
223 // V4 : move SkPictInfo to be the header 233 // V4 : move SkPictInfo to be the header
224 // V5 : don't read/write FunctionPtr on cross-process (we can detect that) 234 // V5 : don't read/write FunctionPtr on cross-process (we can detect that)
225 // V6 : added serialization of SkPath's bounds (and packed its flags tighter ) 235 // V6 : added serialization of SkPath's bounds (and packed its flags tighter )
226 // V7 : changed drawBitmapRect(IRect) to drawBitmapRectToRect(Rect) 236 // V7 : changed drawBitmapRect(IRect) to drawBitmapRectToRect(Rect)
227 // V8 : Add an option for encoding bitmaps 237 // V8 : Add an option for encoding bitmaps
228 // V9 : Allow the reader and writer of an SKP disagree on whether to support 238 // V9 : Allow the reader and writer of an SKP disagree on whether to support
229 // SK_SUPPORT_HINTING_SCALE_FACTOR 239 // SK_SUPPORT_HINTING_SCALE_FACTOR
(...skipping 25 matching lines...) Expand all
255 SkPictureRecord* fRecord; 265 SkPictureRecord* fRecord;
256 int fWidth, fHeight; 266 int fWidth, fHeight;
257 267
258 // Create a new SkPicture from an existing SkPicturePlayback. Ref count of 268 // Create a new SkPicture from an existing SkPicturePlayback. Ref count of
259 // playback is unchanged. 269 // playback is unchanged.
260 SkPicture(SkPicturePlayback*, int width, int height); 270 SkPicture(SkPicturePlayback*, int width, int height);
261 271
262 // For testing. Derived classes may instantiate an alternate 272 // For testing. Derived classes may instantiate an alternate
263 // SkBBoxHierarchy implementation 273 // SkBBoxHierarchy implementation
264 virtual SkBBoxHierarchy* createBBoxHierarchy() const; 274 virtual SkBBoxHierarchy* createBBoxHierarchy() const;
265
266 // Return true if the SkStream represents a serialized picture, and fills ou t
267 // SkPictInfo. After this function returns, the SkStream is not rewound; it
268 // will be ready to be parsed to create an SkPicturePlayback.
269 // If false is returned, SkPictInfo is unmodified.
270 static bool StreamIsSKP(SkStream*, SkPictInfo*);
271 static bool BufferIsSKP(SkReadBuffer&, SkPictInfo*);
272 private: 275 private:
273 void createHeader(void* header) const; 276 void createHeader(void* header) const;
274 277
275 friend class SkFlatPicture; 278 friend class SkFlatPicture;
276 friend class SkPicturePlayback; 279 friend class SkPicturePlayback;
277 280
278 typedef SkRefCnt INHERITED; 281 typedef SkRefCnt INHERITED;
279 }; 282 };
280 283
281 /** 284 /**
282 * Subclasses of this can be passed to canvas.drawPicture. During the drawing 285 * Subclasses of this can be passed to canvas.drawPicture. During the drawing
283 * of the picture, this callback will periodically be invoked. If its 286 * of the picture, this callback will periodically be invoked. If its
284 * abortDrawing() returns true, then picture playback will be interrupted. 287 * abortDrawing() returns true, then picture playback will be interrupted.
285 * 288 *
286 * The resulting drawing is undefined, as there is no guarantee how often the 289 * The resulting drawing is undefined, as there is no guarantee how often the
287 * callback will be invoked. If the abort happens inside some level of nested 290 * callback will be invoked. If the abort happens inside some level of nested
288 * calls to save(), restore will automatically be called to return the state 291 * calls to save(), restore will automatically be called to return the state
289 * to the same level it was before the drawPicture call was made. 292 * to the same level it was before the drawPicture call was made.
290 */ 293 */
291 class SK_API SkDrawPictureCallback { 294 class SK_API SkDrawPictureCallback {
292 public: 295 public:
293 SkDrawPictureCallback() {} 296 SkDrawPictureCallback() {}
294 virtual ~SkDrawPictureCallback() {} 297 virtual ~SkDrawPictureCallback() {}
295 298
296 virtual bool abortDrawing() = 0; 299 virtual bool abortDrawing() = 0;
297 }; 300 };
298 301
299 #endif 302 #endif
OLDNEW
« no previous file with comments | « gyp/tools.gyp ('k') | src/core/SkPicture.cpp » ('j') | tools/skpinfo.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698