mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2025-12-27 12:50:12 +01:00
Fix _cairo_traps_tessellate_convex_quad to handle a == b
This case was found in an attempt to use the convex_quad function for tessellating triangles as well. Fortunately the fix is very easy.
This commit is contained in:
parent
96d8f58daf
commit
53ae6ea957
1 changed files with 13 additions and 1 deletions
|
|
@ -1,5 +1,6 @@
|
|||
/*
|
||||
* Copyright © 2002 Keith Packard
|
||||
* Copyright © 2007 Red Hat, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it either under the terms of the GNU Lesser General Public
|
||||
|
|
@ -408,7 +409,18 @@ _cairo_traps_tessellate_convex_quad (cairo_traps_t *traps, cairo_point_t q[4])
|
|||
* This should hopefully be made clear in the lame ASCII art
|
||||
* below. Since the same slope comparison is used in all cases, we
|
||||
* compute it before testing for the Y-value sort. */
|
||||
_cairo_slope_init (&ab, &q[a], &q[b]);
|
||||
|
||||
/* Note: If a == b then the ab slope doesn't give us any
|
||||
* information. In that case, we can replace it with the ac (or
|
||||
* equivalenly the bc) slope which gives us exactly the same
|
||||
* information we need. At worst the names of the identifiers ab
|
||||
* and b_left_of_d are inaccurate in this case, (would be ac, and
|
||||
* c_left_of_d). */
|
||||
if (q[a].x == q[b].x && q[a].y == q[b].y)
|
||||
_cairo_slope_init (&ab, &q[a], &q[c]);
|
||||
else
|
||||
_cairo_slope_init (&ab, &q[a], &q[b]);
|
||||
|
||||
_cairo_slope_init (&ad, &q[a], &q[d]);
|
||||
|
||||
b_left_of_d = (_cairo_slope_compare (&ab, &ad) > 0);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue