From 552cc09e6be2b704dc32f986c84640d50316c25c Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Tue, 7 Oct 2008 21:05:57 +0100 Subject: [PATCH] [xlib] Check integer translation for XCopyArea. A precondition for using the core XCopyArea protocol is that the source attributes contain only integer translations. However, we failed to apply any integer translations from the source matrix to the XCopyArea offsets. This worked prior to 5b97ee6525 as _cairo_pattern_acquire_surface_for_surface() was careful to only generate an identity matrix if the pattern matrix only contained an integer translation (and thus we would use XCopyArea in the xlib backend). --- src/cairo-xlib-surface.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/cairo-xlib-surface.c b/src/cairo-xlib-surface.c index 0b01762c7..4f526c110 100644 --- a/src/cairo-xlib-surface.c +++ b/src/cairo-xlib-surface.c @@ -1741,12 +1741,18 @@ _cairo_xlib_surface_composite (cairo_operator_t op, status = _cairo_xlib_surface_ensure_gc (dst); if (status) goto BAIL; + + is_integer_translation = _cairo_matrix_is_integer_translation (&src_attr.matrix, + &itx, &ity); + /* This is a pre-condition for DO_XCOPYAREA. */ + assert (is_integer_translation); + XCopyArea (dst->dpy, src->drawable, dst->drawable, dst->gc, - src_x + src_attr.x_offset, - src_y + src_attr.y_offset, + src_x + src_attr.x_offset + itx, + src_y + src_attr.y_offset + ity, width, height, dst_x, dst_y); break;