OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
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 #ifndef SkPictureFlat_DEFINED | 8 #ifndef SkPictureFlat_DEFINED |
9 #define SkPictureFlat_DEFINED | 9 #define SkPictureFlat_DEFINED |
10 | 10 |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 TRANSLATE, | 59 TRANSLATE, |
60 NOOP, | 60 NOOP, |
61 BEGIN_COMMENT_GROUP, | 61 BEGIN_COMMENT_GROUP, |
62 COMMENT, | 62 COMMENT, |
63 END_COMMENT_GROUP, | 63 END_COMMENT_GROUP, |
64 | 64 |
65 // new ops -- feel free to re-alphabetize on next version bump | 65 // new ops -- feel free to re-alphabetize on next version bump |
66 DRAW_DRRECT, | 66 DRAW_DRRECT, |
67 PUSH_CULL, | 67 PUSH_CULL, |
68 POP_CULL, | 68 POP_CULL, |
69 | 69 |
70 DRAW_PATCH, // could not add in aphabetical order | 70 DRAW_PATCH, // could not add in aphabetical order |
71 DRAW_PICTURE_MATRIX_PAINT, | 71 DRAW_PICTURE_MATRIX_PAINT, |
72 DRAW_TEXT_BLOB, | 72 DRAW_TEXT_BLOB, |
73 | 73 |
74 LAST_DRAWTYPE_ENUM = DRAW_TEXT_BLOB | 74 LAST_DRAWTYPE_ENUM = DRAW_TEXT_BLOB |
75 }; | 75 }; |
76 | 76 |
77 // In the 'match' method, this constant will match any flavor of DRAW_BITMAP* | 77 // In the 'match' method, this constant will match any flavor of DRAW_BITMAP* |
78 static const int kDRAW_BITMAP_FLAVOR = LAST_DRAWTYPE_ENUM+1; | 78 static const int kDRAW_BITMAP_FLAVOR = LAST_DRAWTYPE_ENUM+1; |
79 | 79 |
(...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
563 SkWriteBuffer fScratch; | 563 SkWriteBuffer fScratch; |
564 bool fReady; | 564 bool fReady; |
565 | 565 |
566 // For index -> SkFlatData. 0-based, while all indices in the API are 1-bas
ed. Careful! | 566 // For index -> SkFlatData. 0-based, while all indices in the API are 1-bas
ed. Careful! |
567 SkTDArray<const SkFlatData*> fIndexedData; | 567 SkTDArray<const SkFlatData*> fIndexedData; |
568 | 568 |
569 // For SkFlatData -> cached SkFlatData, which has index(). | 569 // For SkFlatData -> cached SkFlatData, which has index(). |
570 SkTDynamicHash<SkFlatData, SkFlatData, SkFlatData::HashTraits> fHash; | 570 SkTDynamicHash<SkFlatData, SkFlatData, SkFlatData::HashTraits> fHash; |
571 }; | 571 }; |
572 | 572 |
573 typedef SkFlatDictionary<SkPaint, SkPaint::FlatteningTraits> SkPaintDictionary; | 573 struct SkPaintFlatteningTraits { |
| 574 static void Flatten(SkWriteBuffer& buffer, const SkPaint& paint) { paint.fla
tten(buffer); } |
| 575 static void Unflatten(SkReadBuffer& buffer, SkPaint* paint) { paint->unflatt
en(buffer); } |
| 576 }; |
| 577 |
| 578 typedef SkFlatDictionary<SkPaint, SkPaintFlatteningTraits> SkPaintDictionary; |
574 | 579 |
575 class SkChunkFlatController : public SkFlatController { | 580 class SkChunkFlatController : public SkFlatController { |
576 public: | 581 public: |
577 SkChunkFlatController(size_t minSize) | 582 SkChunkFlatController(size_t minSize) |
578 : fHeap(minSize) | 583 : fHeap(minSize) |
579 , fTypefaceSet(SkNEW(SkRefCntSet)) | 584 , fTypefaceSet(SkNEW(SkRefCntSet)) |
580 , fLastAllocated(NULL) { | 585 , fLastAllocated(NULL) { |
581 this->setTypefaceSet(fTypefaceSet); | 586 this->setTypefaceSet(fTypefaceSet); |
582 this->setTypefacePlayback(&fTypefacePlayback); | 587 this->setTypefacePlayback(&fTypefacePlayback); |
583 } | 588 } |
(...skipping 18 matching lines...) Expand all Loading... |
602 } | 607 } |
603 | 608 |
604 private: | 609 private: |
605 SkChunkAlloc fHeap; | 610 SkChunkAlloc fHeap; |
606 SkAutoTUnref<SkRefCntSet> fTypefaceSet; | 611 SkAutoTUnref<SkRefCntSet> fTypefaceSet; |
607 void* fLastAllocated; | 612 void* fLastAllocated; |
608 mutable SkTypefacePlayback fTypefacePlayback; | 613 mutable SkTypefacePlayback fTypefacePlayback; |
609 }; | 614 }; |
610 | 615 |
611 #endif | 616 #endif |
OLD | NEW |