| OLD | NEW |
| 1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CC_BASE_RTREE_H_ | 5 #ifndef CC_BASE_RTREE_H_ |
| 6 #define CC_BASE_RTREE_H_ | 6 #define CC_BASE_RTREE_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| 11 #include <deque> | |
| 12 #include <vector> | 11 #include <vector> |
| 13 | 12 |
| 14 #include "cc/base/cc_export.h" | 13 #include "cc/base/cc_export.h" |
| 14 #include "cc/base/contiguous_container.h" |
| 15 #include "ui/gfx/geometry/rect.h" | 15 #include "ui/gfx/geometry/rect.h" |
| 16 | 16 |
| 17 namespace cc { | 17 namespace cc { |
| 18 | 18 |
| 19 // The following description and most of the implementation is borrowed from | 19 // The following description and most of the implementation is borrowed from |
| 20 // Skia's SkRTree implementation. | 20 // Skia's SkRTree implementation. |
| 21 // | 21 // |
| 22 // An R-Tree implementation. In short, it is a balanced n-ary tree containing a | 22 // An R-Tree implementation. In short, it is a balanced n-ary tree containing a |
| 23 // hierarchy of bounding rectangles. | 23 // hierarchy of bounding rectangles. |
| 24 // | 24 // |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 const gfx::Rect& query, | 108 const gfx::Rect& query, |
| 109 std::vector<size_t>* results) const; | 109 std::vector<size_t>* results) const; |
| 110 | 110 |
| 111 // Consumes the input array. | 111 // Consumes the input array. |
| 112 Branch BuildRecursive(std::vector<Branch>* branches, int level); | 112 Branch BuildRecursive(std::vector<Branch>* branches, int level); |
| 113 Node* AllocateNodeAtLevel(int level); | 113 Node* AllocateNodeAtLevel(int level); |
| 114 | 114 |
| 115 // This is the count of data elements (rather than total nodes in the tree) | 115 // This is the count of data elements (rather than total nodes in the tree) |
| 116 size_t num_data_elements_; | 116 size_t num_data_elements_; |
| 117 Branch root_; | 117 Branch root_; |
| 118 std::deque<Node> nodes_; | 118 ContiguousContainer<Node> nodes_; |
| 119 }; | 119 }; |
| 120 | 120 |
| 121 } // namespace cc | 121 } // namespace cc |
| 122 | 122 |
| 123 #endif // CC_BASE_RTREE_H_ | 123 #endif // CC_BASE_RTREE_H_ |
| OLD | NEW |