[cairo-commit] src/cairo-image-surface.c

Jinghua Luo jinghua at kemper.freedesktop.org
Thu Nov 27 16:03:56 PST 2008


 src/cairo-image-surface.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit ed6bd4766cb47e97b1a6ecb81eff5bf4673d549b
Author: Luo Jinghua <sunmoon1997 at gmail.com>
Date:   Fri Nov 28 07:54:41 2008 +0800

    image: Use unsigned long to compute color masks.
    
    Use unsigned long in the first place to prevent compiler from
    expanding signed bit to all upper bits. e.g, a alpha mask 0xff0000
    will expand to 0xffffffffff00000 on 64 bit platform which is not
    what we expected.

diff --git a/src/cairo-image-surface.c b/src/cairo-image-surface.c
index 234a6f9..b7a4f6c 100644
--- a/src/cairo-image-surface.c
+++ b/src/cairo-image-surface.c
@@ -203,7 +203,7 @@ _pixman_format_from_masks (cairo_format_masks_t *masks,
 }
 
 /* A mask consisting of N bits set to 1. */
-#define MASK(N) ((1 << (N))-1)
+#define MASK(N) ((1UL << (N))-1)
 
 void
 _pixman_format_to_masks (pixman_format_code_t	 format,


More information about the cairo-commit mailing list