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 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
357 #endif | 357 #endif |
358 | 358 |
359 SkCanvas* beginRecording(int width, int height, SkBBHFactory* factory, uint3
2_t recordFlags); | 359 SkCanvas* beginRecording(int width, int height, SkBBHFactory* factory, uint3
2_t recordFlags); |
360 | 360 |
361 private: | 361 private: |
362 friend class SkPictureRecord; | 362 friend class SkPictureRecord; |
363 friend class SkPictureTester; // for unit testing | 363 friend class SkPictureTester; // for unit testing |
364 | 364 |
365 SkAutoTUnref<SkPathHeap> fPathHeap; // reference counted | 365 SkAutoTUnref<SkPathHeap> fPathHeap; // reference counted |
366 | 366 |
| 367 // ContentInfo is not serialized! It is intended solely for use |
| 368 // with suitableForGpuRasterization. |
| 369 class ContentInfo { |
| 370 public: |
| 371 ContentInfo() { this->reset(); } |
| 372 |
| 373 ContentInfo(const ContentInfo& src) { this->set(src); } |
| 374 |
| 375 void set(const ContentInfo& src) { |
| 376 fNumPaintWithPathEffectUses = src.fNumPaintWithPathEffectUses; |
| 377 fNumAAConcavePaths = src.fNumAAConcavePaths; |
| 378 } |
| 379 |
| 380 void reset() { |
| 381 fNumPaintWithPathEffectUses = 0; |
| 382 fNumAAConcavePaths = 0; |
| 383 } |
| 384 |
| 385 void swap(ContentInfo* other) { |
| 386 SkTSwap(fNumPaintWithPathEffectUses, other->fNumPaintWithPathEffectU
ses); |
| 387 SkTSwap(fNumAAConcavePaths, other->fNumAAConcavePaths); |
| 388 } |
| 389 |
| 390 // This field is incremented every time a paint with a path effect is |
| 391 // used (i.e., it is not a de-duplicated count) |
| 392 int fNumPaintWithPathEffectUses; |
| 393 // This field is incremented every time an anti-aliased drawPath call is
|
| 394 // issued with a concave path |
| 395 int fNumAAConcavePaths; |
| 396 }; |
| 397 |
| 398 ContentInfo fContentInfo; |
| 399 |
| 400 void incPaintWithPathEffectUses() { |
| 401 ++fContentInfo.fNumPaintWithPathEffectUses; |
| 402 } |
| 403 int numPaintWithPathEffectUses() const { |
| 404 return fContentInfo.fNumPaintWithPathEffectUses; |
| 405 } |
| 406 |
| 407 void incAAConcavePaths() { |
| 408 ++fContentInfo.fNumAAConcavePaths; |
| 409 } |
| 410 int numAAConcavePaths() const { |
| 411 return fContentInfo.fNumAAConcavePaths; |
| 412 } |
| 413 |
367 const SkPath& getPath(int index) const; | 414 const SkPath& getPath(int index) const; |
368 int addPathToHeap(const SkPath& path); | 415 int addPathToHeap(const SkPath& path); |
369 | 416 |
370 void flattenToBuffer(SkWriteBuffer& buffer) const; | 417 void flattenToBuffer(SkWriteBuffer& buffer) const; |
371 bool parseBufferTag(SkReadBuffer& buffer, uint32_t tag, uint32_t size); | 418 bool parseBufferTag(SkReadBuffer& buffer, uint32_t tag, uint32_t size); |
372 | 419 |
373 static void WriteTagSize(SkWriteBuffer& buffer, uint32_t tag, size_t size); | 420 static void WriteTagSize(SkWriteBuffer& buffer, uint32_t tag, size_t size); |
374 static void WriteTagSize(SkWStream* stream, uint32_t tag, size_t size); | 421 static void WriteTagSize(SkWStream* stream, uint32_t tag, size_t size); |
375 | 422 |
376 void initForPlayback() const; | 423 void initForPlayback() const; |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
452 typedef SkRefCnt INHERITED; | 499 typedef SkRefCnt INHERITED; |
453 }; | 500 }; |
454 | 501 |
455 #endif | 502 #endif |
456 | 503 |
457 #ifdef SK_SUPPORT_LEGACY_PICTURE_HEADERS | 504 #ifdef SK_SUPPORT_LEGACY_PICTURE_HEADERS |
458 #include "SkPictureRecorder.h" | 505 #include "SkPictureRecorder.h" |
459 #endif | 506 #endif |
460 | 507 |
461 #endif | 508 #endif |
OLD | NEW |