aboutsummaryrefslogtreecommitdiffhomepage
path: root/gm
diff options
context:
space:
mode:
authorGravatar Stephen White <senorblanco@chromium.org>2018-06-01 09:49:39 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-06-01 14:40:55 +0000
commit531a48ed788c5fabfe21704286b54d7567f35469 (patch)
tree09254be109cfe4eb09457cc06093630202303346 /gm
parent39ccf5d386ae07d4fdfaac6c6e89c325efb61255 (diff)
GrTessellator: fix winding merged to zero on split edge.
Occasionally, the top edge of a split edge can be merged out of existence (if it can't be mathematically distinguished from one of its adjacent edges). In this case, we need to save its winding count before it's merged so that the other half of the split doesn't also get zero winding. NOTE: this adds a new test case to the concavepaths GM. Bug: skia:7785 Change-Id: Iff8b0a2ed3065e57b737ff915ff436146987caf6 Reviewed-on: https://skia-review.googlesource.com/131223 Reviewed-by: Robert Phillips <robertphillips@google.com> Commit-Queue: Stephen White <senorblanco@chromium.org>
Diffstat (limited to 'gm')
-rw-r--r--gm/concavepaths.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/gm/concavepaths.cpp b/gm/concavepaths.cpp
index fe8a1418ab..50c1abfebb 100644
--- a/gm/concavepaths.cpp
+++ b/gm/concavepaths.cpp
@@ -234,6 +234,24 @@ void test_partners(SkCanvas* canvas, const SkPaint& paint) {
canvas->restore();
}
+// A split edge causes one half to be merged to zero winding (destroyed).
+// Test that the other half of the split doesn't also get zero winding.
+void test_winding_merged_to_zero(SkCanvas* canvas, const SkPaint& paint) {
+ SkPath path;
+ canvas->save();
+ canvas->translate(400, 350);
+ path.moveTo(20, 80);
+ path.moveTo(70, -0.000001f);
+ path.lineTo(70, 0.0);
+ path.lineTo(60, -30.0);
+ path.lineTo(40, 20.0);
+ path.moveTo(50, 50.0);
+ path.lineTo(50, -50.0);
+ path.lineTo(10, 50.0);
+ canvas->drawPath(path, paint);
+ canvas->restore();
+}
+
// Monotone test 1 (point in the middle)
void test_monotone_1(SkCanvas* canvas, const SkPaint& paint) {
SkPath path;
@@ -429,6 +447,7 @@ DEF_SIMPLE_GM(concavepaths, canvas, 500, 600) {
test_stairstep2(canvas, paint);
test_overlapping(canvas, paint);
test_partners(canvas, paint);
+ test_winding_merged_to_zero(canvas, paint);
test_monotone_1(canvas, paint);
test_monotone_2(canvas, paint);
test_monotone_3(canvas, paint);