mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2025-12-20 23:20:10 +01:00
pen: First check whether the in/out edges lie within the single pen vertex
In order to prevent underflow when searching for the closing pen vertex, we first need to be sure that it does not simply lie next to the opening pen vertex. As a result we were missing many cases that should have been a bevel (in == out) and generating almost complete round caps instead. Reported-by: Dominik Röttsches <dominik.rottsches@intel.com> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=56432 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
parent
66625cb46c
commit
d7f5a1bec4
4 changed files with 32 additions and 28 deletions
|
|
@ -412,21 +412,23 @@ _cairo_pen_find_active_cw_vertices (const cairo_pen_t *pen,
|
|||
i = 0;
|
||||
*start = i;
|
||||
|
||||
lo = i;
|
||||
hi = i + pen->num_vertices;
|
||||
i = (lo + hi) >> 1;
|
||||
do {
|
||||
int j = i;
|
||||
if (j >= pen->num_vertices)
|
||||
j -= pen->num_vertices;
|
||||
if (_cairo_slope_compare (&pen->vertices[j].slope_cw, out) > 0)
|
||||
hi = i;
|
||||
else
|
||||
lo = i;
|
||||
if (_cairo_slope_compare (out, &pen->vertices[i].slope_ccw) > 0) {
|
||||
lo = i;
|
||||
hi = i + pen->num_vertices;
|
||||
i = (lo + hi) >> 1;
|
||||
} while (hi - lo > 1);
|
||||
if (i >= pen->num_vertices)
|
||||
i -= pen->num_vertices;
|
||||
do {
|
||||
int j = i;
|
||||
if (j >= pen->num_vertices)
|
||||
j -= pen->num_vertices;
|
||||
if (_cairo_slope_compare (&pen->vertices[j].slope_cw, out) > 0)
|
||||
hi = i;
|
||||
else
|
||||
lo = i;
|
||||
i = (lo + hi) >> 1;
|
||||
} while (hi - lo > 1);
|
||||
if (i >= pen->num_vertices)
|
||||
i -= pen->num_vertices;
|
||||
}
|
||||
*stop = i;
|
||||
}
|
||||
|
||||
|
|
@ -452,20 +454,22 @@ _cairo_pen_find_active_ccw_vertices (const cairo_pen_t *pen,
|
|||
i = 0;
|
||||
*start = i;
|
||||
|
||||
lo = i;
|
||||
hi = i + pen->num_vertices;
|
||||
i = (lo + hi) >> 1;
|
||||
do {
|
||||
int j = i;
|
||||
if (j >= pen->num_vertices)
|
||||
j -= pen->num_vertices;
|
||||
if (_cairo_slope_compare (out, &pen->vertices[j].slope_ccw) > 0)
|
||||
hi = i;
|
||||
else
|
||||
lo = i;
|
||||
if (_cairo_slope_compare (&pen->vertices[i].slope_cw, out) < 0) {
|
||||
lo = i;
|
||||
hi = i + pen->num_vertices;
|
||||
i = (lo + hi) >> 1;
|
||||
} while (hi - lo > 1);
|
||||
if (i >= pen->num_vertices)
|
||||
i -= pen->num_vertices;
|
||||
do {
|
||||
int j = i;
|
||||
if (j >= pen->num_vertices)
|
||||
j -= pen->num_vertices;
|
||||
if (_cairo_slope_compare (out, &pen->vertices[j].slope_ccw) > 0)
|
||||
hi = i;
|
||||
else
|
||||
lo = i;
|
||||
i = (lo + hi) >> 1;
|
||||
} while (hi - lo > 1);
|
||||
if (i >= pen->num_vertices)
|
||||
i -= pen->num_vertices;
|
||||
}
|
||||
*stop = i;
|
||||
}
|
||||
|
|
|
|||
Binary file not shown.
|
Before Width: | Height: | Size: 502 B After Width: | Height: | Size: 464 B |
Binary file not shown.
|
Before Width: | Height: | Size: 54 KiB After Width: | Height: | Size: 53 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 5 KiB After Width: | Height: | Size: 5 KiB |
Loading…
Add table
Reference in a new issue