Go to file
Michael Ludwig 6c8e2e832e Fix winding when splitting edges at out-of-bounds vertices
Add GM repros and up triangulation verb count to match chromium's define
The GMs draw incorrectly in (base->p2) with the updated verb count, but
would draw fine w/o the increased verb count because a different path
renderer would be chosen.

This fixes a latent bug that was in the edge splitting code of the
triangulator that was exposed by https://skia-review.googlesource.com/c/skia/+/432196
Before that CL, intersections of two lines would be clamped to one of the
4 vertices of the 2 segments. In the CL linked, the clamping was adjusted
to clamp X and Y axes separately, so it increased the chance that a
clamped intersection would have its X or Y coord equal to line's vertex
but differ along the other coord (when they both equaled, they were
considered coincident and splitting that edge did nothing).

Splitting an edge at its intersection was intended to split (p0 to p1)
into new lines (p0 to v) and (v to p1) where p0 < v < p1 according to the
vertical or horizontal sorting that was imposed on the mesh. For a given
line segment and a clamped vertex, there are 8 ways the intersection
could be clamped (4 edges and 4 corners). If the edge has a positive
non-zero slope, a zero slope, or an infinite slope, in all cases the
clamped intersection will be sorted correctly and satisfy p0 < v < p1.

However, if the edge has negative slope
  vertical: p0.y<p1.y and p0.x>p1.x,
  horizontal: p0.x<p1.x and p0.y<p1.y
then intersections snapped to the primary sorting axis will be out of
order and produce a split such that v < p0 < p1 or p0 < p1 < v. This
was already detected, but it didn't update the winding of the new edge
to preserve the original winding from p0 to p1.

In these out-of-order cases, the intersection point is the top of both
the new and old edge, or the bottom of both the new and old edge. This
means that winding "top to bottom" on the new edge would go in the
opposite direction as the original winding from p0 to p1. Flipping the
winding on the new edge preserves the intended winding of the contour
while still allowing the edges/vertices to be sorted consistently.

This showed up as large gradients in the AA triangulator because w/o the
winding adjustment, the winding flip at the new edge would confuse the
border extractor that was used to compute insets and outsets for the 1px
coverage ramp. It would then use edges that were normally unrelated to
each and declare their line intersections as the "interior" with full
coverage. Obviously these could be anywhere so the 1px coverage ramp
would get smeared across that shape.

Bug: chromium:1257515
Change-Id: I015d6b4767db352e3eecfc53047958e74320268d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/458057
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2021-10-11 23:49:37 +00:00
animations first cut at a checkbox 2009-10-21 19:41:10 +00:00
bazel bazel baby steps 2020-09-14 15:18:32 +00:00
bench Make class members that are static constexpr also be inline. 2021-10-11 16:22:59 +00:00
bin [sk] Update asset download references to use SK 2021-09-17 16:55:53 +00:00
build/fuchsia [fuchsia] Fix fidlc command. 2020-06-10 03:29:24 +00:00
build_overrides Add Abseil dependency for Dawn 2021-09-22 22:05:32 +00:00
client_utils/android Make class members that are static constexpr also be inline. 2021-10-11 16:22:59 +00:00
demos.skia.org [demos] Add WebGPU demo using origin trial 2021-10-08 16:35:34 +00:00
dm Fix G3 build 2021-10-11 21:26:37 +00:00
docker [infra] Update cmake docker image to be Debian 10 2021-07-23 11:21:31 +00:00
docs/examples Reland "Add sRGB 8888 colortype" 2021-08-24 12:56:32 +00:00
example Remove SDL from DEPS (and SDL example that used it) 2021-05-27 21:37:57 +00:00
experimental Make class members that are static constexpr also be inline. 2021-10-11 16:22:59 +00:00
fuzz Add support for function prototypes in Pipeline stage. 2021-09-30 20:02:19 +00:00
gm Fix winding when splitting edges at out-of-bounds vertices 2021-10-11 23:49:37 +00:00
gn Fix winding when splitting edges at out-of-bounds vertices 2021-10-11 23:49:37 +00:00
include Add convenient "xyzw" accessors and swizzles to skvx (take 2) 2021-10-11 18:59:47 +00:00
infra Update SKP version 2021-10-10 08:25:53 +00:00
modules Make class members that are static constexpr also be inline. 2021-10-11 16:22:59 +00:00
platform_tools [JetSki] bind drawGlyphs to JetSki for Text rendering 2021-09-22 19:38:13 +00:00
resources Fix ES2 conformance test 'in_vs_no_in'. 2021-10-11 22:27:37 +00:00
samplecode Make class members that are static constexpr also be inline. 2021-10-11 16:22:59 +00:00
site Update instructions for running debugger locally 2021-10-11 21:45:31 +00:00
specs [infra] Port serve.py from Python2 to 3 2021-08-31 15:28:19 +00:00
src Fix winding when splitting edges at out-of-bounds vertices 2021-10-11 23:49:37 +00:00
tests Fix ES2 conformance test 'in_vs_no_in'. 2021-10-11 22:27:37 +00:00
third_party Roll skcms from b5aafce0db45 to 0d5496480324 (1 revision) 2021-10-06 21:51:25 +00:00
tools Make class members that are static constexpr also be inline. 2021-10-11 16:22:59 +00:00
.bazelignore bazel baby steps 2020-09-14 15:18:32 +00:00
.clang-format no more bin packing in .clang-format 2021-03-04 17:22:50 +00:00
.clang-tidy Disable ClangTidy namespace comments for short blocks. 2020-08-24 14:01:22 +00:00
.gitignore add mskps/ to .gitignore 2021-07-06 21:04:55 +00:00
.gn Pre-emptive fix for upcoming ANGLE change. 2021-01-08 17:23:52 +00:00
AUTHORS Add trusted service accounts to AUTHORS file 2021-09-29 20:18:40 +00:00
BUILD.bazel bazel baby steps 2020-09-14 15:18:32 +00:00
BUILD.gn [graphite] Set up unit testing system 2021-10-11 16:18:05 +00:00
codereview.settings Make uploading to Gerrit the default for Skia 2016-11-09 19:07:56 +00:00
CONTRIBUTING Fix references to https://sites.google.com/site/skiadocs/. 2015-02-03 13:12:54 -02:00
CQ_COMMITTERS Moved committer list to chrome-infra-auth and deleted it from the repo 2015-09-02 13:37:54 -07:00
DEPS Roll ANGLE from 57dd7095ffd4 to e2d9121725bf (28 revisions) 2021-10-11 05:28:22 +00:00
DIR_METADATA Move metadata in OWNERS files to DIR_METADATA files 2021-02-02 23:41:54 +00:00
go.mod [infra] Roll infra to update vpython 2021-09-10 17:41:28 +00:00
go.sum [infra] Roll infra to update vpython 2021-09-10 17:41:28 +00:00
LICENSE LICENSE file: clean up 2019-11-22 21:59:03 +00:00
OWNERS [infra] Add wildcard OWNERS 2021-08-30 19:19:34 +00:00
PRESUBMIT.py Remove AUTHORS check from PRESUBMIT.py 2021-09-30 14:12:18 +00:00
public.bzl Separate SkUnicode bazel source sets 2021-08-09 18:23:15 +00:00
README Fix references to https://sites.google.com/site/skiadocs/. 2015-02-03 13:12:54 -02:00
README.chromium Update README.chromium. 2015-06-11 13:19:24 -07:00
RELEASE_NOTES.txt Add release note for SkRuntimeEffect change in Milestone 96. 2021-10-08 13:55:15 +00:00
whitespace.txt Test SkCQ 2021-07-24 21:07:28 +00:00
WORKSPACE.bazel bazel baby steps 2020-09-14 15:18:32 +00:00

Skia is a complete 2D graphic library for drawing Text, Geometries, and Images.

See full details, and build instructions, at https://skia.org.