OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "SkTextBlob.h" | 8 #include "SkTextBlob.h" |
9 | 9 |
10 #include "SkReadBuffer.h" | 10 #include "SkReadBuffer.h" |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 SkTextBlob::~SkTextBlob() { | 115 SkTextBlob::~SkTextBlob() { |
116 const RunRecord* run = RunRecord::First(this); | 116 const RunRecord* run = RunRecord::First(this); |
117 for (int i = 0; i < fRunCount; ++i) { | 117 for (int i = 0; i < fRunCount; ++i) { |
118 const RunRecord* nextRun = RunRecord::Next(run); | 118 const RunRecord* nextRun = RunRecord::Next(run); |
119 SkDEBUGCODE(run->validate((uint8_t*)this + fStorageSize);) | 119 SkDEBUGCODE(run->validate((uint8_t*)this + fStorageSize);) |
120 run->~RunRecord(); | 120 run->~RunRecord(); |
121 run = nextRun; | 121 run = nextRun; |
122 } | 122 } |
123 } | 123 } |
124 | 124 |
125 void SkTextBlob::internal_dispose() const { | |
126 // SkTextBlobs use externally-managed storage. | |
127 this->internal_dispose_restore_refcnt_to_1(); | |
128 this->~SkTextBlob(); | |
129 sk_free(const_cast<SkTextBlob*>(this)); | |
130 } | |
131 | |
132 uint32_t SkTextBlob::uniqueID() const { | 125 uint32_t SkTextBlob::uniqueID() const { |
133 static int32_t gTextBlobGenerationID; // = 0; | 126 static int32_t gTextBlobGenerationID; // = 0; |
134 | 127 |
135 // loop in case our global wraps around, as we never want to return SK_Inval
idGenID | 128 // loop in case our global wraps around, as we never want to return SK_Inval
idGenID |
136 while (SK_InvalidGenID == fUniqueID) { | 129 while (SK_InvalidGenID == fUniqueID) { |
137 fUniqueID = sk_atomic_inc(&gTextBlobGenerationID) + 1; | 130 fUniqueID = sk_atomic_inc(&gTextBlobGenerationID) + 1; |
138 } | 131 } |
139 | 132 |
140 return fUniqueID; | 133 return fUniqueID; |
141 } | 134 } |
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
524 | 517 |
525 fStorageUsed = 0; | 518 fStorageUsed = 0; |
526 fStorageSize = 0; | 519 fStorageSize = 0; |
527 fRunCount = 0; | 520 fRunCount = 0; |
528 fLastRun = 0; | 521 fLastRun = 0; |
529 fBounds.setEmpty(); | 522 fBounds.setEmpty(); |
530 | 523 |
531 return blob; | 524 return blob; |
532 } | 525 } |
533 | 526 |
OLD | NEW |