| 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 virtual ~SkRTree(); | 60 virtual ~SkRTree(); |
| 61 | 61 |
| 62 /** | 62 /** |
| 63 * Insert a node, consisting of bounds and a data value into the tree, if we
don't immediately | 63 * Insert a node, consisting of bounds and a data value into the tree, if we
don't immediately |
| 64 * need to use the tree; we may allow the insert to be deferred (this can al
low us to bulk-load | 64 * need to use the tree; we may allow the insert to be deferred (this can al
low us to bulk-load |
| 65 * a large batch of nodes at once, which tends to be faster and produce a be
tter tree). | 65 * a large batch of nodes at once, which tends to be faster and produce a be
tter tree). |
| 66 * @param data The data value | 66 * @param data The data value |
| 67 * @param bounds The corresponding bounding box | 67 * @param bounds The corresponding bounding box |
| 68 * @param defer Can this insert be deferred? (this may be ignored) | 68 * @param defer Can this insert be deferred? (this may be ignored) |
| 69 */ | 69 */ |
| 70 virtual void insert(void* data, const SkIRect& bounds, bool defer = false); | 70 virtual void insert(void* data, const SkIRect& bounds, bool defer = false) S
K_OVERRIDE; |
| 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(); | 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 SkIRect& query, SkTDArray<void*>* results); | 80 virtual void search(const SkIRect& query, SkTDArray<void*>* results) SK_OVER
RIDE; |
| 81 | 81 |
| 82 virtual void clear(); | 82 virtual void clear() SK_OVERRIDE; |
| 83 bool isEmpty() const { return 0 == fCount; } | 83 bool isEmpty() const { return 0 == fCount; } |
| 84 int getDepth() const { return this->isEmpty() ? 0 : fRoot.fChild.subtree->fL
evel + 1; } | 84 |
| 85 /** |
| 86 * Gets the depth of the tree structure |
| 87 */ |
| 88 virtual int getDepth() const SK_OVERRIDE { return this->isEmpty() ? 0 : fRoo
t.fChild.subtree->fLevel + 1; } |
| 85 | 89 |
| 86 /** | 90 /** |
| 87 * This gets the insertion count (rather than the node count) | 91 * This gets the insertion count (rather than the node count) |
| 88 */ | 92 */ |
| 89 virtual int getCount() const { return fCount; } | 93 virtual int getCount() const SK_OVERRIDE { return fCount; } |
| 90 | 94 |
| 91 virtual void rewindInserts() SK_OVERRIDE; | 95 virtual void rewindInserts() SK_OVERRIDE; |
| 92 | 96 |
| 93 private: | 97 private: |
| 94 | 98 |
| 95 struct Node; | 99 struct Node; |
| 96 | 100 |
| 97 /** | 101 /** |
| 98 * A branch of the tree, this may contain a pointer to another interior node
, or a data value | 102 * A branch of the tree, this may contain a pointer to another interior node
, or a data value |
| 99 */ | 103 */ |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 SkTDArray<Branch> fDeferredInserts; | 190 SkTDArray<Branch> fDeferredInserts; |
| 187 SkScalar fAspectRatio; | 191 SkScalar fAspectRatio; |
| 188 bool fSortWhenBulkLoading; | 192 bool fSortWhenBulkLoading; |
| 189 | 193 |
| 190 Node* allocateNode(uint16_t level); | 194 Node* allocateNode(uint16_t level); |
| 191 | 195 |
| 192 typedef SkBBoxHierarchy INHERITED; | 196 typedef SkBBoxHierarchy INHERITED; |
| 193 }; | 197 }; |
| 194 | 198 |
| 195 #endif | 199 #endif |
| OLD | NEW |