Avoid shifting 32-bit quanity by 32 bits, which is undefined behavior.

This commit is contained in:
Carl Worth 2005-05-17 06:08:01 +00:00
parent 0c05b23b31
commit f67f5003df
2 changed files with 8 additions and 2 deletions

View file

@ -1,3 +1,8 @@
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:

View file

@ -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))