| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 "SkRTree.h" | 8 #include "SkRTree.h" |
| 9 | 9 |
| 10 SkRTree::SkRTree(SkScalar aspectRatio) : fCount(0), fAspectRatio(aspectRatio) {} | 10 SkRTree::SkRTree(SkScalar aspectRatio) : fCount(0), fAspectRatio(aspectRatio) {} |
| 11 | 11 |
| 12 void SkRTree::insert(SkAutoTMalloc<SkRect>* boundsArray, int N) { | 12 void SkRTree::insert(const SkRect boundsArray[], int N) { |
| 13 SkASSERT(0 == fCount); | 13 SkASSERT(0 == fCount); |
| 14 | 14 |
| 15 SkTDArray<Branch> branches; | 15 SkTDArray<Branch> branches; |
| 16 branches.setReserve(N); | 16 branches.setReserve(N); |
| 17 | 17 |
| 18 for (int i = 0; i < N; i++) { | 18 for (int i = 0; i < N; i++) { |
| 19 const SkRect& bounds = (*boundsArray)[i]; | 19 const SkRect& bounds = boundsArray[i]; |
| 20 if (bounds.isEmpty()) { | 20 if (bounds.isEmpty()) { |
| 21 continue; | 21 continue; |
| 22 } | 22 } |
| 23 | 23 |
| 24 Branch* b = branches.push(); | 24 Branch* b = branches.push(); |
| 25 b->fBounds = bounds; | 25 b->fBounds = bounds; |
| 26 b->fOpIndex = i; | 26 b->fOpIndex = i; |
| 27 } | 27 } |
| 28 | 28 |
| 29 fCount = branches.count(); | 29 fCount = branches.count(); |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 } | 171 } |
| 172 } | 172 } |
| 173 | 173 |
| 174 size_t SkRTree::bytesUsed() const { | 174 size_t SkRTree::bytesUsed() const { |
| 175 size_t byteCount = sizeof(SkRTree); | 175 size_t byteCount = sizeof(SkRTree); |
| 176 | 176 |
| 177 byteCount += fNodes.reserved() * sizeof(Node); | 177 byteCount += fNodes.reserved() * sizeof(Node); |
| 178 | 178 |
| 179 return byteCount; | 179 return byteCount; |
| 180 } | 180 } |
| OLD | NEW |