diff options
author | Luo Jinghua <sunmoon1997@gmail.com> | 2008-11-30 20:42:49 +0800 |
---|---|---|
committer | Luo Jinghua <sunmoon1997@gmail.com> | 2008-11-30 21:44:36 +0800 |
commit | 51a75ad932af4a3c3da96ef98de79328afa200c3 (patch) | |
tree | 961b1d5d7e1ae4c96933346d5c6aac8f22b17c64 | |
parent | 7247017cf5e6b497a5836d9081ee153d27c6b15e (diff) |
glitz: Replace specified color with an opaque one if dst surface don't have an alpha channel.
Otherwise if underlying glitz drawable has an alpha channel, glitz_set_rectangles
will set its alpha channel to specified value instead of opaque one and effects following
composite operations since glitz draws to attached drawable then copies its content to
the dst surface. With this commit, three test cases such as operator, operator-alpha and
unbounded-operator passes now.
-rw-r--r-- | src/cairo-glitz-surface.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/cairo-glitz-surface.c b/src/cairo-glitz-surface.c index d4eb0681..589e14ff 100644 --- a/src/cairo-glitz-surface.c +++ b/src/cairo-glitz-surface.c @@ -999,23 +999,29 @@ _cairo_glitz_surface_fill_rectangles (void *abstract_dst, } switch (op) { + case CAIRO_OPERATOR_CLEAR: case CAIRO_OPERATOR_SOURCE: { glitz_color_t glitz_color; + glitz_format_t *format; glitz_color.red = color->red_short; glitz_color.green = color->green_short; glitz_color.blue = color->blue_short; glitz_color.alpha = color->alpha_short; + /* + * XXX even if the dst surface don't have an alpha channel, the + * above alpha still effect the dst surface because the + * underlying glitz drawable may have an alpha channel. So + * replacing the color with an opaque one is needed. + */ + format = glitz_surface_get_format (dst->surface); + if (format->color.alpha_size == 0) + glitz_color.alpha = 0xffff; + glitz_set_rectangles (dst->surface, &glitz_color, glitz_rects, n_rects); } break; - case CAIRO_OPERATOR_CLEAR: { - static const glitz_color_t glitz_color = { 0, 0, 0, 0 }; - - glitz_set_rectangles (dst->surface, &glitz_color, - glitz_rects, n_rects); - } break; case CAIRO_OPERATOR_SATURATE: return CAIRO_INT_STATUS_UNSUPPORTED; case CAIRO_OPERATOR_OVER: |