aboutsummaryrefslogtreecommitdiffhomepage
path: root/gm/concavepaths.cpp
diff options
context:
space:
mode:
authorGravatar Stephen White <senorblanco@chromium.org>2017-02-13 13:55:42 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-02-13 21:18:10 +0000
commit5926f2da752d1bff0051fda4137bb967f9e91d5f (patch)
treee4f52219709e2c960729030c2e9a236037c5e124 /gm/concavepaths.cpp
parent1e06d3d7b92ce35f9f81f7085ada5d1017f0e830 (diff)
GrTessellator (AA): fix "Canvas Arcs" coverage artifact.
When sanitizing contours, if the first and last vertices coincide, continue with the previous vertex, not the next vertex, since we may otherwise exit prematurely. Also, round the last vertex before entering the loop, just in case it coincides with the first. Add a test case to exercise the above, and another one which exercises the intruding-vertex workaround. BUG=691593 Change-Id: Ic28a9308a21164d185edef0ee6fbc29b40742149 Reviewed-on: https://skia-review.googlesource.com/8364 Reviewed-by: Brian Salomon <bsalomon@google.com> Commit-Queue: Stephen White <senorblanco@chromium.org>
Diffstat (limited to 'gm/concavepaths.cpp')
-rw-r--r--gm/concavepaths.cpp38
1 files changed, 37 insertions, 1 deletions
diff --git a/gm/concavepaths.cpp b/gm/concavepaths.cpp
index c371615f2f..890f6c0855 100644
--- a/gm/concavepaths.cpp
+++ b/gm/concavepaths.cpp
@@ -62,6 +62,40 @@ void test_fake_bowtie(SkCanvas* canvas, const SkPaint& paint) {
canvas->restore();
}
+// Bowtie with a smaller right hand lobe. The outer vertex of the left hand
+// lobe intrudes into the interior of the right hand lobe.
+void test_intruding_vertex(SkCanvas* canvas, const SkPaint& paint) {
+ SkPath path;
+ canvas->save();
+ canvas->translate(400, 0);
+ path.setIsVolatile(true);
+ path.moveTo(20, 20);
+ path.lineTo(50, 50);
+ path.lineTo(68, 20);
+ path.lineTo(68, 80);
+ path.lineTo(50, 50);
+ path.lineTo(20, 80);
+ canvas->drawPath(path, paint);
+ canvas->restore();
+}
+
+// A shape with an edge that becomes inverted on AA stroking and that also contains
+// a repeated start/end vertex.
+void test_inversion_repeat_vertex(SkCanvas* canvas, const SkPaint& paint) {
+ SkPath path;
+ canvas->save();
+ canvas->translate(400, 100);
+ path.setIsVolatile(true);
+ path.moveTo(80, 50);
+ path.lineTo(40, 80);
+ path.lineTo(60, 20);
+ path.lineTo(20, 20);
+ path.lineTo(39.99f, 80);
+ path.lineTo(80, 50);
+ canvas->drawPath(path, paint);
+ canvas->restore();
+}
+
// Fish test (intersection/concave)
void test_fish(SkCanvas* canvas, const SkPaint& paint) {
SkPath path;
@@ -360,7 +394,7 @@ void test_coincident_edges_4(SkCanvas* canvas, const SkPaint& paint) {
};
-DEF_SIMPLE_GM(concavepaths, canvas, 400, 600) {
+DEF_SIMPLE_GM(concavepaths, canvas, 500, 600) {
SkPaint paint;
paint.setAntiAlias(true);
@@ -370,10 +404,12 @@ DEF_SIMPLE_GM(concavepaths, canvas, 400, 600) {
test_reverse_concave(canvas, paint);
test_bowtie(canvas, paint);
test_fake_bowtie(canvas, paint);
+ test_intruding_vertex(canvas, paint);
test_fish(canvas, paint);
test_fast_forward(canvas, paint);
test_hole(canvas, paint);
test_star(canvas, paint);
+ test_inversion_repeat_vertex(canvas, paint);
test_stairstep(canvas, paint);
test_stairstep2(canvas, paint);
test_overlapping(canvas, paint);