michael@0: diff --git a/gfx/cairo/cairo/src/cairo-xlib-surface.c b/gfx/cairo/cairo/src/cairo-xlib-surface.c michael@0: --- a/gfx/cairo/cairo/src/cairo-xlib-surface.c michael@0: +++ b/gfx/cairo/cairo/src/cairo-xlib-surface.c michael@0: @@ -1722,30 +1722,31 @@ _surface_has_alpha (cairo_xlib_surface_t michael@0: else michael@0: return FALSE; michael@0: } else { michael@0: /* In the no-render case, we never have alpha */ michael@0: return FALSE; michael@0: } michael@0: } michael@0: michael@0: -/* Returns true if the given operator and source-alpha combination michael@0: - * requires alpha compositing to complete. michael@0: +/* Returns true if the given operator and alpha combination requires alpha michael@0: + * compositing to complete on source and destination surfaces with the same michael@0: + * format. i.e. if a simple bitwise copy is not appropriate. michael@0: */ michael@0: static cairo_bool_t michael@0: _operator_needs_alpha_composite (cairo_operator_t op, michael@0: - cairo_bool_t destination_has_alpha, michael@0: - cairo_bool_t source_has_alpha) michael@0: + cairo_bool_t surfaces_have_alpha) michael@0: { michael@0: - if (op == CAIRO_OPERATOR_SOURCE || michael@0: - (! source_has_alpha && michael@0: - (op == CAIRO_OPERATOR_OVER || michael@0: - op == CAIRO_OPERATOR_ATOP || michael@0: - op == CAIRO_OPERATOR_IN))) michael@0: - return destination_has_alpha; michael@0: + if (op == CAIRO_OPERATOR_SOURCE) michael@0: + return FALSE; michael@0: + michael@0: + if (op == CAIRO_OPERATOR_OVER || michael@0: + op == CAIRO_OPERATOR_IN || michael@0: + op == CAIRO_OPERATOR_ATOP) michael@0: + return surfaces_have_alpha; michael@0: michael@0: return TRUE; michael@0: } michael@0: michael@0: /* There is a bug in most older X servers with compositing using a michael@0: * untransformed repeating source pattern when the source is in off-screen michael@0: * video memory, and another with repeated transformed images using a michael@0: * general transform matrix. When these bugs could be triggered, we need a michael@0: @@ -1843,24 +1844,24 @@ _categorize_composite_operation (cairo_x michael@0: */ michael@0: static composite_operation_t michael@0: _recategorize_composite_operation (cairo_xlib_surface_t *dst, michael@0: cairo_operator_t op, michael@0: cairo_xlib_surface_t *src, michael@0: cairo_surface_attributes_t *src_attr, michael@0: cairo_bool_t have_mask) michael@0: { michael@0: - /* Can we use the core protocol? */ michael@0: + /* Can we use the core protocol? (If _surfaces_compatible, then src and michael@0: + * dst have the same format and _surface_has_alpha is the same for each.) michael@0: + */ michael@0: if (! have_mask && michael@0: src->owns_pixmap && michael@0: - src->depth == dst->depth && michael@0: + _surfaces_compatible (src, dst) && michael@0: _cairo_matrix_is_integer_translation (&src_attr->matrix, NULL, NULL) && michael@0: - ! _operator_needs_alpha_composite (op, michael@0: - _surface_has_alpha (dst), michael@0: - _surface_has_alpha (src))) michael@0: + ! _operator_needs_alpha_composite (op, _surface_has_alpha (dst))) michael@0: { michael@0: if (src_attr->extend == CAIRO_EXTEND_NONE) michael@0: return DO_XCOPYAREA; michael@0: michael@0: if (dst->buggy_repeat && src_attr->extend == CAIRO_EXTEND_REPEAT) michael@0: return DO_XTILE; michael@0: } michael@0: michael@0: @@ -2211,34 +2212,28 @@ _cairo_xlib_surface_composite (cairo_ope michael@0: cairo_surface_attributes_t src_attr, mask_attr; michael@0: cairo_xlib_surface_t *dst = abstract_dst; michael@0: cairo_xlib_surface_t *src; michael@0: cairo_xlib_surface_t *mask; michael@0: cairo_int_status_t status; michael@0: composite_operation_t operation; michael@0: int itx, ity; michael@0: cairo_bool_t is_integer_translation; michael@0: - cairo_bool_t needs_alpha_composite; michael@0: GC gc; michael@0: michael@0: if (mask_pattern != NULL && ! CAIRO_SURFACE_RENDER_HAS_COMPOSITE (dst)) michael@0: return UNSUPPORTED ("no support for masks"); michael@0: michael@0: operation = _categorize_composite_operation (dst, op, src_pattern, michael@0: mask_pattern != NULL); michael@0: if (operation == DO_UNSUPPORTED) michael@0: return UNSUPPORTED ("unsupported operation"); michael@0: michael@0: X_DEBUG ((dst->dpy, "composite (dst=%x)", (unsigned int) dst->drawable)); michael@0: michael@0: - needs_alpha_composite = michael@0: - _operator_needs_alpha_composite (op, michael@0: - _surface_has_alpha (dst), michael@0: - ! _cairo_pattern_is_opaque (src_pattern)); michael@0: - michael@0: _cairo_xlib_display_notify (dst->display); michael@0: michael@0: status = michael@0: _cairo_xlib_surface_acquire_pattern_surfaces (dst, michael@0: src_pattern, mask_pattern, michael@0: src_x, src_y, michael@0: mask_x, mask_y, michael@0: width, height,