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 "SkQuadTree.h" | 8 #include "SkQuadTree.h" |
9 #include "SkTSort.h" | 9 #include "SkTSort.h" |
10 #include <stdio.h> | 10 #include <stdio.h> |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 Entry* entry = entries.pop(); | 201 Entry* entry = entries.pop(); |
202 if (fClient->shouldRewind(entry->fData)) { | 202 if (fClient->shouldRewind(entry->fData)) { |
203 entry->fData = NULL; | 203 entry->fData = NULL; |
204 fEntryPool.release(entry); | 204 fEntryPool.release(entry); |
205 } else { | 205 } else { |
206 fDeferred.push(entry); | 206 fDeferred.push(entry); |
207 } | 207 } |
208 } | 208 } |
209 } | 209 } |
210 | 210 |
| 211 size_t SkQuadTree::bytesUsed() const { |
| 212 size_t byteCount = sizeof(SkQuadTree); |
| 213 byteCount += fEntryPool.allocated() * sizeof(Entry); |
| 214 byteCount += fNodePool.allocated() * sizeof(Node); |
| 215 byteCount += fDeferred.getCount() * sizeof(Entry); |
| 216 return byteCount; |
| 217 } |
| 218 |
211 void SkQuadTree::flushDeferredInserts() { | 219 void SkQuadTree::flushDeferredInserts() { |
212 if (NULL == fRoot) { | 220 if (NULL == fRoot) { |
213 fRoot = fNodePool.acquire(); | 221 fRoot = fNodePool.acquire(); |
214 fRoot->fBounds = fRootBounds; | 222 fRoot->fBounds = fRootBounds; |
215 } | 223 } |
216 while(!fDeferred.isEmpty()) { | 224 while(!fDeferred.isEmpty()) { |
217 this->insert(fRoot, fDeferred.pop()); | 225 this->insert(fRoot, fDeferred.pop()); |
218 } | 226 } |
219 } | 227 } |
OLD | NEW |