From f1d1928d13f4f83cc37d68ab4773f7c796d08c6e Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Thu, 21 Oct 2010 13:38:30 +0200 Subject: [PATCH] xcb: Fix transformation matrix setting _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 --- src/cairo-xcb-surface-render.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/cairo-xcb-surface-render.c b/src/cairo-xcb-surface-render.c index 404b7d373..83689e59d 100644 --- a/src/cairo-xcb-surface-render.c +++ b/src/cairo-xcb-surface-render.c @@ -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; @@ -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; @@ -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;