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

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

Issue 490253003: Implement SkPicture::bytesUsed() for SkRecord backend (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Move to SkPictureUtils, start unit test Created 6 years, 4 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
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 "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
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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698