[cairo] Cut&paste bug in libpixman:IcFetcha_transform()?

Tor Lillqvist tml at iki.fi
Sat Aug 28 22:32:27 PDT 2004


While browsing the pixman source code (I was checking how it
implements rotations), I compared the functions IcFetch_transform()
and IcFetcha_transform():

--- 1	2004-08-29 05:05:17.077812800 +0000
+++ 2	2004-08-29 05:01:45.473540800 +0000
@@ -2 +2 @@
-IcFetch_transform (pixman_compositeOperand *op)
+IcFetcha_transform (pixman_compositeOperand *op)
@@ -20,2 +20,2 @@
-	y = xFixedToInt (v.vector[1]) + op->u.transform.top_y;
-	x = xFixedToInt (v.vector[0]) + op->u.transform.left_x;
+	y = xFixedToInt (v.vector[1]) + op->u.transform.left_x;
+	x = xFixedToInt (v.vector[0]) + op->u.transform.top_y;
@@ -25 +25 @@
-	    bits = (*op[1].fetch) (&op[1]);
+	    bits = (*op[1].fetcha) (&op[1]);
@@ -33,0 +34 @@
+	
@@ -44 +44,0 @@
-	    
@@ -51 +51 @@
-		    bits = (*op[1].fetch) (&op[1]);
+		    bits = (*op[1].fetcha) (&op[1]);
@@ -59,0 +60 @@
+		x++;
@@ -65,0 +67 @@
+	    y++;

I can't really say I have a very clear picture of how the libpixman
code works, but anyway...

I don't know about the extra x++ and y++, maybe that's intentional,
but the y and x assignments seem to have mixed up top_y and left_x?

Anyway, the only code that uses the IcFetcha_transform() function
(which is stored in an pixman_compositeOperand::fetcha in
IcBuildCompositeOperand()) are in the "C" versions of the various
IcCombine* functions. Those are listed in the table IcCombineFuncC,
and that table then is used in pixman_compositeGeneral() only if
iMask->componentAlpha is TRUE. That is set true only in the
commented-out function pixman_image_change(). So IcFetcha_transform
can never be called anyway, but... 

inquiring minds want to know what's going on?

--tml





More information about the cairo mailing list