| 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 struct SkPaintTraits { | 564 typedef SkFlatDictionary<SkPaint, SkPaint::FlatteningTraits> SkPaintDictionary; |
| 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; | |
| 573 | 565 |
| 574 class SkChunkFlatController : public SkFlatController { | 566 class SkChunkFlatController : public SkFlatController { |
| 575 public: | 567 public: |
| 576 SkChunkFlatController(size_t minSize) | 568 SkChunkFlatController(size_t minSize) |
| 577 : fHeap(minSize) | 569 : fHeap(minSize) |
| 578 , fTypefaceSet(SkNEW(SkRefCntSet)) | 570 , fTypefaceSet(SkNEW(SkRefCntSet)) |
| 579 , fLastAllocated(NULL) { | 571 , fLastAllocated(NULL) { |
| 580 this->setTypefaceSet(fTypefaceSet); | 572 this->setTypefaceSet(fTypefaceSet); |
| 581 this->setTypefacePlayback(&fTypefacePlayback); | 573 this->setTypefacePlayback(&fTypefacePlayback); |
| 582 } | 574 } |
| (...skipping 18 matching lines...) Expand all Loading... |
| 601 } | 593 } |
| 602 | 594 |
| 603 private: | 595 private: |
| 604 SkChunkAlloc fHeap; | 596 SkChunkAlloc fHeap; |
| 605 SkAutoTUnref<SkRefCntSet> fTypefaceSet; | 597 SkAutoTUnref<SkRefCntSet> fTypefaceSet; |
| 606 void* fLastAllocated; | 598 void* fLastAllocated; |
| 607 mutable SkTypefacePlayback fTypefacePlayback; | 599 mutable SkTypefacePlayback fTypefacePlayback; |
| 608 }; | 600 }; |
| 609 | 601 |
| 610 #endif | 602 #endif |
| OLD | NEW |