Skip to content

Commit

Permalink
[xlib] Check integer translation for XCopyArea.
Browse files Browse the repository at this point in the history
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 5b97ee6 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).
  • Loading branch information
Chris Wilson committed Oct 7, 2008
1 parent 308485a commit 552cc09
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/cairo-xlib-surface.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 552cc09

Please sign in to comment.