[cairo-commit] src/cairo-xcb-surface-render.c

Andrea Canciani ranma42 at kemper.freedesktop.org
Sat Nov 6 09:33:34 PDT 2010


 src/cairo-xcb-surface-render.c |   24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

New commits:
commit f1d1928d13f4f83cc37d68ab4773f7c796d08c6e
Author: Uli Schlachter <psychon at znc.in>
Date:   Thu Oct 21 13:38:30 2010 +0200

    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 <psychon at znc.in>

diff --git a/src/cairo-xcb-surface-render.c b/src/cairo-xcb-surface-render.c
index 404b7d3..83689e5 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;


More information about the cairo-commit mailing list