aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorGravatar senorblanco <senorblanco@chromium.org>2015-03-02 09:34:13 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2015-03-02 09:34:13 -0800
commita2b6d28755916cbb4817cd9d1cd1b0e237de9a50 (patch)
treef801855466786da0e0100752e4aadd8caa619c07 /tests
parentb3310c222104d9234970c684d2b88b13038db7f0 (diff)
Fix for out-of-bounds intersection (found by fuzzer).
Sometimes, the intersection returned by check_intersection() is out-of-bounds for both edges (above both tops or below both bottoms) due to floating-point inaccuracy. This causes split_edge() to create a tiny negative-length edge on one side (which would then assert). Although we could safely remove this assert and allow the negative length edge to be removed, it's faster/safer to simply avoid its creation in the first place by adjusting one edge to the other edge's endpoint. Added a new unit test to exercise this case. Review URL: https://codereview.chromium.org/968993002
Diffstat (limited to 'tests')
-rw-r--r--tests/TessellatingPathRendererTests.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/TessellatingPathRendererTests.cpp b/tests/TessellatingPathRendererTests.cpp
index 1625bf200d..0635e7f354 100644
--- a/tests/TessellatingPathRendererTests.cpp
+++ b/tests/TessellatingPathRendererTests.cpp
@@ -220,6 +220,16 @@ static SkPath create_path_14() {
return path;
}
+static SkPath create_path_15() {
+ SkPath path;
+ path.moveTo( 0.0f, 0.0f);
+ path.lineTo(10000.0f, 0.0f);
+ path.lineTo( 0.0f, -1.0f);
+ path.lineTo(10000.0f, 0.000001f);
+ path.lineTo( 0.0f, -30.0f);
+ return path;
+}
+
static void test_path(GrDrawTarget* dt, GrRenderTarget* rt, const SkPath& path) {
GrTessellatingPathRenderer tess;
GrPipelineBuilder pipelineBuilder;
@@ -259,5 +269,6 @@ DEF_GPUTEST(TessellatingPathRendererTests, reporter, factory) {
test_path(dt, rt, create_path_12());
test_path(dt, rt, create_path_13());
test_path(dt, rt, create_path_14());
+ test_path(dt, rt, create_path_15());
}
#endif