OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2012 Google Inc. | 3 * Copyright 2012 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 #ifndef SkRTree_DEFINED | 9 #ifndef SkRTree_DEFINED |
10 #define SkRTree_DEFINED | 10 #define SkRTree_DEFINED |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 | 61 |
62 virtual void insert(SkAutoTMalloc<SkRect>* boundsArray, int N) SK_OVERRIDE; | 62 virtual void insert(SkAutoTMalloc<SkRect>* boundsArray, int N) SK_OVERRIDE; |
63 virtual void search(const SkRect& query, SkTDArray<unsigned>* results) const
SK_OVERRIDE; | 63 virtual void search(const SkRect& query, SkTDArray<unsigned>* results) const
SK_OVERRIDE; |
64 | 64 |
65 void clear(); | 65 void clear(); |
66 // Return the depth of the tree structure. | 66 // Return the depth of the tree structure. |
67 int getDepth() const { return this->isEmpty() ? 0 : fRoot.fChild.subtree->fL
evel + 1; } | 67 int getDepth() const { return this->isEmpty() ? 0 : fRoot.fChild.subtree->fL
evel + 1; } |
68 // Insertion count (not overall node count, which may be greater). | 68 // Insertion count (not overall node count, which may be greater). |
69 int getCount() const { return fCount; } | 69 int getCount() const { return fCount; } |
70 | 70 |
| 71 virtual size_t bytesUsed() const SK_OVERRIDE; |
| 72 |
71 private: | 73 private: |
72 bool isEmpty() const { return 0 == this->getCount(); } | 74 bool isEmpty() const { return 0 == this->getCount(); } |
73 | 75 |
74 struct Node; | 76 struct Node; |
75 | 77 |
76 /** | 78 /** |
77 * A branch of the tree, this may contain a pointer to another interior node
, or a data value | 79 * A branch of the tree, this may contain a pointer to another interior node
, or a data value |
78 */ | 80 */ |
79 struct Branch { | 81 struct Branch { |
80 union { | 82 union { |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 SkChunkAlloc fNodes; | 166 SkChunkAlloc fNodes; |
165 SkScalar fAspectRatio; | 167 SkScalar fAspectRatio; |
166 bool fSortWhenBulkLoading; | 168 bool fSortWhenBulkLoading; |
167 | 169 |
168 Node* allocateNode(uint16_t level); | 170 Node* allocateNode(uint16_t level); |
169 | 171 |
170 typedef SkBBoxHierarchy INHERITED; | 172 typedef SkBBoxHierarchy INHERITED; |
171 }; | 173 }; |
172 | 174 |
173 #endif | 175 #endif |
OLD | NEW |