Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(87)

Side by Side Diff: cc/quads/draw_polygon_unittest.cc

Issue 1866203004: Convert //cc from scoped_ptr to std::unique_ptr. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: scopedptrcc: rebase Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/quads/draw_polygon.cc ('k') | cc/quads/draw_quad_perftest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 // We would like to use M_PI on windows too. 5 // We would like to use M_PI on windows too.
6 #ifdef _WIN32 6 #ifdef _WIN32
7 #define _USE_MATH_DEFINES 7 #define _USE_MATH_DEFINES
8 #endif 8 #endif
9 9
10 #include <stddef.h> 10 #include <stddef.h>
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 vertices_b.push_back(gfx::Point3F(5.0f, 0.0f, 5.0f)); 253 vertices_b.push_back(gfx::Point3F(5.0f, 0.0f, 5.0f));
254 vertices_b.push_back(gfx::Point3F(5.0f, 10.0f, 5.0f)); 254 vertices_b.push_back(gfx::Point3F(5.0f, 10.0f, 5.0f));
255 255
256 CREATE_NEW_DRAW_POLYGON( 256 CREATE_NEW_DRAW_POLYGON(
257 polygon_a, vertices_a, gfx::Vector3dF(0.0f, 0.0f, 1.0f), 0); 257 polygon_a, vertices_a, gfx::Vector3dF(0.0f, 0.0f, 1.0f), 0);
258 CREATE_NEW_DRAW_POLYGON( 258 CREATE_NEW_DRAW_POLYGON(
259 polygon_b, vertices_b, gfx::Vector3dF(-1.0f, 0.0f, 0.0f), 1); 259 polygon_b, vertices_b, gfx::Vector3dF(-1.0f, 0.0f, 0.0f), 1);
260 260
261 EXPECT_EQ(BSP_SPLIT, DrawPolygon::SideCompare(polygon_b, polygon_a)); 261 EXPECT_EQ(BSP_SPLIT, DrawPolygon::SideCompare(polygon_b, polygon_a));
262 262
263 scoped_ptr<DrawPolygon> front_polygon; 263 std::unique_ptr<DrawPolygon> front_polygon;
264 scoped_ptr<DrawPolygon> back_polygon; 264 std::unique_ptr<DrawPolygon> back_polygon;
265 polygon_b.Split(polygon_a, &front_polygon, &back_polygon); 265 polygon_b.Split(polygon_a, &front_polygon, &back_polygon);
266 EXPECT_EQ(BSP_FRONT, DrawPolygon::SideCompare(*front_polygon, polygon_a)); 266 EXPECT_EQ(BSP_FRONT, DrawPolygon::SideCompare(*front_polygon, polygon_a));
267 EXPECT_EQ(BSP_BACK, DrawPolygon::SideCompare(*back_polygon, polygon_a)); 267 EXPECT_EQ(BSP_BACK, DrawPolygon::SideCompare(*back_polygon, polygon_a));
268 268
269 std::vector<gfx::Point3F> test_points_a; 269 std::vector<gfx::Point3F> test_points_a;
270 test_points_a.push_back(gfx::Point3F(5.0f, 0.0f, 0.0f)); 270 test_points_a.push_back(gfx::Point3F(5.0f, 0.0f, 0.0f));
271 test_points_a.push_back(gfx::Point3F(5.0f, 0.0f, 5.0f)); 271 test_points_a.push_back(gfx::Point3F(5.0f, 0.0f, 5.0f));
272 test_points_a.push_back(gfx::Point3F(5.0f, 10.0f, 5.0f)); 272 test_points_a.push_back(gfx::Point3F(5.0f, 10.0f, 5.0f));
273 test_points_a.push_back(gfx::Point3F(5.0f, 10.0f, 0.0f)); 273 test_points_a.push_back(gfx::Point3F(5.0f, 10.0f, 0.0f));
274 std::vector<gfx::Point3F> test_points_b; 274 std::vector<gfx::Point3F> test_points_b;
(...skipping 22 matching lines...) Expand all
297 vertices_b.push_back(gfx::Point3F(-1.0f, -5.0f, -2.0f)); 297 vertices_b.push_back(gfx::Point3F(-1.0f, -5.0f, -2.0f));
298 vertices_b.push_back(gfx::Point3F(-1.0f, 5.0f, -2.0f)); 298 vertices_b.push_back(gfx::Point3F(-1.0f, 5.0f, -2.0f));
299 299
300 CREATE_NEW_DRAW_POLYGON( 300 CREATE_NEW_DRAW_POLYGON(
301 polygon_a, vertices_a, gfx::Vector3dF(0.0f, 1.0f, 0.0f), 0); 301 polygon_a, vertices_a, gfx::Vector3dF(0.0f, 1.0f, 0.0f), 0);
302 CREATE_NEW_DRAW_POLYGON( 302 CREATE_NEW_DRAW_POLYGON(
303 polygon_b, vertices_b, gfx::Vector3dF(0.707107f, 0.0f, -0.707107f), 1); 303 polygon_b, vertices_b, gfx::Vector3dF(0.707107f, 0.0f, -0.707107f), 1);
304 304
305 EXPECT_EQ(BSP_SPLIT, DrawPolygon::SideCompare(polygon_a, polygon_b)); 305 EXPECT_EQ(BSP_SPLIT, DrawPolygon::SideCompare(polygon_a, polygon_b));
306 306
307 scoped_ptr<DrawPolygon> front_polygon; 307 std::unique_ptr<DrawPolygon> front_polygon;
308 scoped_ptr<DrawPolygon> back_polygon; 308 std::unique_ptr<DrawPolygon> back_polygon;
309 polygon_a.Split(polygon_b, &front_polygon, &back_polygon); 309 polygon_a.Split(polygon_b, &front_polygon, &back_polygon);
310 EXPECT_EQ(BSP_FRONT, DrawPolygon::SideCompare(*front_polygon, polygon_b)); 310 EXPECT_EQ(BSP_FRONT, DrawPolygon::SideCompare(*front_polygon, polygon_b));
311 EXPECT_EQ(BSP_BACK, DrawPolygon::SideCompare(*back_polygon, polygon_b)); 311 EXPECT_EQ(BSP_BACK, DrawPolygon::SideCompare(*back_polygon, polygon_b));
312 312
313 EXPECT_EQ(3u, front_polygon->points().size()); 313 EXPECT_EQ(3u, front_polygon->points().size());
314 EXPECT_EQ(5u, back_polygon->points().size()); 314 EXPECT_EQ(5u, back_polygon->points().size());
315 315
316 std::vector<gfx::Point3F> test_points_a; 316 std::vector<gfx::Point3F> test_points_a;
317 test_points_a.push_back(gfx::Point3F(10.0f, 0.0f, 9.0f)); 317 test_points_a.push_back(gfx::Point3F(10.0f, 0.0f, 9.0f));
318 test_points_a.push_back(gfx::Point3F(10.0f, 0.0f, 0.0f)); 318 test_points_a.push_back(gfx::Point3F(10.0f, 0.0f, 0.0f));
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 351
352 // Note: We use EXPECT_FLOAT_WITHIN_EPSILON instead of EXPECT_FLOAT_EQUAL here 352 // Note: We use EXPECT_FLOAT_WITHIN_EPSILON instead of EXPECT_FLOAT_EQUAL here
353 // because some architectures (e.g., Arm64) employ a fused multiply-add 353 // because some architectures (e.g., Arm64) employ a fused multiply-add
354 // instruction which causes rounding asymmetry and reduces precision. 354 // instruction which causes rounding asymmetry and reduces precision.
355 // http://crbug.com/401117. 355 // http://crbug.com/401117.
356 EXPECT_NORMAL(polygon_a, 0.0f, 0.0f, -1.0f); 356 EXPECT_NORMAL(polygon_a, 0.0f, 0.0f, -1.0f);
357 } 357 }
358 358
359 } // namespace 359 } // namespace
360 } // namespace cc 360 } // namespace cc
OLDNEW
« no previous file with comments | « cc/quads/draw_polygon.cc ('k') | cc/quads/draw_quad_perftest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698