[Pixman] [PATCH 2/2] pixman-filter.c: Use 65536, not 65535, for fixed point conversion

Søren Sandmann sandmann at cs.au.dk
Tue Sep 10 07:02:11 PDT 2013


From: Søren Sandmann Pedersen <ssp at redhat.com>

Converting a double precision number to 16.16 fixed point should be
done by multiplying with 65536.0, not 65535.0.

The bug could potentially cause certain filters that would otherwise
leave the image bit-for-bit unchanged under an identity
transformation, to not do so, but the numbers are close enough that it
there weren't any visual differences.
---
 pixman/pixman-filter.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pixman/pixman-filter.c b/pixman/pixman-filter.c
index 5ff7b6e..b2bf53f 100644
--- a/pixman/pixman-filter.c
+++ b/pixman/pixman-filter.c
@@ -275,7 +275,7 @@ create_1d_filter (int             *width,
 	    }
 
 	    total += c;
-            *p++ = (pixman_fixed_t)(c * 65535.0 + 0.5);
+            *p++ = (pixman_fixed_t)(c * 65536.0 + 0.5);
         }
 
 	/* Normalize */
-- 
1.7.11.7



More information about the Pixman mailing list