diff options
author | Carl Worth <cworth@cworth.org> | 2005-05-17 06:08:01 +0000 |
---|---|---|
committer | Carl Worth <cworth@cworth.org> | 2005-05-17 06:08:01 +0000 |
commit | f67f5003df306de40416f24bc652fc4630cf5808 (patch) | |
tree | 7ce956f61e2dec8383b8a0ae9dc8a20ee4037c2e | |
parent | 0c05b23b3165ec6908c28f56b3446cf43dff44a2 (diff) |
Avoid shifting 32-bit quanity by 32 bits, which is undefined behavior.
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | src/cairo-xlib-surface.c | 5 |
2 files changed, 8 insertions, 2 deletions
@@ -1,5 +1,10 @@ 2005-05-17 Carl Worth <cworth@cworth.org> + * src/cairo-xlib-surface.c (_get_image_surface): Avoid shifting + 32-bit quanity by 32 bits, which is undefined behavior. + +2005-05-17 Carl Worth <cworth@cworth.org> + Rework of cairo_xlib_surface create functions by Keith Packard: * src/cairo-xlib-xrender.h: diff --git a/src/cairo-xlib-surface.c b/src/cairo-xlib-surface.c index e4d65e0ee..99672dfdc 100644 --- a/src/cairo-xlib-surface.c +++ b/src/cairo-xlib-surface.c @@ -385,9 +385,10 @@ _get_image_surface (cairo_xlib_surface_t *surface, masks.red_mask = 0; masks.green_mask = 0; masks.blue_mask = 0; - masks.alpha_mask = (1 << surface->depth) - 1; - if (!masks.alpha_mask) + if (surface->depth == 32) masks.alpha_mask = 0xffffffff; + else + masks.alpha_mask = (1 << surface->depth) - 1; } if (_CAIRO_MASK_FORMAT (&masks, &format)) |