| 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 487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 498 fScratch.setNamedFactoryRecorder(fController->getNamedFactorySet()); | 498 fScratch.setNamedFactoryRecorder(fController->getNamedFactorySet()); |
| 499 fReady = true; | 499 fReady = true; |
| 500 } | 500 } |
| 501 | 501 |
| 502 // As findAndReturnFlat, but returns a mutable pointer for internal use. | 502 // As findAndReturnFlat, but returns a mutable pointer for internal use. |
| 503 SkFlatData* findAndReturnMutableFlat(const T& element) { | 503 SkFlatData* findAndReturnMutableFlat(const T& element) { |
| 504 // Only valid until the next call to resetScratch(). | 504 // Only valid until the next call to resetScratch(). |
| 505 const SkFlatData& scratch = this->resetScratch(element, this->count()+1)
; | 505 const SkFlatData& scratch = this->resetScratch(element, this->count()+1)
; |
| 506 | 506 |
| 507 SkFlatData* candidate = fHash.find(scratch); | 507 SkFlatData* candidate = fHash.find(scratch); |
| 508 if (candidate != NULL) return candidate; | 508 if (candidate != NULL) { |
| 509 return candidate; |
| 510 } |
| 509 | 511 |
| 510 SkFlatData* detached = this->detachScratch(); | 512 SkFlatData* detached = this->detachScratch(); |
| 511 fHash.add(detached); | 513 fHash.add(detached); |
| 512 *fIndexedData.append() = detached; | 514 *fIndexedData.append() = detached; |
| 513 SkASSERT(fIndexedData.top()->index() == this->count()); | 515 SkASSERT(fIndexedData.top()->index() == this->count()); |
| 514 return detached; | 516 return detached; |
| 515 } | 517 } |
| 516 | 518 |
| 517 // This reference is valid only until the next call to resetScratch() or det
achScratch(). | 519 // This reference is valid only until the next call to resetScratch() or det
achScratch(). |
| 518 const SkFlatData& resetScratch(const T& element, int index) { | 520 const SkFlatData& resetScratch(const T& element, int index) { |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 598 } | 600 } |
| 599 | 601 |
| 600 private: | 602 private: |
| 601 SkChunkAlloc fHeap; | 603 SkChunkAlloc fHeap; |
| 602 SkAutoTUnref<SkRefCntSet> fTypefaceSet; | 604 SkAutoTUnref<SkRefCntSet> fTypefaceSet; |
| 603 void* fLastAllocated; | 605 void* fLastAllocated; |
| 604 mutable SkTypefacePlayback fTypefacePlayback; | 606 mutable SkTypefacePlayback fTypefacePlayback; |
| 605 }; | 607 }; |
| 606 | 608 |
| 607 #endif | 609 #endif |
| OLD | NEW |