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

Unified Diff: cc/base/math_util.cc

Issue 2630483002: Remove 2d MapClippedQuad. (Closed)
Patch Set: rebased Created 3 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/base/math_util.h ('k') | cc/base/math_util_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/base/math_util.cc
diff --git a/cc/base/math_util.cc b/cc/base/math_util.cc
index 72a453f401fa83566d5b668df998fb528b172d04..f7ccd43a6a362beb35fa0bf547087d178214a604 100644
--- a/cc/base/math_util.cc
+++ b/cc/base/math_util.cc
@@ -177,18 +177,6 @@ static inline bool IsNearlyTheSame(const gfx::Point3F& lhs,
IsNearlyTheSame(lhs.y(), rhs.y()) && IsNearlyTheSame(lhs.z(), rhs.z());
}
-static inline void AddVertexToClippedQuad(const gfx::PointF& new_vertex,
- gfx::PointF clipped_quad[8],
- int* num_vertices_in_clipped_quad) {
- if (*num_vertices_in_clipped_quad > 0 &&
- IsNearlyTheSame(clipped_quad[*num_vertices_in_clipped_quad - 1],
- new_vertex))
- return;
-
- clipped_quad[*num_vertices_in_clipped_quad] = new_vertex;
- (*num_vertices_in_clipped_quad)++;
-}
-
static inline void AddVertexToClippedQuad3d(const gfx::Point3F& new_vertex,
gfx::Point3F clipped_quad[8],
int* num_vertices_in_clipped_quad) {
@@ -319,72 +307,6 @@ gfx::Rect MathUtil::MapEnclosedRectWith2dAxisAlignedTransform(
return gfx::ToEnclosedRect(gfx::BoundingRect(top_left, bottom_right));
}
-void MathUtil::MapClippedQuad(const gfx::Transform& transform,
- const gfx::QuadF& src_quad,
- gfx::PointF clipped_quad[8],
- int* num_vertices_in_clipped_quad) {
- HomogeneousCoordinate h1 =
- MapHomogeneousPoint(transform, gfx::Point3F(src_quad.p1()));
- HomogeneousCoordinate h2 =
- MapHomogeneousPoint(transform, gfx::Point3F(src_quad.p2()));
- HomogeneousCoordinate h3 =
- MapHomogeneousPoint(transform, gfx::Point3F(src_quad.p3()));
- HomogeneousCoordinate h4 =
- MapHomogeneousPoint(transform, gfx::Point3F(src_quad.p4()));
-
- // The order of adding the vertices to the array is chosen so that
- // clockwise / counter-clockwise orientation is retained.
-
- *num_vertices_in_clipped_quad = 0;
-
- if (!h1.ShouldBeClipped()) {
- AddVertexToClippedQuad(
- h1.CartesianPoint2d(), clipped_quad, num_vertices_in_clipped_quad);
- }
-
- if (h1.ShouldBeClipped() ^ h2.ShouldBeClipped()) {
- AddVertexToClippedQuad(ComputeClippedCartesianPoint2dForEdge(h1, h2),
- clipped_quad, num_vertices_in_clipped_quad);
- }
-
- if (!h2.ShouldBeClipped()) {
- AddVertexToClippedQuad(
- h2.CartesianPoint2d(), clipped_quad, num_vertices_in_clipped_quad);
- }
-
- if (h2.ShouldBeClipped() ^ h3.ShouldBeClipped()) {
- AddVertexToClippedQuad(ComputeClippedCartesianPoint2dForEdge(h2, h3),
- clipped_quad, num_vertices_in_clipped_quad);
- }
-
- if (!h3.ShouldBeClipped()) {
- AddVertexToClippedQuad(
- h3.CartesianPoint2d(), clipped_quad, num_vertices_in_clipped_quad);
- }
-
- if (h3.ShouldBeClipped() ^ h4.ShouldBeClipped()) {
- AddVertexToClippedQuad(ComputeClippedCartesianPoint2dForEdge(h3, h4),
- clipped_quad, num_vertices_in_clipped_quad);
- }
-
- if (!h4.ShouldBeClipped()) {
- AddVertexToClippedQuad(
- h4.CartesianPoint2d(), clipped_quad, num_vertices_in_clipped_quad);
- }
-
- if (h4.ShouldBeClipped() ^ h1.ShouldBeClipped()) {
- AddVertexToClippedQuad(ComputeClippedCartesianPoint2dForEdge(h4, h1),
- clipped_quad, num_vertices_in_clipped_quad);
- }
-
- if (*num_vertices_in_clipped_quad > 2 &&
- IsNearlyTheSame(clipped_quad[0],
- clipped_quad[*num_vertices_in_clipped_quad - 1]))
- *num_vertices_in_clipped_quad -= 1;
-
- DCHECK_LE(*num_vertices_in_clipped_quad, 8);
-}
-
bool MathUtil::MapClippedQuad3d(const gfx::Transform& transform,
const gfx::QuadF& src_quad,
gfx::Point3F clipped_quad[8],
« no previous file with comments | « cc/base/math_util.h ('k') | cc/base/math_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698