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 |
311 void createHeader(SkPictInfo* info) const; | 340 void createHeader(SkPictInfo* info) const; |
312 static bool IsValidPictInfo(const SkPictInfo& info); | 341 static bool IsValidPictInfo(const SkPictInfo& info); |
313 | 342 |
314 friend class SkFlatPicture; | 343 friend class SkFlatPicture; |
315 friend class SkPicturePlayback; | 344 friend class SkPicturePlayback; |
| 345 friend class SkGpuDevice; |
316 | 346 |
317 typedef SkRefCnt INHERITED; | 347 typedef SkRefCnt INHERITED; |
318 }; | 348 }; |
319 | 349 |
320 /** | 350 /** |
321 * Subclasses of this can be passed to canvas.drawPicture. During the drawing | 351 * Subclasses of this can be passed to canvas.drawPicture. During the drawing |
322 * of the picture, this callback will periodically be invoked. If its | 352 * of the picture, this callback will periodically be invoked. If its |
323 * abortDrawing() returns true, then picture playback will be interrupted. | 353 * abortDrawing() returns true, then picture playback will be interrupted. |
324 * | 354 * |
325 * The resulting drawing is undefined, as there is no guarantee how often the | 355 * The resulting drawing is undefined, as there is no guarantee how often the |
326 * callback will be invoked. If the abort happens inside some level of nested | 356 * callback will be invoked. If the abort happens inside some level of nested |
327 * calls to save(), restore will automatically be called to return the state | 357 * calls to save(), restore will automatically be called to return the state |
328 * to the same level it was before the drawPicture call was made. | 358 * to the same level it was before the drawPicture call was made. |
329 */ | 359 */ |
330 class SK_API SkDrawPictureCallback { | 360 class SK_API SkDrawPictureCallback { |
331 public: | 361 public: |
332 SkDrawPictureCallback() {} | 362 SkDrawPictureCallback() {} |
333 virtual ~SkDrawPictureCallback() {} | 363 virtual ~SkDrawPictureCallback() {} |
334 | 364 |
335 virtual bool abortDrawing() = 0; | 365 virtual bool abortDrawing() = 0; |
336 }; | 366 }; |
337 | 367 |
338 #endif | 368 #endif |
OLD | NEW |