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 543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
554 bool fReady; | 554 bool fReady; |
555 | 555 |
556 // For index -> SkFlatData. 0-based, while all indices in the API are 1-bas
ed. Careful! | 556 // For index -> SkFlatData. 0-based, while all indices in the API are 1-bas
ed. Careful! |
557 SkTDArray<const SkFlatData*> fIndexedData; | 557 SkTDArray<const SkFlatData*> fIndexedData; |
558 | 558 |
559 // For SkFlatData -> cached SkFlatData, which has index(). | 559 // For SkFlatData -> cached SkFlatData, which has index(). |
560 SkTDynamicHash<SkFlatData, SkFlatData, | 560 SkTDynamicHash<SkFlatData, SkFlatData, |
561 SkFlatData::Identity, SkFlatData::Hash, SkFlatData::Equal> fH
ash; | 561 SkFlatData::Identity, SkFlatData::Hash, SkFlatData::Equal> fH
ash; |
562 }; | 562 }; |
563 | 563 |
564 typedef SkFlatDictionary<SkPaint, SkPaint::FlatteningTraits> SkPaintDictionary; | 564 struct SkPaintTraits { |
| 565 static void Flatten(SkWriteBuffer& buffer, const SkPaint& paint) { |
| 566 paint.flatten(buffer); |
| 567 } |
| 568 static void Unflatten(SkReadBuffer& buffer, SkPaint* paint) { |
| 569 paint->unflatten(buffer); |
| 570 } |
| 571 }; |
| 572 typedef SkFlatDictionary<SkPaint, SkPaintTraits> SkPaintDictionary; |
565 | 573 |
566 class SkChunkFlatController : public SkFlatController { | 574 class SkChunkFlatController : public SkFlatController { |
567 public: | 575 public: |
568 SkChunkFlatController(size_t minSize) | 576 SkChunkFlatController(size_t minSize) |
569 : fHeap(minSize) | 577 : fHeap(minSize) |
570 , fTypefaceSet(SkNEW(SkRefCntSet)) | 578 , fTypefaceSet(SkNEW(SkRefCntSet)) |
571 , fLastAllocated(NULL) { | 579 , fLastAllocated(NULL) { |
572 this->setTypefaceSet(fTypefaceSet); | 580 this->setTypefaceSet(fTypefaceSet); |
573 this->setTypefacePlayback(&fTypefacePlayback); | 581 this->setTypefacePlayback(&fTypefacePlayback); |
574 } | 582 } |
(...skipping 18 matching lines...) Expand all Loading... |
593 } | 601 } |
594 | 602 |
595 private: | 603 private: |
596 SkChunkAlloc fHeap; | 604 SkChunkAlloc fHeap; |
597 SkAutoTUnref<SkRefCntSet> fTypefaceSet; | 605 SkAutoTUnref<SkRefCntSet> fTypefaceSet; |
598 void* fLastAllocated; | 606 void* fLastAllocated; |
599 mutable SkTypefacePlayback fTypefacePlayback; | 607 mutable SkTypefacePlayback fTypefacePlayback; |
600 }; | 608 }; |
601 | 609 |
602 #endif | 610 #endif |
OLD | NEW |