summaryrefslogtreecommitdiffstats
path: root/cc/quads
diff options
context:
space:
mode:
authorpetermayo <petermayo@chromium.org>2015-11-06 13:56:25 -0800
committerCommit bot <commit-bot@chromium.org>2015-11-06 21:57:18 +0000
commitbce297cc9cae657e3a4b0539dc50cf61a77d0103 (patch)
treec82a02f3d9f513f9863af05a596637386fdeaa17 /cc/quads
parent5fb37b7f4d3de55e132651c483fb4ba4a8bb3060 (diff)
downloadchromium_src-bce297cc9cae657e3a4b0539dc50cf61a77d0103.zip
chromium_src-bce297cc9cae657e3a4b0539dc50cf61a77d0103.tar.gz
chromium_src-bce297cc9cae657e3a4b0539dc50cf61a77d0103.tar.bz2
Decrease the presumed thickness of polygons.
This addresses some of the common expectations that single digit differences in Z value will change rendering order. BUG=499397 R=flackr@chromium.org TEST=Rendering of Z stacked boxes, test case in bug. CQ_INCLUDE_TRYBOTS=tryserver.blink:linux_blink_rel Review URL: https://codereview.chromium.org/1412143004 Cr-Commit-Position: refs/heads/master@{#358416}
Diffstat (limited to 'cc/quads')
-rw-r--r--cc/quads/draw_polygon.cc4
-rw-r--r--cc/quads/draw_polygon_unittest.cc21
2 files changed, 23 insertions, 2 deletions
diff --git a/cc/quads/draw_polygon.cc b/cc/quads/draw_polygon.cc
index 9ff1af6..02c1283 100644
--- a/cc/quads/draw_polygon.cc
+++ b/cc/quads/draw_polygon.cc
@@ -16,7 +16,7 @@ static const float coplanar_dot_epsilon = 0.001f;
// This threshold controls how "thick" a plane is. If a point's distance is
// <= |compare_threshold|, then it is considered on the plane. Only when this
// boundary is crossed do we consider doing splitting.
-static const float compare_threshold = 1.0f;
+static const float compare_threshold = 0.1f;
// |split_threshold| is lower in this case because we want the points created
// during splitting to be well within the range of |compare_threshold| for
// comparison purposes. The splitting operation will produce intersection points
@@ -27,7 +27,7 @@ static const float compare_threshold = 1.0f;
// this range.
// This is really supposd to be compare_threshold / 2.0f, but that would
// create another static initializer.
-static const float split_threshold = 0.5f;
+static const float split_threshold = 0.05f;
static const float normalized_threshold = 0.001f;
} // namespace
diff --git a/cc/quads/draw_polygon_unittest.cc b/cc/quads/draw_polygon_unittest.cc
index 517e131..caf0f27 100644
--- a/cc/quads/draw_polygon_unittest.cc
+++ b/cc/quads/draw_polygon_unittest.cc
@@ -32,6 +32,27 @@ static void ValidatePoints(const DrawPolygon& polygon,
}
}
+// Two quads are nearly touching but definitely ordered. Second one should
+// compare in front.
+TEST(DrawPolygonSplitTest, NearlyTouchingOrder) {
+ std::vector<gfx::Point3F> vertices_a;
+ vertices_a.push_back(gfx::Point3F(0.0f, 10.0f, 0.0f));
+ vertices_a.push_back(gfx::Point3F(0.0f, 0.0f, 0.0f));
+ vertices_a.push_back(gfx::Point3F(10.0f, 0.0f, 0.0f));
+ vertices_a.push_back(gfx::Point3F(10.0f, 10.0f, 0.0f));
+ std::vector<gfx::Point3F> vertices_b;
+ vertices_b.push_back(gfx::Point3F(0.0f, 10.0f, -1.0f));
+ vertices_b.push_back(gfx::Point3F(0.0f, 0.0f, -1.0f));
+ vertices_b.push_back(gfx::Point3F(10.0f, 0.0f, -1.0f));
+ vertices_b.push_back(gfx::Point3F(10.0f, 10.0f, -1.0f));
+ gfx::Vector3dF normal(0.0f, 0.0f, 1.0f);
+
+ CREATE_NEW_DRAW_POLYGON(polygon_a, vertices_a, normal, 0);
+ CREATE_NEW_DRAW_POLYGON(polygon_b, vertices_b, normal, 1);
+
+ EXPECT_EQ(BSP_BACK, DrawPolygon::SideCompare(polygon_b, polygon_a));
+}
+
// Two quads are definitely not touching and so no split should occur.
TEST(DrawPolygonSplitTest, NotTouchingNoSplit) {
std::vector<gfx::Point3F> vertices_a;