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 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 this->popSaveBlock(); | 157 this->popSaveBlock(); |
158 } | 158 } |
159 | 159 |
160 // Any control ops not part of any Save/Restore block draw everywhere. | 160 // Any control ops not part of any Save/Restore block draw everywhere. |
161 while (!fControlIndices.isEmpty()) { | 161 while (!fControlIndices.isEmpty()) { |
162 this->popControl(kUnbounded); | 162 this->popControl(kUnbounded); |
163 } | 163 } |
164 | 164 |
165 // Finally feed all stored bounds into the BBH. They'll be returned in
this order. | 165 // Finally feed all stored bounds into the BBH. They'll be returned in
this order. |
166 SkASSERT(bbh); | 166 SkASSERT(bbh); |
167 bbh->reserve(record.count()); | 167 bbh->insert(&fBounds, record.count()); |
168 for (unsigned i = 0; i < record.count(); i++) { | |
169 if (!fBounds[i].isEmpty()) { | |
170 bbh->insert(i, fBounds[i], true/*ok to defer*/); | |
171 } | |
172 } | |
173 bbh->flushDeferredInserts(); | |
174 } | 168 } |
175 | 169 |
176 template <typename T> void operator()(const T& op) { | 170 template <typename T> void operator()(const T& op) { |
177 this->updateCTM(op); | 171 this->updateCTM(op); |
178 this->updateClipBounds(op); | 172 this->updateClipBounds(op); |
179 this->trackBounds(op); | 173 this->trackBounds(op); |
180 } | 174 } |
181 | 175 |
182 private: | 176 private: |
183 // In this file, SkRect are in local coordinates, Bounds are translated back
to identity space. | 177 // In this file, SkRect are in local coordinates, Bounds are translated back
to identity space. |
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
554 // Used to track the bounds of Save/Restore blocks and the control ops insid
e them. | 548 // Used to track the bounds of Save/Restore blocks and the control ops insid
e them. |
555 SkTDArray<SaveBounds> fSaveStack; | 549 SkTDArray<SaveBounds> fSaveStack; |
556 SkTDArray<unsigned> fControlIndices; | 550 SkTDArray<unsigned> fControlIndices; |
557 }; | 551 }; |
558 | 552 |
559 } // namespace SkRecords | 553 } // namespace SkRecords |
560 | 554 |
561 void SkRecordFillBounds(const SkRecord& record, SkBBoxHierarchy* bbh) { | 555 void SkRecordFillBounds(const SkRecord& record, SkBBoxHierarchy* bbh) { |
562 SkRecords::FillBounds(record, bbh); | 556 SkRecords::FillBounds(record, bbh); |
563 } | 557 } |
OLD | NEW |