From cc09b29752e857e55879a7d773b8be1317eb2001 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Thu, 23 Feb 2012 13:40:59 +0000 Subject: [PATCH] xlib: Tidy conversion of xrender format to cairo_content_t Signed-off-by: Chris Wilson --- src/cairo-xlib-surface.c | 22 +++++++++------------- 1 file 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 *