| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #include <deque> |
| 6 |
| 5 #include "base/macros.h" | 7 #include "base/macros.h" |
| 6 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 7 #include "cc/base/scoped_ptr_deque.h" | |
| 8 #include "cc/base/scoped_ptr_vector.h" | 9 #include "cc/base/scoped_ptr_vector.h" |
| 9 #include "cc/output/bsp_tree.h" | 10 #include "cc/output/bsp_tree.h" |
| 10 #include "cc/output/bsp_walk_action.h" | 11 #include "cc/output/bsp_walk_action.h" |
| 11 #include "cc/quads/draw_polygon.h" | 12 #include "cc/quads/draw_polygon.h" |
| 12 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
| 13 | 14 |
| 14 namespace cc { | 15 namespace cc { |
| 15 namespace { | 16 namespace { |
| 16 | 17 |
| 17 #define EXPECT_SORTED_LISTS_EQ(polygon_list, compare_list) \ | 18 #define EXPECT_SORTED_LISTS_EQ(polygon_list, compare_list) \ |
| 18 do { \ | 19 do { \ |
| 19 EXPECT_EQ(polygon_list.size(), compare_list.size()); \ | 20 EXPECT_EQ(polygon_list.size(), compare_list.size()); \ |
| 20 for (unsigned int i = 0; i < polygon_list.size(); i++) { \ | 21 for (unsigned int i = 0; i < polygon_list.size(); i++) { \ |
| 21 EXPECT_EQ(polygon_list[i]->order_index(), compare_list[i]); \ | 22 EXPECT_EQ(polygon_list[i]->order_index(), compare_list[i]); \ |
| 22 } \ | 23 } \ |
| 23 } while (false); | 24 } while (false); |
| 24 | 25 |
| 25 #define INT_VECTOR_FROM_ARRAY(array) \ | 26 #define INT_VECTOR_FROM_ARRAY(array) \ |
| 26 std::vector<int>(array, array + arraysize(array)) | 27 std::vector<int>(array, array + arraysize(array)) |
| 27 | 28 |
| 28 #define CREATE_DRAW_POLYGON(vertex_vector, normal, polygon_id) \ | 29 #define CREATE_DRAW_POLYGON(vertex_vector, normal, polygon_id) \ |
| 29 new DrawPolygon(NULL, vertex_vector, normal, polygon_id) | 30 new DrawPolygon(NULL, vertex_vector, normal, polygon_id) |
| 30 | 31 |
| 31 class BspTreeTest { | 32 class BspTreeTest { |
| 32 public: | 33 public: |
| 33 static void RunTest(ScopedPtrDeque<DrawPolygon>* test_polygons, | 34 static void RunTest(std::deque<scoped_ptr<DrawPolygon>>* test_polygons, |
| 34 const std::vector<int>& compare_list) { | 35 const std::vector<int>& compare_list) { |
| 35 BspTree bsp_tree(test_polygons); | 36 BspTree bsp_tree(test_polygons); |
| 36 | 37 |
| 37 std::vector<DrawPolygon*> sorted_list; | 38 std::vector<DrawPolygon*> sorted_list; |
| 38 BspWalkActionToVector action_handler(&sorted_list); | 39 BspWalkActionToVector action_handler(&sorted_list); |
| 39 bsp_tree.TraverseWithActionHandler(&action_handler); | 40 bsp_tree.TraverseWithActionHandler(&action_handler); |
| 40 | 41 |
| 41 EXPECT_SORTED_LISTS_EQ(sorted_list, compare_list); | 42 EXPECT_SORTED_LISTS_EQ(sorted_list, compare_list); |
| 42 EXPECT_TRUE(VerifySidedness(bsp_tree.root())); | 43 EXPECT_TRUE(VerifySidedness(bsp_tree.root())); |
| 43 } | 44 } |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 vertices_c.push_back(gfx::Point3F(10.0f, 0.0f, 5.0f)); | 107 vertices_c.push_back(gfx::Point3F(10.0f, 0.0f, 5.0f)); |
| 107 vertices_c.push_back(gfx::Point3F(10.0f, 10.0f, 5.0f)); | 108 vertices_c.push_back(gfx::Point3F(10.0f, 10.0f, 5.0f)); |
| 108 | 109 |
| 109 scoped_ptr<DrawPolygon> polygon_a( | 110 scoped_ptr<DrawPolygon> polygon_a( |
| 110 CREATE_DRAW_POLYGON(vertices_a, gfx::Vector3dF(0.0f, 0.0f, 1.0f), 0)); | 111 CREATE_DRAW_POLYGON(vertices_a, gfx::Vector3dF(0.0f, 0.0f, 1.0f), 0)); |
| 111 scoped_ptr<DrawPolygon> polygon_b( | 112 scoped_ptr<DrawPolygon> polygon_b( |
| 112 CREATE_DRAW_POLYGON(vertices_b, gfx::Vector3dF(0.0f, 0.0f, 1.0f), 1)); | 113 CREATE_DRAW_POLYGON(vertices_b, gfx::Vector3dF(0.0f, 0.0f, 1.0f), 1)); |
| 113 scoped_ptr<DrawPolygon> polygon_c( | 114 scoped_ptr<DrawPolygon> polygon_c( |
| 114 CREATE_DRAW_POLYGON(vertices_c, gfx::Vector3dF(0.0f, 0.0f, 1.0f), 2)); | 115 CREATE_DRAW_POLYGON(vertices_c, gfx::Vector3dF(0.0f, 0.0f, 1.0f), 2)); |
| 115 | 116 |
| 116 ScopedPtrDeque<DrawPolygon> polygon_list; | 117 std::deque<scoped_ptr<DrawPolygon>> polygon_list; |
| 117 polygon_list.push_back(polygon_a.Pass()); | 118 polygon_list.push_back(polygon_a.Pass()); |
| 118 polygon_list.push_back(polygon_b.Pass()); | 119 polygon_list.push_back(polygon_b.Pass()); |
| 119 polygon_list.push_back(polygon_c.Pass()); | 120 polygon_list.push_back(polygon_c.Pass()); |
| 120 | 121 |
| 121 int compare_ids[] = {1, 0, 2}; | 122 int compare_ids[] = {1, 0, 2}; |
| 122 std::vector<int> compare_list = INT_VECTOR_FROM_ARRAY(compare_ids); | 123 std::vector<int> compare_list = INT_VECTOR_FROM_ARRAY(compare_ids); |
| 123 BspTreeTest::RunTest(&polygon_list, compare_list); | 124 BspTreeTest::RunTest(&polygon_list, compare_list); |
| 124 } | 125 } |
| 125 | 126 |
| 126 // Basic two polygon split, can be viewed as a + from above. | 127 // Basic two polygon split, can be viewed as a + from above. |
| 127 TEST(BspTreeTest, BasicSplit) { | 128 TEST(BspTreeTest, BasicSplit) { |
| 128 std::vector<gfx::Point3F> vertices_a; | 129 std::vector<gfx::Point3F> vertices_a; |
| 129 vertices_a.push_back(gfx::Point3F(-5.0f, -5.0f, 0.0f)); | 130 vertices_a.push_back(gfx::Point3F(-5.0f, -5.0f, 0.0f)); |
| 130 vertices_a.push_back(gfx::Point3F(-5.0f, 5.0f, 0.0f)); | 131 vertices_a.push_back(gfx::Point3F(-5.0f, 5.0f, 0.0f)); |
| 131 vertices_a.push_back(gfx::Point3F(5.0f, 5.0f, 0.0f)); | 132 vertices_a.push_back(gfx::Point3F(5.0f, 5.0f, 0.0f)); |
| 132 vertices_a.push_back(gfx::Point3F(5.0f, -5.0f, 0.0f)); | 133 vertices_a.push_back(gfx::Point3F(5.0f, -5.0f, 0.0f)); |
| 133 std::vector<gfx::Point3F> vertices_b; | 134 std::vector<gfx::Point3F> vertices_b; |
| 134 vertices_b.push_back(gfx::Point3F(0.0f, -5.0f, -5.0f)); | 135 vertices_b.push_back(gfx::Point3F(0.0f, -5.0f, -5.0f)); |
| 135 vertices_b.push_back(gfx::Point3F(0.0f, 5.0f, -5.0f)); | 136 vertices_b.push_back(gfx::Point3F(0.0f, 5.0f, -5.0f)); |
| 136 vertices_b.push_back(gfx::Point3F(0.0f, 5.0f, 5.0f)); | 137 vertices_b.push_back(gfx::Point3F(0.0f, 5.0f, 5.0f)); |
| 137 vertices_b.push_back(gfx::Point3F(0.0f, -5.0f, 5.0f)); | 138 vertices_b.push_back(gfx::Point3F(0.0f, -5.0f, 5.0f)); |
| 138 | 139 |
| 139 scoped_ptr<DrawPolygon> polygon_a( | 140 scoped_ptr<DrawPolygon> polygon_a( |
| 140 CREATE_DRAW_POLYGON(vertices_a, gfx::Vector3dF(0.0f, 0.0f, 1.0f), 0)); | 141 CREATE_DRAW_POLYGON(vertices_a, gfx::Vector3dF(0.0f, 0.0f, 1.0f), 0)); |
| 141 scoped_ptr<DrawPolygon> polygon_b( | 142 scoped_ptr<DrawPolygon> polygon_b( |
| 142 CREATE_DRAW_POLYGON(vertices_b, gfx::Vector3dF(-1.0f, 0.0f, 0.0f), 1)); | 143 CREATE_DRAW_POLYGON(vertices_b, gfx::Vector3dF(-1.0f, 0.0f, 0.0f), 1)); |
| 143 | 144 |
| 144 ScopedPtrDeque<DrawPolygon> polygon_list; | 145 std::deque<scoped_ptr<DrawPolygon>> polygon_list; |
| 145 polygon_list.push_back(polygon_a.Pass()); | 146 polygon_list.push_back(polygon_a.Pass()); |
| 146 polygon_list.push_back(polygon_b.Pass()); | 147 polygon_list.push_back(polygon_b.Pass()); |
| 147 | 148 |
| 148 int compare_ids[] = {1, 0, 1}; | 149 int compare_ids[] = {1, 0, 1}; |
| 149 std::vector<int> compare_list = INT_VECTOR_FROM_ARRAY(compare_ids); | 150 std::vector<int> compare_list = INT_VECTOR_FROM_ARRAY(compare_ids); |
| 150 BspTreeTest::RunTest(&polygon_list, compare_list); | 151 BspTreeTest::RunTest(&polygon_list, compare_list); |
| 151 } | 152 } |
| 152 | 153 |
| 153 // Same as above with the second quad offset so it doesn't intersect. One quad | 154 // Same as above with the second quad offset so it doesn't intersect. One quad |
| 154 // should be very clearly on one side of the other, and no splitting should | 155 // should be very clearly on one side of the other, and no splitting should |
| 155 // occur. | 156 // occur. |
| 156 TEST(BspTreeTest, QuadOffset) { | 157 TEST(BspTreeTest, QuadOffset) { |
| 157 std::vector<gfx::Point3F> vertices_a; | 158 std::vector<gfx::Point3F> vertices_a; |
| 158 vertices_a.push_back(gfx::Point3F(-5.0f, -5.0f, 0.0f)); | 159 vertices_a.push_back(gfx::Point3F(-5.0f, -5.0f, 0.0f)); |
| 159 vertices_a.push_back(gfx::Point3F(-5.0f, 5.0f, 0.0f)); | 160 vertices_a.push_back(gfx::Point3F(-5.0f, 5.0f, 0.0f)); |
| 160 vertices_a.push_back(gfx::Point3F(5.0f, 5.0f, 0.0f)); | 161 vertices_a.push_back(gfx::Point3F(5.0f, 5.0f, 0.0f)); |
| 161 vertices_a.push_back(gfx::Point3F(5.0f, -5.0f, 0.0f)); | 162 vertices_a.push_back(gfx::Point3F(5.0f, -5.0f, 0.0f)); |
| 162 std::vector<gfx::Point3F> vertices_b; | 163 std::vector<gfx::Point3F> vertices_b; |
| 163 vertices_b.push_back(gfx::Point3F(0.0f, 5.0f, -15.0f)); | 164 vertices_b.push_back(gfx::Point3F(0.0f, 5.0f, -15.0f)); |
| 164 vertices_b.push_back(gfx::Point3F(0.0f, -5.0f, -15.0f)); | 165 vertices_b.push_back(gfx::Point3F(0.0f, -5.0f, -15.0f)); |
| 165 vertices_b.push_back(gfx::Point3F(0.0f, -5.0f, -10.0f)); | 166 vertices_b.push_back(gfx::Point3F(0.0f, -5.0f, -10.0f)); |
| 166 vertices_b.push_back(gfx::Point3F(0.0f, 5.0f, -10.0f)); | 167 vertices_b.push_back(gfx::Point3F(0.0f, 5.0f, -10.0f)); |
| 167 | 168 |
| 168 scoped_ptr<DrawPolygon> polygon_a( | 169 scoped_ptr<DrawPolygon> polygon_a( |
| 169 CREATE_DRAW_POLYGON(vertices_a, gfx::Vector3dF(0.0f, 0.0f, 1.0f), 0)); | 170 CREATE_DRAW_POLYGON(vertices_a, gfx::Vector3dF(0.0f, 0.0f, 1.0f), 0)); |
| 170 scoped_ptr<DrawPolygon> polygon_b( | 171 scoped_ptr<DrawPolygon> polygon_b( |
| 171 CREATE_DRAW_POLYGON(vertices_b, gfx::Vector3dF(-1.0f, 0.0f, 0.0f), 1)); | 172 CREATE_DRAW_POLYGON(vertices_b, gfx::Vector3dF(-1.0f, 0.0f, 0.0f), 1)); |
| 172 | 173 |
| 173 ScopedPtrDeque<DrawPolygon> polygon_list; | 174 std::deque<scoped_ptr<DrawPolygon>> polygon_list; |
| 174 polygon_list.push_back(polygon_a.Pass()); | 175 polygon_list.push_back(polygon_a.Pass()); |
| 175 polygon_list.push_back(polygon_b.Pass()); | 176 polygon_list.push_back(polygon_b.Pass()); |
| 176 | 177 |
| 177 int compare_ids[] = {1, 0}; | 178 int compare_ids[] = {1, 0}; |
| 178 std::vector<int> compare_list = INT_VECTOR_FROM_ARRAY(compare_ids); | 179 std::vector<int> compare_list = INT_VECTOR_FROM_ARRAY(compare_ids); |
| 179 BspTreeTest::RunTest(&polygon_list, compare_list); | 180 BspTreeTest::RunTest(&polygon_list, compare_list); |
| 180 } | 181 } |
| 181 | 182 |
| 182 // Same as above, but this time we change the order in which the quads are | 183 // Same as above, but this time we change the order in which the quads are |
| 183 // inserted into the tree, causing one to actually cross the plane of the other | 184 // inserted into the tree, causing one to actually cross the plane of the other |
| 184 // and cause a split. | 185 // and cause a split. |
| 185 TEST(BspTreeTest, QuadOffsetSplit) { | 186 TEST(BspTreeTest, QuadOffsetSplit) { |
| 186 std::vector<gfx::Point3F> vertices_a; | 187 std::vector<gfx::Point3F> vertices_a; |
| 187 vertices_a.push_back(gfx::Point3F(-5.0f, -5.0f, 0.0f)); | 188 vertices_a.push_back(gfx::Point3F(-5.0f, -5.0f, 0.0f)); |
| 188 vertices_a.push_back(gfx::Point3F(-5.0f, 5.0f, 0.0f)); | 189 vertices_a.push_back(gfx::Point3F(-5.0f, 5.0f, 0.0f)); |
| 189 vertices_a.push_back(gfx::Point3F(5.0f, 5.0f, 0.0f)); | 190 vertices_a.push_back(gfx::Point3F(5.0f, 5.0f, 0.0f)); |
| 190 vertices_a.push_back(gfx::Point3F(5.0f, -5.0f, 0.0f)); | 191 vertices_a.push_back(gfx::Point3F(5.0f, -5.0f, 0.0f)); |
| 191 std::vector<gfx::Point3F> vertices_b; | 192 std::vector<gfx::Point3F> vertices_b; |
| 192 vertices_b.push_back(gfx::Point3F(0.0f, -5.0f, -15.0f)); | 193 vertices_b.push_back(gfx::Point3F(0.0f, -5.0f, -15.0f)); |
| 193 vertices_b.push_back(gfx::Point3F(0.0f, 5.0f, -15.0f)); | 194 vertices_b.push_back(gfx::Point3F(0.0f, 5.0f, -15.0f)); |
| 194 vertices_b.push_back(gfx::Point3F(0.0f, 5.0f, -10.0f)); | 195 vertices_b.push_back(gfx::Point3F(0.0f, 5.0f, -10.0f)); |
| 195 vertices_b.push_back(gfx::Point3F(0.0f, -5.0f, -10.0f)); | 196 vertices_b.push_back(gfx::Point3F(0.0f, -5.0f, -10.0f)); |
| 196 | 197 |
| 197 scoped_ptr<DrawPolygon> polygon_a( | 198 scoped_ptr<DrawPolygon> polygon_a( |
| 198 CREATE_DRAW_POLYGON(vertices_a, gfx::Vector3dF(0.0f, 0.0f, 1.0f), 0)); | 199 CREATE_DRAW_POLYGON(vertices_a, gfx::Vector3dF(0.0f, 0.0f, 1.0f), 0)); |
| 199 scoped_ptr<DrawPolygon> polygon_b( | 200 scoped_ptr<DrawPolygon> polygon_b( |
| 200 CREATE_DRAW_POLYGON(vertices_b, gfx::Vector3dF(-1.0f, 0.0f, 0.0f), 1)); | 201 CREATE_DRAW_POLYGON(vertices_b, gfx::Vector3dF(-1.0f, 0.0f, 0.0f), 1)); |
| 201 | 202 |
| 202 ScopedPtrDeque<DrawPolygon> polygon_list; | 203 std::deque<scoped_ptr<DrawPolygon>> polygon_list; |
| 203 polygon_list.push_back(polygon_b.Pass()); | 204 polygon_list.push_back(polygon_b.Pass()); |
| 204 polygon_list.push_back(polygon_a.Pass()); | 205 polygon_list.push_back(polygon_a.Pass()); |
| 205 | 206 |
| 206 int compare_ids[] = {0, 1, 0}; | 207 int compare_ids[] = {0, 1, 0}; |
| 207 std::vector<int> compare_list = INT_VECTOR_FROM_ARRAY(compare_ids); | 208 std::vector<int> compare_list = INT_VECTOR_FROM_ARRAY(compare_ids); |
| 208 BspTreeTest::RunTest(&polygon_list, compare_list); | 209 BspTreeTest::RunTest(&polygon_list, compare_list); |
| 209 } | 210 } |
| 210 | 211 |
| 211 // In addition to what can be viewed as a + from above, another piece of | 212 // In addition to what can be viewed as a + from above, another piece of |
| 212 // geometry is inserted to cut these pieces right in the middle, viewed as | 213 // geometry is inserted to cut these pieces right in the middle, viewed as |
| (...skipping 15 matching lines...) Expand all Loading... |
| 228 vertices_c.push_back(gfx::Point3F(5.0f, 0.0f, 5.0f)); | 229 vertices_c.push_back(gfx::Point3F(5.0f, 0.0f, 5.0f)); |
| 229 vertices_c.push_back(gfx::Point3F(5.0f, 0.0f, -5.0f)); | 230 vertices_c.push_back(gfx::Point3F(5.0f, 0.0f, -5.0f)); |
| 230 | 231 |
| 231 scoped_ptr<DrawPolygon> polygon_a( | 232 scoped_ptr<DrawPolygon> polygon_a( |
| 232 CREATE_DRAW_POLYGON(vertices_a, gfx::Vector3dF(0.0f, 0.0f, 1.0f), 0)); | 233 CREATE_DRAW_POLYGON(vertices_a, gfx::Vector3dF(0.0f, 0.0f, 1.0f), 0)); |
| 233 scoped_ptr<DrawPolygon> polygon_b( | 234 scoped_ptr<DrawPolygon> polygon_b( |
| 234 CREATE_DRAW_POLYGON(vertices_b, gfx::Vector3dF(-1.0f, 0.0f, 0.0f), 1)); | 235 CREATE_DRAW_POLYGON(vertices_b, gfx::Vector3dF(-1.0f, 0.0f, 0.0f), 1)); |
| 235 scoped_ptr<DrawPolygon> polygon_c( | 236 scoped_ptr<DrawPolygon> polygon_c( |
| 236 CREATE_DRAW_POLYGON(vertices_c, gfx::Vector3dF(0.0f, 1.0f, 0.0f), 2)); | 237 CREATE_DRAW_POLYGON(vertices_c, gfx::Vector3dF(0.0f, 1.0f, 0.0f), 2)); |
| 237 | 238 |
| 238 ScopedPtrDeque<DrawPolygon> polygon_list; | 239 std::deque<scoped_ptr<DrawPolygon>> polygon_list; |
| 239 polygon_list.push_back(polygon_a.Pass()); | 240 polygon_list.push_back(polygon_a.Pass()); |
| 240 polygon_list.push_back(polygon_b.Pass()); | 241 polygon_list.push_back(polygon_b.Pass()); |
| 241 polygon_list.push_back(polygon_c.Pass()); | 242 polygon_list.push_back(polygon_c.Pass()); |
| 242 | 243 |
| 243 int compare_ids[] = {2, 1, 2, 0, 2, 1, 2}; | 244 int compare_ids[] = {2, 1, 2, 0, 2, 1, 2}; |
| 244 std::vector<int> compare_list = INT_VECTOR_FROM_ARRAY(compare_ids); | 245 std::vector<int> compare_list = INT_VECTOR_FROM_ARRAY(compare_ids); |
| 245 BspTreeTest::RunTest(&polygon_list, compare_list); | 246 BspTreeTest::RunTest(&polygon_list, compare_list); |
| 246 } | 247 } |
| 247 | 248 |
| 248 // This test checks whether coplanar geometry, when inserted into the tree in | 249 // This test checks whether coplanar geometry, when inserted into the tree in |
| (...skipping 20 matching lines...) Expand all Loading... |
| 269 scoped_ptr<DrawPolygon> polygon_b( | 270 scoped_ptr<DrawPolygon> polygon_b( |
| 270 CREATE_DRAW_POLYGON(vertices_b, gfx::Vector3dF(0.0f, 0.0f, 1.0f), 1)); | 271 CREATE_DRAW_POLYGON(vertices_b, gfx::Vector3dF(0.0f, 0.0f, 1.0f), 1)); |
| 271 scoped_ptr<DrawPolygon> polygon_c( | 272 scoped_ptr<DrawPolygon> polygon_c( |
| 272 CREATE_DRAW_POLYGON(vertices_c, gfx::Vector3dF(0.0f, 0.0f, 1.0f), 2)); | 273 CREATE_DRAW_POLYGON(vertices_c, gfx::Vector3dF(0.0f, 0.0f, 1.0f), 2)); |
| 273 | 274 |
| 274 scoped_ptr<DrawPolygon> polygon_d = polygon_a->CreateCopy(); | 275 scoped_ptr<DrawPolygon> polygon_d = polygon_a->CreateCopy(); |
| 275 scoped_ptr<DrawPolygon> polygon_e = polygon_b->CreateCopy(); | 276 scoped_ptr<DrawPolygon> polygon_e = polygon_b->CreateCopy(); |
| 276 scoped_ptr<DrawPolygon> polygon_f = polygon_c->CreateCopy(); | 277 scoped_ptr<DrawPolygon> polygon_f = polygon_c->CreateCopy(); |
| 277 | 278 |
| 278 { | 279 { |
| 279 ScopedPtrDeque<DrawPolygon> polygon_list; | 280 std::deque<scoped_ptr<DrawPolygon>> polygon_list; |
| 280 polygon_list.push_back(polygon_a.Pass()); | 281 polygon_list.push_back(polygon_a.Pass()); |
| 281 polygon_list.push_back(polygon_b.Pass()); | 282 polygon_list.push_back(polygon_b.Pass()); |
| 282 polygon_list.push_back(polygon_c.Pass()); | 283 polygon_list.push_back(polygon_c.Pass()); |
| 283 | 284 |
| 284 int compare_ids[] = {0, 1, 2}; | 285 int compare_ids[] = {0, 1, 2}; |
| 285 std::vector<int> compare_list = INT_VECTOR_FROM_ARRAY(compare_ids); | 286 std::vector<int> compare_list = INT_VECTOR_FROM_ARRAY(compare_ids); |
| 286 BspTreeTest::RunTest(&polygon_list, compare_list); | 287 BspTreeTest::RunTest(&polygon_list, compare_list); |
| 287 } | 288 } |
| 288 | 289 |
| 289 // Now check a different order and ensure we get that back as well | 290 // Now check a different order and ensure we get that back as well |
| 290 { | 291 { |
| 291 ScopedPtrDeque<DrawPolygon> polygon_list; | 292 std::deque<scoped_ptr<DrawPolygon>> polygon_list; |
| 292 polygon_list.push_back(polygon_f.Pass()); | 293 polygon_list.push_back(polygon_f.Pass()); |
| 293 polygon_list.push_back(polygon_d.Pass()); | 294 polygon_list.push_back(polygon_d.Pass()); |
| 294 polygon_list.push_back(polygon_e.Pass()); | 295 polygon_list.push_back(polygon_e.Pass()); |
| 295 | 296 |
| 296 int compare_ids[] = {0, 1, 2}; | 297 int compare_ids[] = {0, 1, 2}; |
| 297 std::vector<int> compare_list = INT_VECTOR_FROM_ARRAY(compare_ids); | 298 std::vector<int> compare_list = INT_VECTOR_FROM_ARRAY(compare_ids); |
| 298 BspTreeTest::RunTest(&polygon_list, compare_list); | 299 BspTreeTest::RunTest(&polygon_list, compare_list); |
| 299 } | 300 } |
| 300 } | 301 } |
| 301 | 302 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 326 | 327 |
| 327 scoped_ptr<DrawPolygon> polygon_a( | 328 scoped_ptr<DrawPolygon> polygon_a( |
| 328 CREATE_DRAW_POLYGON(vertices_a, gfx::Vector3dF(0.0f, 0.0f, 1.0f), 0)); | 329 CREATE_DRAW_POLYGON(vertices_a, gfx::Vector3dF(0.0f, 0.0f, 1.0f), 0)); |
| 329 scoped_ptr<DrawPolygon> polygon_b( | 330 scoped_ptr<DrawPolygon> polygon_b( |
| 330 CREATE_DRAW_POLYGON(vertices_b, gfx::Vector3dF(0.0f, 0.0f, 1.0f), 1)); | 331 CREATE_DRAW_POLYGON(vertices_b, gfx::Vector3dF(0.0f, 0.0f, 1.0f), 1)); |
| 331 scoped_ptr<DrawPolygon> polygon_c( | 332 scoped_ptr<DrawPolygon> polygon_c( |
| 332 CREATE_DRAW_POLYGON(vertices_c, gfx::Vector3dF(0.0f, 0.0f, 1.0f), 2)); | 333 CREATE_DRAW_POLYGON(vertices_c, gfx::Vector3dF(0.0f, 0.0f, 1.0f), 2)); |
| 333 scoped_ptr<DrawPolygon> polygon_d( | 334 scoped_ptr<DrawPolygon> polygon_d( |
| 334 CREATE_DRAW_POLYGON(vertices_d, gfx::Vector3dF(-1.0f, 0.0f, 0.0f), 3)); | 335 CREATE_DRAW_POLYGON(vertices_d, gfx::Vector3dF(-1.0f, 0.0f, 0.0f), 3)); |
| 335 | 336 |
| 336 ScopedPtrDeque<DrawPolygon> polygon_list; | 337 std::deque<scoped_ptr<DrawPolygon>> polygon_list; |
| 337 polygon_list.push_back(polygon_a.Pass()); | 338 polygon_list.push_back(polygon_a.Pass()); |
| 338 polygon_list.push_back(polygon_b.Pass()); | 339 polygon_list.push_back(polygon_b.Pass()); |
| 339 polygon_list.push_back(polygon_c.Pass()); | 340 polygon_list.push_back(polygon_c.Pass()); |
| 340 polygon_list.push_back(polygon_d.Pass()); | 341 polygon_list.push_back(polygon_d.Pass()); |
| 341 | 342 |
| 342 int compare_ids[] = {3, 0, 1, 2, 3}; | 343 int compare_ids[] = {3, 0, 1, 2, 3}; |
| 343 std::vector<int> compare_list = INT_VECTOR_FROM_ARRAY(compare_ids); | 344 std::vector<int> compare_list = INT_VECTOR_FROM_ARRAY(compare_ids); |
| 344 BspTreeTest::RunTest(&polygon_list, compare_list); | 345 BspTreeTest::RunTest(&polygon_list, compare_list); |
| 345 } | 346 } |
| 346 | 347 |
| 347 } // namespace | 348 } // namespace |
| 348 } // namespace cc | 349 } // namespace cc |
| OLD | NEW |