diff options
author | Benjamin Otte <otte@gnome.org> | 2009-09-24 22:57:39 +0200 |
---|---|---|
committer | Benjamin Otte <otte@gnome.org> | 2009-09-25 00:14:15 +0200 |
commit | 9f5fe6711566ee34afe210f271f1c5a061efa745 (patch) | |
tree | 940873a75f759fa36e1fbac6075e0886e9f4d0d6 | |
parent | 120247ac55d92d9c9b24fad45c765d16e692f355 (diff) |
[image] Return cairo_bool_t from _pixman_format_to_masks
Return FALSE when the pixman format does not support ARGB masks. In
particular, return FALSE for YUV formats.
-rw-r--r-- | src/cairo-image-surface.c | 21 | ||||
-rw-r--r-- | src/cairoint.h | 2 |
2 files changed, 11 insertions, 12 deletions
diff --git a/src/cairo-image-surface.c b/src/cairo-image-surface.c index 0c5cc769..29ed1191 100644 --- a/src/cairo-image-surface.c +++ b/src/cairo-image-surface.c @@ -231,11 +231,10 @@ _pixman_format_from_masks (cairo_format_masks_t *masks, * expected. This avoid any problems from something bizarre like * alpha in the least-significant bits, or insane channel order, * or whatever. */ - _pixman_format_to_masks (format, &format_masks); - - if (masks->bpp != format_masks.bpp || - masks->red_mask != format_masks.red_mask || - masks->green_mask != format_masks.green_mask || + if (!_pixman_format_to_masks (format, &format_masks) || + masks->bpp != format_masks.bpp || + masks->red_mask != format_masks.red_mask || + masks->green_mask != format_masks.green_mask || masks->blue_mask != format_masks.blue_mask) { return FALSE; @@ -248,7 +247,7 @@ _pixman_format_from_masks (cairo_format_masks_t *masks, /* A mask consisting of N bits set to 1. */ #define MASK(N) ((1UL << (N))-1) -void +cairo_bool_t _pixman_format_to_masks (pixman_format_code_t format, cairo_format_masks_t *masks) { @@ -268,27 +267,27 @@ _pixman_format_to_masks (pixman_format_code_t format, masks->red_mask = MASK (r) << (g + b); masks->green_mask = MASK (g) << (b); masks->blue_mask = MASK (b); - return; + return TRUE; case PIXMAN_TYPE_ABGR: masks->alpha_mask = MASK (a) << (b + g + r); masks->blue_mask = MASK (b) << (g + r); masks->green_mask = MASK (g) << (r); masks->red_mask = MASK (r); - return; + return TRUE; #ifdef PIXMAN_TYPE_BGRA case PIXMAN_TYPE_BGRA: masks->blue_mask = MASK (b) << (g + r + a); masks->green_mask = MASK (g) << (r + a); masks->red_mask = MASK (r) << (a); masks->alpha_mask = MASK (a); - return; + return TRUE; #endif case PIXMAN_TYPE_A: masks->alpha_mask = MASK (a); masks->red_mask = 0; masks->green_mask = 0; masks->blue_mask = 0; - return; + return TRUE; case PIXMAN_TYPE_OTHER: case PIXMAN_TYPE_COLOR: case PIXMAN_TYPE_GRAY: @@ -299,7 +298,7 @@ _pixman_format_to_masks (pixman_format_code_t format, masks->red_mask = 0; masks->green_mask = 0; masks->blue_mask = 0; - return; + return FALSE; } } diff --git a/src/cairoint.h b/src/cairoint.h index 8b82454f..ccf790a3 100644 --- a/src/cairoint.h +++ b/src/cairoint.h @@ -2230,7 +2230,7 @@ cairo_private cairo_bool_t _pixman_format_from_masks (cairo_format_masks_t *masks, pixman_format_code_t *format_ret); -cairo_private void +cairo_private cairo_bool_t _pixman_format_to_masks (pixman_format_code_t pixman_format, cairo_format_masks_t *masks); |