aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/ClipperTest.cpp
diff options
context:
space:
mode:
authorGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-01-11 16:41:26 +0000
committerGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-01-11 16:41:26 +0000
commit6da3d1757cfee75c25a86b580834dc49d8b53f05 (patch)
treee1036f1579bed35325536db425be62888dbd391b /tests/ClipperTest.cpp
parent15865a710ab11963bb6fdb8e21af5e1dd11630be (diff)
improve clamping logic when handling imprecise chopping of cubics
Diffstat (limited to 'tests/ClipperTest.cpp')
-rw-r--r--tests/ClipperTest.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/ClipperTest.cpp b/tests/ClipperTest.cpp
index 0f5a6156ab..f6333ba645 100644
--- a/tests/ClipperTest.cpp
+++ b/tests/ClipperTest.cpp
@@ -10,6 +10,24 @@
#include "SkLineClipper.h"
#include "SkEdgeClipper.h"
+static void test_edgeclipper(skiatest::Reporter* reporter) {
+ SkEdgeClipper clipper;
+
+ const SkPoint pts[] = {
+ { 3.0995476e+010, 42.929779 },
+ { -3.0995163e+010, 51.050385 },
+ { -3.0995157e+010, 51.050392 },
+ { -3.0995134e+010, 51.050400 },
+ };
+
+ const SkRect clip = { 0, 0, 300, 200 };
+
+ // this should not assert, even though our choppers do a poor numerical
+ // job when computing their t values.
+ // http://code.google.com/p/skia/issues/detail?id=444
+ clipper.clipCubic(pts, clip);
+}
+
static void test_intersectline(skiatest::Reporter* reporter) {
static const SkScalar L = 0;
static const SkScalar T = 0;
@@ -90,6 +108,7 @@ static void test_intersectline(skiatest::Reporter* reporter) {
void TestClipper(skiatest::Reporter* reporter) {
test_intersectline(reporter);
+ test_edgeclipper(reporter);
}
#include "TestClassDef.h"