[cairo-commit] Branch '1.8' - src/cairo-win32-surface.c

Jeff Muizelaar jrmuizel at kemper.freedesktop.org
Mon Dec 8 11:21:30 PST 2008


 src/cairo-win32-surface.c |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

New commits:
commit 673640a3b3931995897b01d49c5dd8d82b50dac2
Author: Jeff Muizelaar <jmuizelaar at mozilla.com>
Date:   Thu Dec 4 17:53:06 2008 -0500

    [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

diff --git a/src/cairo-win32-surface.c b/src/cairo-win32-surface.c
index 5787e26..4327621 100644
--- a/src/cairo-win32-surface.c
+++ b/src/cairo-win32-surface.c
@@ -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;


More information about the cairo-commit mailing list