Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(371)

Side by Side Diff: src/core/SkRecordDraw.cpp

Issue 639933003: Add SkBBoxHierarchy::reserve() as an optional size hint. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/core/SkBBoxHierarchy.h ('k') | src/core/SkTileGrid.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « src/core/SkBBoxHierarchy.h ('k') | src/core/SkTileGrid.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698