Chromium Code Reviews| 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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 71 | 71 |
| 72 /** | 72 /** |
| 73 * If any inserts have been deferred, this will add them into the tree | 73 * If any inserts have been deferred, this will add them into the tree |
| 74 */ | 74 */ |
| 75 virtual void flushDeferredInserts() SK_OVERRIDE; | 75 virtual void flushDeferredInserts() SK_OVERRIDE; |
| 76 | 76 |
| 77 /** | 77 /** |
| 78 * Given a query rectangle, populates the passed-in array with the elements it intersects | 78 * Given a query rectangle, populates the passed-in array with the elements it intersects |
| 79 */ | 79 */ |
| 80 virtual void search(const SkRect& query, SkTDArray<unsigned>* results) const SK_OVERRIDE; | 80 virtual void search(const SkRect& query, SkTDArray<unsigned>* results) const SK_OVERRIDE; |
| 81 | 81 |
|
robertphillips
2014/10/02 16:07:58
keep the comments?
mtklein
2014/10/02 16:14:39
Done.
| |
| 82 virtual void clear() SK_OVERRIDE; | 82 int getDepth() const { return 0 == fCount ? 0 : fRoot.fChild.subtree->fLevel + 1; } |
| 83 bool isEmpty() const { return 0 == fCount; } | 83 int getCount() const { return fCount; } |
| 84 | 84 void clear(); |
| 85 /** | |
| 86 * Gets the depth of the tree structure | |
| 87 */ | |
| 88 virtual int getDepth() const SK_OVERRIDE { | |
| 89 return this->isEmpty() ? 0 : fRoot.fChild.subtree->fLevel + 1; | |
| 90 } | |
| 91 | |
| 92 /** | |
| 93 * This gets the insertion count (rather than the node count) | |
| 94 */ | |
| 95 virtual int getCount() const SK_OVERRIDE { return fCount; } | |
| 96 | 85 |
| 97 private: | 86 private: |
| 87 bool isEmpty() const { return 0 == this->getCount(); } | |
| 98 | 88 |
| 99 struct Node; | 89 struct Node; |
| 100 | 90 |
| 101 /** | 91 /** |
| 102 * A branch of the tree, this may contain a pointer to another interior node , or a data value | 92 * A branch of the tree, this may contain a pointer to another interior node , or a data value |
| 103 */ | 93 */ |
| 104 struct Branch { | 94 struct Branch { |
| 105 union { | 95 union { |
| 106 Node* subtree; | 96 Node* subtree; |
| 107 unsigned opIndex; | 97 unsigned opIndex; |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 190 SkTDArray<Branch> fDeferredInserts; | 180 SkTDArray<Branch> fDeferredInserts; |
| 191 SkScalar fAspectRatio; | 181 SkScalar fAspectRatio; |
| 192 bool fSortWhenBulkLoading; | 182 bool fSortWhenBulkLoading; |
| 193 | 183 |
| 194 Node* allocateNode(uint16_t level); | 184 Node* allocateNode(uint16_t level); |
| 195 | 185 |
| 196 typedef SkBBoxHierarchy INHERITED; | 186 typedef SkBBoxHierarchy INHERITED; |
| 197 }; | 187 }; |
| 198 | 188 |
| 199 #endif | 189 #endif |
| OLD | NEW |