OLD | NEW |
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 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
301 const AccelData* fAccelData; | 301 const AccelData* fAccelData; |
302 | 302 |
303 // Create a new SkPicture from an existing SkPicturePlayback. Ref count of | 303 // Create a new SkPicture from an existing SkPicturePlayback. Ref count of |
304 // playback is unchanged. | 304 // playback is unchanged. |
305 SkPicture(SkPicturePlayback*, int width, int height); | 305 SkPicture(SkPicturePlayback*, int width, int height); |
306 | 306 |
307 // For testing. Derived classes may instantiate an alternate | 307 // For testing. Derived classes may instantiate an alternate |
308 // SkBBoxHierarchy implementation | 308 // SkBBoxHierarchy implementation |
309 virtual SkBBoxHierarchy* createBBoxHierarchy() const; | 309 virtual SkBBoxHierarchy* createBBoxHierarchy() const; |
310 private: | 310 private: |
311 // An OperationList encapsulates a set of operation offsets into the picture
byte | |
312 // stream along with the CTMs needed for those operation. | |
313 class OperationList : public SkNoncopyable { | |
314 public: | |
315 virtual ~OperationList() {} | |
316 | |
317 // If valid returns false then there is no optimization data | |
318 // present. All the draw operations need to be issued. | |
319 virtual bool valid() const { return false; } | |
320 | |
321 // The following three entry points should only be accessed if | |
322 // 'valid' returns true. | |
323 virtual int numOps() const { SkASSERT(false); return 0; }; | |
324 // The offset in the picture of the operation to execute. | |
325 virtual uint32_t offset(int index) const { SkASSERT(false); return 0; }; | |
326 // The CTM that must be installed for the operation to behave correctly | |
327 virtual const SkMatrix& matrix(int index) const { SkASSERT(false); retur
n SkMatrix::I(); } | |
328 | |
329 static const OperationList& InvalidList(); | |
330 | |
331 private: | |
332 typedef SkNoncopyable INHERITED; | |
333 }; | |
334 | |
335 /** PRIVATE / EXPERIMENTAL -- do not call | |
336 Return the operations required to render the content inside 'queryRect'. | |
337 */ | |
338 const OperationList& EXPERIMENTAL_getActiveOps(const SkIRect& queryRect); | |
339 | |
340 void createHeader(SkPictInfo* info) const; | 311 void createHeader(SkPictInfo* info) const; |
341 static bool IsValidPictInfo(const SkPictInfo& info); | 312 static bool IsValidPictInfo(const SkPictInfo& info); |
342 | 313 |
343 friend class SkFlatPicture; | 314 friend class SkFlatPicture; |
344 friend class SkPicturePlayback; | 315 friend class SkPicturePlayback; |
345 friend class SkGpuDevice; | |
346 | 316 |
347 typedef SkRefCnt INHERITED; | 317 typedef SkRefCnt INHERITED; |
348 }; | 318 }; |
349 | 319 |
350 /** | 320 /** |
351 * Subclasses of this can be passed to canvas.drawPicture. During the drawing | 321 * Subclasses of this can be passed to canvas.drawPicture. During the drawing |
352 * of the picture, this callback will periodically be invoked. If its | 322 * of the picture, this callback will periodically be invoked. If its |
353 * abortDrawing() returns true, then picture playback will be interrupted. | 323 * abortDrawing() returns true, then picture playback will be interrupted. |
354 * | 324 * |
355 * The resulting drawing is undefined, as there is no guarantee how often the | 325 * The resulting drawing is undefined, as there is no guarantee how often the |
356 * callback will be invoked. If the abort happens inside some level of nested | 326 * callback will be invoked. If the abort happens inside some level of nested |
357 * calls to save(), restore will automatically be called to return the state | 327 * calls to save(), restore will automatically be called to return the state |
358 * to the same level it was before the drawPicture call was made. | 328 * to the same level it was before the drawPicture call was made. |
359 */ | 329 */ |
360 class SK_API SkDrawPictureCallback { | 330 class SK_API SkDrawPictureCallback { |
361 public: | 331 public: |
362 SkDrawPictureCallback() {} | 332 SkDrawPictureCallback() {} |
363 virtual ~SkDrawPictureCallback() {} | 333 virtual ~SkDrawPictureCallback() {} |
364 | 334 |
365 virtual bool abortDrawing() = 0; | 335 virtual bool abortDrawing() = 0; |
366 }; | 336 }; |
367 | 337 |
368 #endif | 338 #endif |
OLD | NEW |