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 // 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 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 for (int i = 0; i < 100; i++) { | 162 for (int i = 0; i < 100; i++) { |
163 vertices_c.push_back( | 163 vertices_c.push_back( |
164 gfx::Point3F(cos(i * M_PI / 50), sin(i * M_PI / 50), 0.0f)); | 164 gfx::Point3F(cos(i * M_PI / 50), sin(i * M_PI / 50), 0.0f)); |
165 vertices_d.push_back(gfx::Point3F(cos(i * M_PI / 50) + 99.0f, | 165 vertices_d.push_back(gfx::Point3F(cos(i * M_PI / 50) + 99.0f, |
166 sin(i * M_PI / 50) + 99.0f, 100.0f)); | 166 sin(i * M_PI / 50) + 99.0f, 100.0f)); |
167 } | 167 } |
168 CREATE_TEST_DRAW_FORWARD_POLYGON(polygon_c, vertices_c, 3); | 168 CREATE_TEST_DRAW_FORWARD_POLYGON(polygon_c, vertices_c, 3); |
169 EXPECT_NORMAL(polygon_c, 0.0f, 0.0f, 1.0f); | 169 EXPECT_NORMAL(polygon_c, 0.0f, 0.0f, 1.0f); |
170 | 170 |
171 CREATE_TEST_DRAW_FORWARD_POLYGON(polygon_d, vertices_d, 4); | 171 CREATE_TEST_DRAW_FORWARD_POLYGON(polygon_d, vertices_d, 4); |
172 EXPECT_NORMAL(polygon_c, 0.0f, 0.0f, 1.0f); | 172 EXPECT_NORMAL(polygon_d, 0.0f, 0.0f, 1.0f); |
173 } | 173 } |
174 | 174 |
175 // A simple rect being transformed. | 175 // A simple rect being transformed. |
176 TEST(DrawPolygonConstructionTest, SimpleNormal) { | 176 TEST(DrawPolygonConstructionTest, SimpleNormal) { |
177 gfx::RectF src(-0.1f, -10.0f, 0.2f, 20.0f); | 177 gfx::RectF src(-0.1f, -10.0f, 0.2f, 20.0f); |
178 | 178 |
179 gfx::Transform transform_i(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); | 179 gfx::Transform transform_i(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); |
180 DrawPolygon polygon_i(NULL, src, transform_i, 1); | 180 DrawPolygon polygon_i(NULL, src, transform_i, 1); |
181 | 181 |
182 EXPECT_NORMAL(polygon_i, 0.0f, 0.0f, 1.0f); | 182 EXPECT_NORMAL(polygon_i, 0.0f, 0.0f, 1.0f); |
(...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
621 | 621 |
622 // Note: We use EXPECT_FLOAT_WITHIN_EPSILON instead of EXPECT_FLOAT_EQUAL here | 622 // Note: We use EXPECT_FLOAT_WITHIN_EPSILON instead of EXPECT_FLOAT_EQUAL here |
623 // because some architectures (e.g., Arm64) employ a fused multiply-add | 623 // because some architectures (e.g., Arm64) employ a fused multiply-add |
624 // instruction which causes rounding asymmetry and reduces precision. | 624 // instruction which causes rounding asymmetry and reduces precision. |
625 // http://crbug.com/401117. | 625 // http://crbug.com/401117. |
626 EXPECT_NORMAL(polygon_a, 0.0f, 0.0f, -1.0f); | 626 EXPECT_NORMAL(polygon_a, 0.0f, 0.0f, -1.0f); |
627 } | 627 } |
628 | 628 |
629 } // namespace | 629 } // namespace |
630 } // namespace cc | 630 } // namespace cc |
OLD | NEW |