aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/PathTest.cpp
diff options
context:
space:
mode:
authorGravatar Cary Clark <caryclark@skia.org>2017-08-25 08:04:43 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-08-25 14:40:47 +0000
commitc8323aa51ab27259076532ba081d2ed5c26aedfc (patch)
tree4f04e12142cd870b4d0ee165060c53ab3d5bf4a5 /tests/PathTest.cpp
parent5563d8da7dbbb36d00298d97448e8de1e68ca916 (diff)
tiny concave path point fix
The tiny path added to PathTest.cpp has tinier cross products (e.g. 1e-12) so appears to be a series of unbending lines as far as getConvexity is concerned. This point fix looks for paths that do not bend left or right or go backwards, but do have a bounds, and calls them concave. A better fix may be to consider empty and degenerate paths to be concave instead of convex; I don't know if anyone relies on the existing behavior. Another better fix may be to change the math to compute the path turns even though the numbers are very small; on the surface, very difficult. R=bsalomon@google.com,reed@google.com Bug:755839 Change-Id: Ie2280f3f0b95fecab2899f5fc579fd39258e0647 Reviewed-on: https://skia-review.googlesource.com/38720 Reviewed-by: Brian Salomon <bsalomon@google.com> Commit-Queue: Cary Clark <caryclark@google.com>
Diffstat (limited to 'tests/PathTest.cpp')
-rw-r--r--tests/PathTest.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/PathTest.cpp b/tests/PathTest.cpp
index 6e1cf011c4..7c9c0076c0 100644
--- a/tests/PathTest.cpp
+++ b/tests/PathTest.cpp
@@ -1681,6 +1681,16 @@ static void test_convexity(skiatest::Reporter* reporter) {
: SkPath::kUnknown_Convexity);
}
+ path.reset();
+ path.moveTo(SkBits2Float(0xbe9171db), SkBits2Float(0xbd7eeb5d)); // -0.284072f, -0.0622362f
+ path.lineTo(SkBits2Float(0xbe9171db), SkBits2Float(0xbd7eea38)); // -0.284072f, -0.0622351f
+ path.lineTo(SkBits2Float(0xbe9171a0), SkBits2Float(0xbd7ee5a7)); // -0.28407f, -0.0622307f
+ path.lineTo(SkBits2Float(0xbe917147), SkBits2Float(0xbd7ed886)); // -0.284067f, -0.0622182f
+ path.lineTo(SkBits2Float(0xbe917378), SkBits2Float(0xbd7ee1a9)); // -0.284084f, -0.0622269f
+ path.lineTo(SkBits2Float(0xbe9171db), SkBits2Float(0xbd7eeb5d)); // -0.284072f, -0.0622362f
+ path.close();
+ check_convexity(reporter, path, SkPath::kConcave_Convexity);
+
}
static void test_isLine(skiatest::Reporter* reporter) {