mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-05-02 23:38:13 +02:00
[gstate] Change dash offset normalisation to preserve offsets in range.
We have a test case get-and-set which wants to see whatever it puts into a cairo_t come back out again, but at the same time cairo-gstate wants to range reduce the dash offset it's given to a sane range. This patch changes the range reduction algorithm to always normalize to a non-negative dash offset and not touch dash offsets which are already in range.
This commit is contained in:
parent
b394240941
commit
e09b754fdd
1 changed files with 6 additions and 1 deletions
|
|
@ -547,7 +547,12 @@ _cairo_gstate_set_dash (cairo_gstate_t *gstate, const double *dash, int num_dash
|
|||
/* The dashing code doesn't like a negative offset or a big positive
|
||||
* offset, so we compute an equivalent offset which is guaranteed to be
|
||||
* positive and less than twice the pattern length. */
|
||||
gstate->stroke_style.dash_offset = fmod (offset, dash_total) + dash_total;
|
||||
offset = fmod (offset, dash_total);
|
||||
if (offset < 0.0)
|
||||
offset += dash_total;
|
||||
if (offset <= 0.0) /* Take care of -0 */
|
||||
offset = 0.0;
|
||||
gstate->stroke_style.dash_offset = offset;
|
||||
|
||||
return CAIRO_STATUS_SUCCESS;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue