summaryrefslogtreecommitdiff
path: root/src/cairo-xlib-surface.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2012-02-23 13:40:59 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2012-02-23 13:44:28 +0000
commitcc09b29752e857e55879a7d773b8be1317eb2001 (patch)
tree5a910bc634049f250d87a6b10ced9abc716fc989 /src/cairo-xlib-surface.c
parentd95cf87c03f2b4f2677450cae1d0be3aa15c0a97 (diff)
downloadcairo-cc09b29752e857e55879a7d773b8be1317eb2001.tar.gz
xlib: Tidy conversion of xrender format to cairo_content_t
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src/cairo-xlib-surface.c')
-rw-r--r--src/cairo-xlib-surface.c22
1 files changed, 9 insertions, 13 deletions
diff --git a/src/cairo-xlib-surface.c b/src/cairo-xlib-surface.c
index d8b0272d0..563e96421 100644
--- a/src/cairo-xlib-surface.c
+++ b/src/cairo-xlib-surface.c
@@ -237,26 +237,22 @@ _visual_for_xrender_format(Screen *screen,
static cairo_content_t
_xrender_format_to_content (XRenderPictFormat *xrender_format)
{
- cairo_bool_t xrender_format_has_alpha;
- cairo_bool_t xrender_format_has_color;
+ cairo_content_t content;
/* This only happens when using a non-Render server. Let's punt
* and say there's no alpha here. */
if (xrender_format == NULL)
return CAIRO_CONTENT_COLOR;
- xrender_format_has_alpha = (xrender_format->direct.alphaMask != 0);
- xrender_format_has_color = (xrender_format->direct.redMask != 0 ||
- xrender_format->direct.greenMask != 0 ||
- xrender_format->direct.blueMask != 0);
+ content = 0;
+ if (xrender_format->direct.alphaMask)
+ content |= CAIRO_CONTENT_ALPHA;
+ if (xrender_format->direct.redMask |
+ xrender_format->direct.greenMask |
+ xrender_format->direct.blueMask)
+ content |= CAIRO_CONTENT_COLOR;
- if (xrender_format_has_alpha)
- if (xrender_format_has_color)
- return CAIRO_CONTENT_COLOR_ALPHA;
- else
- return CAIRO_CONTENT_ALPHA;
- else
- return CAIRO_CONTENT_COLOR;
+ return content;
}
static cairo_surface_t *