Back out a5a5d2c176f7 (bug 882865) because of Android test failures on a CLOSED TREE
[gecko.git] / gfx / cairo / win32-composite-src-mod.patch
blobf2f99940a8ca46f0b5f3003429d561c8332edc60
1 diff --git a/gfx/cairo/cairo/src/cairo-win32-surface.c b/gfx/cairo/cairo/src/cairo-win32-surface.c
2 --- a/gfx/cairo/cairo/src/cairo-win32-surface.c
3 +++ b/gfx/cairo/cairo/src/cairo-win32-surface.c
4 @@ -928,16 +928,19 @@ _cairo_win32_surface_composite_inner (ca
5 return _composite_alpha_blend (dst, src, alpha,
6 src_r.x, src_r.y, src_r.width, src_r.height,
7 dst_r.x, dst_r.y, dst_r.width, dst_r.height);
10 return CAIRO_STATUS_SUCCESS;
13 +/* from pixman-private.h */
14 +#define MOD(a,b) ((a) < 0 ? ((b) - ((-(a) - 1) % (b))) - 1 : (a) % (b))
16 static cairo_int_status_t
17 _cairo_win32_surface_composite (cairo_operator_t op,
18 cairo_pattern_t *pattern,
19 cairo_pattern_t *mask_pattern,
20 void *abstract_dst,
21 int src_x,
22 int src_y,
23 int mask_x,
24 @@ -1209,18 +1212,18 @@ _cairo_win32_surface_composite (cairo_op
25 /* If we need to repeat, we turn the repeated blit into
26 * a bunch of piece-by-piece blits.
28 if (needs_repeat) {
29 cairo_rectangle_int_t piece_src_r, piece_dst_r;
30 uint32_t rendered_width = 0, rendered_height = 0;
31 uint32_t to_render_height, to_render_width;
32 int32_t piece_x, piece_y;
33 - int32_t src_start_x = src_r.x % src_extents.width;
34 - int32_t src_start_y = src_r.y % src_extents.height;
35 + int32_t src_start_x = MOD(src_r.x, src_extents.width);
36 + int32_t src_start_y = MOD(src_r.y, src_extents.height);
38 if (needs_scale)
39 goto UNSUPPORTED;
41 /* If both the src and dest have an image, we may as well fall
42 * back, because it will be faster than our separate blits.
43 * Our blit code will be fastest when the src is a DDB and the
44 * destination is a DDB.