rendercheck: t_tsrccoords.c

Tilman Sauerbeck tilman at kemper.freedesktop.org
Tue Aug 29 09:20:10 PDT 2006


 t_tsrccoords.c |   21 +++++++++++++++------
 1 files changed, 15 insertions(+), 6 deletions(-)

New commits:
diff-tree de32ec8589b7d292dcf6e92c9f28a62b95aa2dbd (from ad7e07b309216e2eef30cbc718edefb79d8febe5)
Author: Tilman Sauerbeck <tilman at code-monkey.de>
Date:   Tue Aug 29 18:17:39 2006 +0200

    Bug #8062: Set up XTransforms correctly.
    
    Don't store floats directly in the matrix, but pass them through
    XDoubleToFixed(). That the test still passes with xorg-server's software
    implementation.

diff --git a/t_tsrccoords.c b/t_tsrccoords.c
index c302826..63cee4b 100644
--- a/t_tsrccoords.c
+++ b/t_tsrccoords.c
@@ -63,6 +63,15 @@ static void destroy_dot_picture(Display 
 	free(p);
 }
 
+static void init_transform (XTransform *t)
+{
+	int i, j;
+
+	for (i = 0; i < 3; i++)
+		for (j = 0; j < 3; j++)
+			t->matrix[i][j] = XDoubleToFixed((i == j) ? 1 : 0);
+}
+
 /* Test drawing a 5x5 source image scaled 8x, as either a source or mask.
  */
 Bool
@@ -82,9 +91,9 @@ trans_coords_test(Display *dpy, picture_
 		return FALSE;
 	}
 
-	t.matrix[0][0] = 1.0; t.matrix[0][1] = 0.0; t.matrix[0][2] = 0.0;
-	t.matrix[1][0] = 0.0; t.matrix[1][1] = 1.0; t.matrix[1][2] = 0.0;
-	t.matrix[2][0] = 0.0; t.matrix[2][1] = 0.0; t.matrix[2][2] = 8.0;
+	init_transform(&t);
+	t.matrix[2][2] = XDoubleToFixed(8);
+
 	XRenderSetPictureTransform(dpy, src->pict, &t);
 
 	if (!test_mask)
@@ -137,9 +146,9 @@ trans_coords_test(Display *dpy, picture_
 			printf("\n");
 		}
 	}
-	t.matrix[0][0] = 1.0; t.matrix[0][1] = 0.0; t.matrix[0][2] = 0.0;
-	t.matrix[1][0] = 0.0; t.matrix[1][1] = 1.0; t.matrix[1][2] = 0.0;
-	t.matrix[2][0] = 0.0; t.matrix[2][1] = 0.0; t.matrix[2][2] = 1.0;
+
+	init_transform(&t);
+
 	XRenderSetPictureTransform(dpy, src->pict, &t);
 
 	destroy_dot_picture(dpy, src);



More information about the xorg-commit mailing list