skia2/gm/crbug_887103.cpp
Stephen White cfe1264d74 GrTessellator: two fixes for boundary simplification artifacts.
The "pointy vertex" test was only considering the distance from the
next (outgoing) edge to the previous point. It must also consider the
distance from the previous (incoming) edge to the next point. If
either are less than a quarter pixel, the vertex is considered pointy
and should be removed. (884166)

Also (887103), when an interior region was completely removed due to
boundary simplification, it would leave a degenerate edge consisting
of the same vertex. So avoid introducing a join edge when prev == next.

Bug: 884166, 887103
Change-Id: I7f1d5b98e418d8f2a1c11643259d3cd74d08f286
Reviewed-on: https://skia-review.googlesource.com/157220
Commit-Queue: Stephen White <senorblanco@chromium.org>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2018-09-26 23:57:59 +00:00

32 lines
644 B
C++

/*
* Copyright 2018 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "gm.h"
#include "SkCanvas.h"
#include "SkPath.h"
DEF_SIMPLE_GM(crbug_887103, canvas, 520, 520) {
SkPaint paint;
paint.setAntiAlias(true);
paint.setStyle(SkPaint::kFill_Style);
SkPath path;
path.moveTo(510, 20);
path.lineTo(500, 20);
path.lineTo(510, 500);
path.moveTo(500, 20);
path.lineTo(510, 500);
path.lineTo(500, 510);
path.moveTo(500, 30);
path.lineTo(510, 10);
path.lineTo( 10, 30);
canvas->drawPath(path, paint);
}