diff options
author | Alban Browaeys <prahal@yahoo.com> | 2015-01-21 12:01:45 +0100 |
---|---|---|
committer | Bryce Harrington <bryce@osg.samsung.com> | 2015-06-18 16:07:40 -0700 |
commit | e7acf4b6dc6666c2a2c54fb08e9ad6f01a1d415f (patch) | |
tree | cb53b4589be0a4c6b959224b459d286ec29daccd /src/cairo-pattern.c | |
parent | b4a922f62d34973ea89495b40ce8bc6378110b9e (diff) | |
download | cairo-e7acf4b6dc6666c2a2c54fb08e9ad6f01a1d415f.tar.gz |
pattern: allow for a floating one pixel rounded difference.
That is if the difference between the origin and the end is bigger than
.5 round up regardless of the coordinates.
Round the difference of the floats instead of rounding the floats then
diff them.
Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=84396
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
Diffstat (limited to 'src/cairo-pattern.c')
-rw-r--r-- | src/cairo-pattern.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/cairo-pattern.c b/src/cairo-pattern.c index ac5d7af20..562724d4e 100644 --- a/src/cairo-pattern.c +++ b/src/cairo-pattern.c @@ -3531,7 +3531,7 @@ _cairo_pattern_get_extents (const cairo_pattern_t *pattern, cairo_rectangle_int_t *extents) { double x1, y1, x2, y2; - int ix1, ix2, iy1, iy2; + double ix1, ix2, iy1, iy2; cairo_bool_t round_x = FALSE; cairo_bool_t round_y = FALSE; @@ -3725,12 +3725,12 @@ _cairo_pattern_get_extents (const cairo_pattern_t *pattern, if (x1 < CAIRO_RECT_INT_MIN) ix1 = CAIRO_RECT_INT_MIN; else - ix1 = _cairo_lround (x1); + ix1 = x1; if (x2 > CAIRO_RECT_INT_MAX) ix2 = CAIRO_RECT_INT_MAX; else - ix2 = _cairo_lround (x2); - extents->x = ix1; extents->width = ix2 - ix1; + ix2 = x2; + extents->x = ix1; extents->width = _cairo_lround(ix2 - ix1); if (!round_y) { y1 -= 0.5; @@ -3744,7 +3744,7 @@ _cairo_pattern_get_extents (const cairo_pattern_t *pattern, iy2 = CAIRO_RECT_INT_MAX; else iy2 = _cairo_lround (y2); - extents->y = iy1; extents->height = iy2 - iy1; + extents->y = iy1; extents->height = _cairo_lround(iy2 - iy1); return; |