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 <vector> | 7 #include <vector> |
8 | 8 |
9 #include "cc/output/bsp_compare_result.h" | 9 #include "cc/output/bsp_compare_result.h" |
10 #include "cc/quads/draw_quad.h" | 10 #include "cc/quads/draw_quad.h" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 for (size_t i = 0; i < in_points.size(); i++) { | 45 for (size_t i = 0; i < in_points.size(); i++) { |
46 points_.push_back(in_points[i]); | 46 points_.push_back(in_points[i]); |
47 } | 47 } |
48 normal_ = normal; | 48 normal_ = normal; |
49 } | 49 } |
50 | 50 |
51 // This takes the original DrawQuad that this polygon should be based on, | 51 // This takes the original DrawQuad that this polygon should be based on, |
52 // a visible content rect to make the 4 corner points from, and a transformation | 52 // a visible content rect to make the 4 corner points from, and a transformation |
53 // to move it and its normal into screen space. | 53 // to move it and its normal into screen space. |
54 DrawPolygon::DrawPolygon(const DrawQuad* original_ref, | 54 DrawPolygon::DrawPolygon(const DrawQuad* original_ref, |
55 const gfx::RectF& visible_content_rect, | 55 const gfx::RectF& visible_layer_rect, |
56 const gfx::Transform& transform, | 56 const gfx::Transform& transform, |
57 int draw_order_index) | 57 int draw_order_index) |
58 : normal_(0.0f, 0.0f, 1.0f), | 58 : normal_(0.0f, 0.0f, 1.0f), |
59 order_index_(draw_order_index), | 59 order_index_(draw_order_index), |
60 original_ref_(original_ref), | 60 original_ref_(original_ref), |
61 is_split_(false) { | 61 is_split_(false) { |
62 gfx::Point3F points[8]; | 62 gfx::Point3F points[8]; |
63 int num_vertices_in_clipped_quad; | 63 int num_vertices_in_clipped_quad; |
64 gfx::QuadF send_quad(visible_content_rect); | 64 gfx::QuadF send_quad(visible_layer_rect); |
65 | 65 |
66 // Doing this mapping here is very important, since we can't just transform | 66 // Doing this mapping here is very important, since we can't just transform |
67 // the points without clipping and not run into strange geometry issues when | 67 // the points without clipping and not run into strange geometry issues when |
68 // crossing w = 0. At this point, in the constructor, we know that we're | 68 // crossing w = 0. At this point, in the constructor, we know that we're |
69 // working with a quad, so we can reuse the MathUtil::MapClippedQuad3d | 69 // working with a quad, so we can reuse the MathUtil::MapClippedQuad3d |
70 // function instead of writing a generic polygon version of it. | 70 // function instead of writing a generic polygon version of it. |
71 MathUtil::MapClippedQuad3d( | 71 MathUtil::MapClippedQuad3d( |
72 transform, send_quad, points, &num_vertices_in_clipped_quad); | 72 transform, send_quad, points, &num_vertices_in_clipped_quad); |
73 for (int i = 0; i < num_vertices_in_clipped_quad; i++) { | 73 for (int i = 0; i < num_vertices_in_clipped_quad; i++) { |
74 points_.push_back(points[i]); | 74 points_.push_back(points[i]); |
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
354 quads->push_back( | 354 quads->push_back( |
355 gfx::QuadF(first, | 355 gfx::QuadF(first, |
356 gfx::PointF(points_[offset].x(), points_[offset].y()), | 356 gfx::PointF(points_[offset].x(), points_[offset].y()), |
357 gfx::PointF(points_[op1].x(), points_[op1].y()), | 357 gfx::PointF(points_[op1].x(), points_[op1].y()), |
358 gfx::PointF(points_[op2].x(), points_[op2].y()))); | 358 gfx::PointF(points_[op2].x(), points_[op2].y()))); |
359 offset = op2; | 359 offset = op2; |
360 } | 360 } |
361 } | 361 } |
362 | 362 |
363 } // namespace cc | 363 } // namespace cc |
OLD | NEW |