| 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 "cc/quads/draw_polygon.h" | 5 #include "cc/quads/draw_polygon.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 230 | 230 |
| 231 *is_coplanar = false; | 231 *is_coplanar = false; |
| 232 if (!neg_count) { | 232 if (!neg_count) { |
| 233 *front = std::move(polygon); | 233 *front = std::move(polygon); |
| 234 return; | 234 return; |
| 235 } else if (!pos_count) { | 235 } else if (!pos_count) { |
| 236 *back = std::move(polygon); | 236 *back = std::move(polygon); |
| 237 return; | 237 return; |
| 238 } | 238 } |
| 239 | 239 |
| 240 // There should be at most two points that are considered to be on the thick | |
| 241 // plane. If this is not the case, then the polygon is not convex. | |
| 242 DCHECK_LE(num_points - pos_count - neg_count, 2u); | |
| 243 | |
| 244 // Handle splitting case. | 240 // Handle splitting case. |
| 245 size_t front_begin; | 241 size_t front_begin; |
| 246 size_t back_begin; | 242 size_t back_begin; |
| 247 size_t pre_front_begin; | 243 size_t pre_front_begin; |
| 248 size_t pre_back_begin; | 244 size_t pre_back_begin; |
| 249 | 245 |
| 250 // Find the first vertex that is part of the front split polygon. | 246 // Find the first vertex that is part of the front split polygon. |
| 251 front_begin = std::find_if(vertex_distance.begin(), vertex_distance.end(), | 247 front_begin = std::find_if(vertex_distance.begin(), vertex_distance.end(), |
| 252 [](float val) { return val > 0.0; }) - | 248 [](float val) { return val > 0.0; }) - |
| 253 vertex_distance.begin(); | 249 vertex_distance.begin(); |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 341 quads->push_back( | 337 quads->push_back( |
| 342 gfx::QuadF(first, | 338 gfx::QuadF(first, |
| 343 gfx::PointF(points_[offset].x(), points_[offset].y()), | 339 gfx::PointF(points_[offset].x(), points_[offset].y()), |
| 344 gfx::PointF(points_[op1].x(), points_[op1].y()), | 340 gfx::PointF(points_[op1].x(), points_[op1].y()), |
| 345 gfx::PointF(points_[op2].x(), points_[op2].y()))); | 341 gfx::PointF(points_[op2].x(), points_[op2].y()))); |
| 346 offset = op2; | 342 offset = op2; |
| 347 } | 343 } |
| 348 } | 344 } |
| 349 | 345 |
| 350 } // namespace cc | 346 } // namespace cc |
| OLD | NEW |