mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-05-05 11:08:12 +02:00
[win32] Use MOD instead of the '%' operator
Repeat should be handled using MOD instead of '%' so that negative numbers are handled as expected. E.g. -1 mod 600 = 599, not 495 as the '%' operator gives. This was causing https://bugzilla.mozilla.org/show_bug.cgi?id=466258 Patch from Robert O'Callahan
This commit is contained in:
parent
540de34453
commit
673640a3b3
1 changed files with 5 additions and 2 deletions
|
|
@ -872,6 +872,9 @@ _cairo_win32_surface_composite_inner (cairo_win32_surface_t *src,
|
|||
return CAIRO_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
/* from pixman-private.h */
|
||||
#define MOD(a,b) ((a) < 0 ? ((b) - ((-(a) - 1) % (b))) - 1 : (a) % (b))
|
||||
|
||||
static cairo_int_status_t
|
||||
_cairo_win32_surface_composite (cairo_operator_t op,
|
||||
cairo_pattern_t *pattern,
|
||||
|
|
@ -1153,8 +1156,8 @@ _cairo_win32_surface_composite (cairo_operator_t op,
|
|||
uint32_t rendered_width = 0, rendered_height = 0;
|
||||
uint32_t to_render_height, to_render_width;
|
||||
int32_t piece_x, piece_y;
|
||||
int32_t src_start_x = src_r.x % src_extents.width;
|
||||
int32_t src_start_y = src_r.y % src_extents.height;
|
||||
int32_t src_start_x = MOD(src_r.x, src_extents.width);
|
||||
int32_t src_start_y = MOD(src_r.y, src_extents.height);
|
||||
|
||||
if (needs_scale)
|
||||
goto UNSUPPORTED;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue