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 "SkRecordDraw.h" | 8 #include "SkRecordDraw.h" |
9 #include "SkPatchUtils.h" | 9 #include "SkPatchUtils.h" |
10 | 10 |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 this->popSaveBlock(); | 155 this->popSaveBlock(); |
156 } | 156 } |
157 | 157 |
158 // Any control ops not part of any Save/Restore block draw everywhere. | 158 // Any control ops not part of any Save/Restore block draw everywhere. |
159 while (!fControlIndices.isEmpty()) { | 159 while (!fControlIndices.isEmpty()) { |
160 this->popControl(kUnbounded); | 160 this->popControl(kUnbounded); |
161 } | 161 } |
162 | 162 |
163 // Finally feed all stored bounds into the BBH. They'll be returned in
this order. | 163 // Finally feed all stored bounds into the BBH. They'll be returned in
this order. |
164 SkASSERT(bbh); | 164 SkASSERT(bbh); |
| 165 bbh->reserve(record.count()); |
165 for (unsigned i = 0; i < record.count(); i++) { | 166 for (unsigned i = 0; i < record.count(); i++) { |
166 if (!fBounds[i].isEmpty()) { | 167 if (!fBounds[i].isEmpty()) { |
167 bbh->insert(i, fBounds[i], true/*ok to defer*/); | 168 bbh->insert(i, fBounds[i], true/*ok to defer*/); |
168 } | 169 } |
169 } | 170 } |
170 bbh->flushDeferredInserts(); | 171 bbh->flushDeferredInserts(); |
171 } | 172 } |
172 | 173 |
173 template <typename T> void operator()(const T& op) { | 174 template <typename T> void operator()(const T& op) { |
174 this->updateCTM(op); | 175 this->updateCTM(op); |
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
545 // Used to track the bounds of Save/Restore blocks and the control ops insid
e them. | 546 // Used to track the bounds of Save/Restore blocks and the control ops insid
e them. |
546 SkTDArray<SaveBounds> fSaveStack; | 547 SkTDArray<SaveBounds> fSaveStack; |
547 SkTDArray<unsigned> fControlIndices; | 548 SkTDArray<unsigned> fControlIndices; |
548 }; | 549 }; |
549 | 550 |
550 } // namespace SkRecords | 551 } // namespace SkRecords |
551 | 552 |
552 void SkRecordFillBounds(const SkRecord& record, SkBBoxHierarchy* bbh) { | 553 void SkRecordFillBounds(const SkRecord& record, SkBBoxHierarchy* bbh) { |
553 SkRecords::FillBounds(record, bbh); | 554 SkRecords::FillBounds(record, bbh); |
554 } | 555 } |
OLD | NEW |