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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 for (int i = 0; i < num_vertices_in_clipped_quad; i++) { | 69 for (int i = 0; i < num_vertices_in_clipped_quad; i++) { |
70 points_.push_back(points[i]); | 70 points_.push_back(points[i]); |
71 } | 71 } |
72 ApplyTransformToNormal(transform); | 72 ApplyTransformToNormal(transform); |
73 } | 73 } |
74 | 74 |
75 DrawPolygon::~DrawPolygon() { | 75 DrawPolygon::~DrawPolygon() { |
76 } | 76 } |
77 | 77 |
78 scoped_ptr<DrawPolygon> DrawPolygon::CreateCopy() { | 78 scoped_ptr<DrawPolygon> DrawPolygon::CreateCopy() { |
79 DrawPolygon* new_polygon = new DrawPolygon(); | 79 scoped_ptr<DrawPolygon> new_polygon(new DrawPolygon()); |
80 new_polygon->order_index_ = order_index_; | 80 new_polygon->order_index_ = order_index_; |
81 new_polygon->original_ref_ = original_ref_; | 81 new_polygon->original_ref_ = original_ref_; |
82 new_polygon->points_.reserve(points_.size()); | 82 new_polygon->points_.reserve(points_.size()); |
83 new_polygon->points_ = points_; | 83 new_polygon->points_ = points_; |
84 new_polygon->normal_.set_x(normal_.x()); | 84 new_polygon->normal_.set_x(normal_.x()); |
85 new_polygon->normal_.set_y(normal_.y()); | 85 new_polygon->normal_.set_y(normal_.y()); |
86 new_polygon->normal_.set_z(normal_.z()); | 86 new_polygon->normal_.set_z(normal_.z()); |
87 return scoped_ptr<DrawPolygon>(new_polygon); | 87 return new_polygon.Pass(); |
88 } | 88 } |
89 | 89 |
90 float DrawPolygon::SignedPointDistance(const gfx::Point3F& point) const { | 90 float DrawPolygon::SignedPointDistance(const gfx::Point3F& point) const { |
91 return gfx::DotProduct(point - points_[0], normal_); | 91 return gfx::DotProduct(point - points_[0], normal_); |
92 } | 92 } |
93 | 93 |
94 // Checks whether or not shape a lies on the front or back side of b, or | 94 // Checks whether or not shape a lies on the front or back side of b, or |
95 // whether they should be considered coplanar. If on the back side, we | 95 // whether they should be considered coplanar. If on the back side, we |
96 // say ABeforeB because it should be drawn in that order. | 96 // say ABeforeB because it should be drawn in that order. |
97 // Assumes that layers are split and there are no intersecting planes. | 97 // Assumes that layers are split and there are no intersecting planes. |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
343 quads->push_back( | 343 quads->push_back( |
344 gfx::QuadF(first, | 344 gfx::QuadF(first, |
345 gfx::PointF(points_[offset].x(), points_[offset].y()), | 345 gfx::PointF(points_[offset].x(), points_[offset].y()), |
346 gfx::PointF(points_[op1].x(), points_[op1].y()), | 346 gfx::PointF(points_[op1].x(), points_[op1].y()), |
347 gfx::PointF(points_[op2].x(), points_[op2].y()))); | 347 gfx::PointF(points_[op2].x(), points_[op2].y()))); |
348 offset = op2; | 348 offset = op2; |
349 } | 349 } |
350 } | 350 } |
351 | 351 |
352 } // namespace cc | 352 } // namespace cc |
OLD | NEW |