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

Side by Side Diff: cc/quads/draw_polygon.h

Issue 2043283002: Perform BSP polygon splitting and orientation selection in a single step. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update test expectations Created 4 years, 6 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
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 #ifndef CC_QUADS_DRAW_POLYGON_H_ 5 #ifndef CC_QUADS_DRAW_POLYGON_H_
6 #define CC_QUADS_DRAW_POLYGON_H_ 6 #define CC_QUADS_DRAW_POLYGON_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "cc/base/math_util.h" 10 #include "cc/base/math_util.h"
(...skipping 22 matching lines...) Expand all
33 const gfx::Transform& transform, 33 const gfx::Transform& transform,
34 int draw_order_index = 0); 34 int draw_order_index = 0);
35 35
36 // Split takes this DrawPolygon and splits it into two pieces that are on 36 // Split takes this DrawPolygon and splits it into two pieces that are on
37 // either side of |splitter|. Any edges of this polygon that cross the plane 37 // either side of |splitter|. Any edges of this polygon that cross the plane
38 // of |splitter| will have an intersection point that is shared by both 38 // of |splitter| will have an intersection point that is shared by both
39 // polygons on either side. 39 // polygons on either side.
40 // Split will only return true if it determines that we got back 2 40 // Split will only return true if it determines that we got back 2
41 // intersection points. Only when it returns true will front and back both be 41 // intersection points. Only when it returns true will front and back both be
42 // valid new polygons that are on opposite sides of the splitting plane. 42 // valid new polygons that are on opposite sides of the splitting plane.
43 bool Split(const DrawPolygon& splitter, 43 bool SplitPolygon(std::unique_ptr<DrawPolygon> polygon,
enne (OOO) 2016/06/08 22:02:51 Style nit: if you have more than one out parameter
Tobias Sargeant 2016/06/09 16:48:44 Done.
44 std::unique_ptr<DrawPolygon>* front, 44 std::unique_ptr<DrawPolygon>* front,
45 std::unique_ptr<DrawPolygon>* back); 45 std::unique_ptr<DrawPolygon>* back);
46 bool SplitPolygon(const DrawPolygon& polygon,
enne (OOO) 2016/06/08 22:02:51 This is a bit awkward. How many test locations us
Tobias Sargeant 2016/06/09 16:48:44 Moved this into the tests.
47 std::unique_ptr<DrawPolygon>* front,
48 std::unique_ptr<DrawPolygon>* back);
46 float SignedPointDistance(const gfx::Point3F& point) const; 49 float SignedPointDistance(const gfx::Point3F& point) const;
47 // Checks polygon a against polygon b and returns which side it lies on, or 50 // Checks polygon a against polygon b and returns which side it lies on, or
48 // whether it crosses (necessitating a split in the BSP tree). 51 // whether it crosses (necessitating a split in the BSP tree).
49 static BspCompareResult SideCompare(const DrawPolygon& a, 52 static BspCompareResult SideCompare(const DrawPolygon& a,
50 const DrawPolygon& b); 53 const DrawPolygon& b);
51 void ToQuads2D(std::vector<gfx::QuadF>* quads) const; 54 void ToQuads2D(std::vector<gfx::QuadF>* quads) const;
52 void TransformToScreenSpace(const gfx::Transform& transform); 55 void TransformToScreenSpace(const gfx::Transform& transform);
53 void TransformToLayerSpace(const gfx::Transform& inverse_transform); 56 void TransformToLayerSpace(const gfx::Transform& inverse_transform);
54 57
55 const std::vector<gfx::Point3F>& points() const { return points_; } 58 const std::vector<gfx::Point3F>& points() const { return points_; }
(...skipping 22 matching lines...) Expand all
78 // we need. 81 // we need.
79 // This DrawQuad is owned by the caller and its lifetime must be preserved 82 // This DrawQuad is owned by the caller and its lifetime must be preserved
80 // as long as this DrawPolygon is alive. 83 // as long as this DrawPolygon is alive.
81 const DrawQuad* original_ref_; 84 const DrawQuad* original_ref_;
82 bool is_split_; 85 bool is_split_;
83 }; 86 };
84 87
85 } // namespace cc 88 } // namespace cc
86 89
87 #endif // CC_QUADS_DRAW_POLYGON_H_ 90 #endif // CC_QUADS_DRAW_POLYGON_H_
OLDNEW
« no previous file with comments | « cc/output/bsp_tree.cc ('k') | cc/quads/draw_polygon.cc » ('j') | cc/quads/draw_polygon.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698