[PATCH] xrandr: Simplify transform and scale code

Éric Piel E.A.B.Piel at tudelft.nl
Thu Jan 15 02:52:53 PST 2009


Hello,
While reading the code of xrandr, I noticed some little possible
optimizations. Here they are :-)

Eric
--

The init_transform() function sets up a unit matrix, so only the scaling
factors need to be updated. Additionally, the code for the transform
option initialised twice the matrix, which is not needed.

Signed-off-by: Eric Piel <eric.piel at tremplin-utc.net>
---
 xrandr.c |    2 --
 1 files changed, 0 insertions(+), 2 deletions(-)

diff --git a/xrandr.c b/xrandr.c
index bbdb348..5c369cd 100644
--- a/xrandr.c
+++ b/xrandr.c
@@ -2256,7 +2256,6 @@ main (int argc, char **argv)
 	    init_transform (&output->transform);
 	    output->transform.transform.matrix[0][0] = XDoubleToFixed (sx);
 	    output->transform.transform.matrix[1][1] = XDoubleToFixed (sy);
-	    output->transform.transform.matrix[2][2] = XDoubleToFixed (1.0);
 	    if (sx != 1 || sy != 1)
 		output->transform.filter = "bilinear";
 	    else
@@ -2279,7 +2278,6 @@ main (int argc, char **argv)
 			   &transform[2][0],&transform[2][1],&transform[2][2])
 		    != 9)
 		    usage ();
-		init_transform (&output->transform);
 		for (k = 0; k < 3; k++)
 		    for (l = 0; l < 3; l++) {
 			output->transform.transform.matrix[k][l] = XDoubleToFixed
(transform[k][l]);
-- 
1.6.0.5

-------------- next part --------------
A non-text attachment was scrubbed...
Name: E_A_B_Piel.vcf
Type: text/x-vcard
Size: 379 bytes
Desc: not available
URL: <http://lists.x.org/archives/xorg/attachments/20090115/05142734/attachment.vcf>


More information about the xorg mailing list