History log of /external/skia/gm/thinconcavepaths.cpp
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
92eba8a5efc0860d4e95ba7f25052474a0bfca0c 06-Feb-2017 Stephen White <senorblanco@chromium.org> GrTessellator (AA): improve antialiasing of thin shapes.

(Long description, but actually quite a small change.)

This is the first change inspired by the "straight skeleton" algorithm.
This algorithm gives us a mental model to describe the edge-antialiasing
problem: consider the shape as walls of a house, the outer alpha
geometry is a 45-degree "roof" up to a flat top at a height of 1.0
(the filled interior). The faces of the sloping roof join at the
bisectors between the inner and outer points.

When the shape being drawn is sufficiently thin, there should be no flat
roof, and the sloping roof meets at an edge (the straight skeleton).

This patch detects cases where an edge inverts on stroking, which
indicates that the flat roof has turned inside out, and should be
reduced to a point instead. The model above describes what to do:
follow down the "roof" along the bisectors to their intersection.
This is the point to which an inverted edge should be collapsed.
Fortunately, the bisector edges are easy to compute: they're the
connector edges joining inner and outer points. Linearly interpolating
the distance from the top to the bottom point gives the alpha we
should use to approximate coverage.

Now that we are correctly handling inversions, bevelling outer edges
is no longer necesary, since pointy outer edges won't cause nasty
opaque artifacts.

A couple of other quality improvements: on intersection, always lerp
the alpha of connector edge, even if the opposite edge is an inner edge
(later, when these edges are collapsed, we need this value to compute
the correct alpha). Fix the case where an intruding outer vertex
intersects exactly with an inner edge by maxing its alpha with the
computed value in check_for_intersection(). Finally, we also no longer
round off the intersections produced by Line::intersect(), since it
introduces a loss of quality with no measurable performance benefit.

Change-Id: I6fd93df3a57fffc0895e8cb68adbdba626ded0f1
Reviewed-on: https://skia-review.googlesource.com/8028
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Stephan White <senorblanco@chromium.org>
/external/skia/gm/thinconcavepaths.cpp
86cc841e23a81af69269de87224c57be274f40d1 27-Jan-2017 Stephen White <senorblanco@chromium.org> AA GrTessellator: fix bevelling of acute angles.

The code to handle acute outer angles in generated geometry was pretty
broken: it did a simple runnning average of consecutive acute vertices,
and didn't handle acute angles between the last and first edges.
Replaced it with something simpler that does proper bevelling for
angles less than 2.5 degrees.

This revealed a bug with thin path segments, exposed by the thinconcavepaths
test. This will be fixed by upcoming changes, but I've also dded a few more
test cases to make it clearer.

Change-Id: I23a628ab2e16acaab798c746a5fd87842cacbfab
Reviewed-on: https://skia-review.googlesource.com/7660
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Stephan White <senorblanco@chromium.org>
/external/skia/gm/thinconcavepaths.cpp
eaf0079d81beac9fea2da7a20c3587ebbbbe6463 16-Jan-2017 Stephen White <senorblanco@chromium.org> GrTessellator: fix for disappearing thin path.

simplify_boundary() was incorrectly comparing squared distances
against a non-squared constant. For .25 of a pixel, we need to
compare against 0.25 squared, or 0.0625.

This also includes a fix to get_edge_normal(), We were actually
returning edge "vectors", instead of edge normals. This wasn't
causing problems, since the error cancels itself out, but it's
confusing.

BUG=skia:

Change-Id: I0d50f2d001ed5e41de2900139c396b9ef75d2ddf
Reviewed-on: https://skia-review.googlesource.com/7043
Commit-Queue: Stephan White <senorblanco@chromium.org>
Reviewed-by: Brian Salomon <bsalomon@google.com>
/external/skia/gm/thinconcavepaths.cpp
930f69eef346b0ad4164752a074f3a45c6f46770 12-Jan-2017 Stephen White <senorblanco@chromium.org> Switch a bunch of tests to use DEF_SIMPLE_GM.

Should be no user- or test-visible changes.

BUG=skia:

Change-Id: I6499dc978a41fee344b847c118f84227271561c5
Reviewed-on: https://skia-review.googlesource.com/6906
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Stephan White <senorblanco@chromium.org>
/external/skia/gm/thinconcavepaths.cpp
e7a364d435843a868dcac2c61d78c34e5d3e326c 11-Jan-2017 Stephen White <senorblanco@chromium.org> GrTessellator: fix artifact with exactly-1-px-wide edges.

When path features are exactly a pixel wide, the extruded inner edges
can become collinear and then be removed, since their winding is
zero. We need these edges to be preserved through triangulation,
otherwise opaque portions of the geometry can become transparent.

Since the simplify() pass can handle zero-winding edges just fine, the
the fix is to simply not remove them.

In addition, this changes refactors out disconnect() from all the calls
to remove_edge_above()/remove_edge_below(). It also renames the remaining
function erase_edge() (since it's now unconditional).

Add a new test to a new "thinconcavepaths" GM.

BUG=680260
NOTRY=true

Change-Id: I1d3a436c95a01c4d4ef5dc05503de4312677f65d
Reviewed-on: https://skia-review.googlesource.com/6902
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Stephan White <senorblanco@chromium.org>
/external/skia/gm/thinconcavepaths.cpp