Skip to content

Commit

Permalink
xcb: Fix transformation matrix setting
Browse files Browse the repository at this point in the history
_cairo_xcb_picture_set_matrix() checked if the matrix that it should
set is an identity matrix. In this case this function simply didn't do
anything at all.  The assumption here seems to be that a picture's
matrix is the identity matrix by default.

The problem here is that we might first set a picture's matrix to
something else and then later need an identity transform again. Fix
this by still setting the new matrix if it is an identify matrix. We
just skip some unneeded checks and optimizations in this case.

This fixes the "finer-grained-fallbacks" test in the test suite.

Signed-off-by: Uli Schlachter <psychon@znc.in>
  • Loading branch information
Uli Schlachter authored and Andrea Canciani committed Nov 6, 2010
1 parent d51ab09 commit f1d1928
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions src/cairo-xcb-surface-render.c
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,7 @@ _cairo_xcb_picture_set_matrix (cairo_xcb_picture_t *picture,
cairo_filter_t filter,
double xc, double yc)
{
xcb_render_transform_t transform;
cairo_matrix_t m;
double tx, ty;

Expand All @@ -472,7 +473,6 @@ _cairo_xcb_picture_set_matrix (cairo_xcb_picture_t *picture,
tx = ty = 0;

if (! _cairo_matrix_is_identity (&m)) {
xcb_render_transform_t transform;
cairo_matrix_t inv;
cairo_status_t status;

Expand All @@ -496,20 +496,20 @@ _cairo_xcb_picture_set_matrix (cairo_xcb_picture_t *picture,
if (tx != 0. || ty != 0.)
cairo_matrix_transform_point (&inv, &tx, &ty);
}
}

/* Casting between pixman_transform_t and XTransform is safe because
* they happen to be the exact same type.
*/
_cairo_matrix_to_pixman_matrix (&m,
(pixman_transform_t *) &transform, xc, yc);
/* Casting between pixman_transform_t and xcb_render_transform_t is safe
* because they happen to be the exact same type.
*/
_cairo_matrix_to_pixman_matrix (&m,
(pixman_transform_t *) &transform, xc, yc);

if (memcmp (&picture->transform, &transform, sizeof (xcb_render_transform_t))) {
_cairo_xcb_connection_render_set_picture_transform (_picture_to_connection(picture),
picture->picture,
&transform);
if (memcmp (&picture->transform, &transform, sizeof (xcb_render_transform_t))) {
_cairo_xcb_connection_render_set_picture_transform (_picture_to_connection (picture),
picture->picture,
&transform);

picture->transform = transform;
}
picture->transform = transform;
}

picture->x = picture->x0 + tx;
Expand Down

0 comments on commit f1d1928

Please sign in to comment.