1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/gfx/cairo/copyarea-with-alpha.patch Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,110 @@ 1.4 +diff --git a/gfx/cairo/cairo/src/cairo-xlib-surface.c b/gfx/cairo/cairo/src/cairo-xlib-surface.c 1.5 +--- a/gfx/cairo/cairo/src/cairo-xlib-surface.c 1.6 ++++ b/gfx/cairo/cairo/src/cairo-xlib-surface.c 1.7 +@@ -1722,30 +1722,31 @@ _surface_has_alpha (cairo_xlib_surface_t 1.8 + else 1.9 + return FALSE; 1.10 + } else { 1.11 + /* In the no-render case, we never have alpha */ 1.12 + return FALSE; 1.13 + } 1.14 + } 1.15 + 1.16 +-/* Returns true if the given operator and source-alpha combination 1.17 +- * requires alpha compositing to complete. 1.18 ++/* Returns true if the given operator and alpha combination requires alpha 1.19 ++ * compositing to complete on source and destination surfaces with the same 1.20 ++ * format. i.e. if a simple bitwise copy is not appropriate. 1.21 + */ 1.22 + static cairo_bool_t 1.23 + _operator_needs_alpha_composite (cairo_operator_t op, 1.24 +- cairo_bool_t destination_has_alpha, 1.25 +- cairo_bool_t source_has_alpha) 1.26 ++ cairo_bool_t surfaces_have_alpha) 1.27 + { 1.28 +- if (op == CAIRO_OPERATOR_SOURCE || 1.29 +- (! source_has_alpha && 1.30 +- (op == CAIRO_OPERATOR_OVER || 1.31 +- op == CAIRO_OPERATOR_ATOP || 1.32 +- op == CAIRO_OPERATOR_IN))) 1.33 +- return destination_has_alpha; 1.34 ++ if (op == CAIRO_OPERATOR_SOURCE) 1.35 ++ return FALSE; 1.36 ++ 1.37 ++ if (op == CAIRO_OPERATOR_OVER || 1.38 ++ op == CAIRO_OPERATOR_IN || 1.39 ++ op == CAIRO_OPERATOR_ATOP) 1.40 ++ return surfaces_have_alpha; 1.41 + 1.42 + return TRUE; 1.43 + } 1.44 + 1.45 + /* There is a bug in most older X servers with compositing using a 1.46 + * untransformed repeating source pattern when the source is in off-screen 1.47 + * video memory, and another with repeated transformed images using a 1.48 + * general transform matrix. When these bugs could be triggered, we need a 1.49 +@@ -1843,24 +1844,24 @@ _categorize_composite_operation (cairo_x 1.50 + */ 1.51 + static composite_operation_t 1.52 + _recategorize_composite_operation (cairo_xlib_surface_t *dst, 1.53 + cairo_operator_t op, 1.54 + cairo_xlib_surface_t *src, 1.55 + cairo_surface_attributes_t *src_attr, 1.56 + cairo_bool_t have_mask) 1.57 + { 1.58 +- /* Can we use the core protocol? */ 1.59 ++ /* Can we use the core protocol? (If _surfaces_compatible, then src and 1.60 ++ * dst have the same format and _surface_has_alpha is the same for each.) 1.61 ++ */ 1.62 + if (! have_mask && 1.63 + src->owns_pixmap && 1.64 +- src->depth == dst->depth && 1.65 ++ _surfaces_compatible (src, dst) && 1.66 + _cairo_matrix_is_integer_translation (&src_attr->matrix, NULL, NULL) && 1.67 +- ! _operator_needs_alpha_composite (op, 1.68 +- _surface_has_alpha (dst), 1.69 +- _surface_has_alpha (src))) 1.70 ++ ! _operator_needs_alpha_composite (op, _surface_has_alpha (dst))) 1.71 + { 1.72 + if (src_attr->extend == CAIRO_EXTEND_NONE) 1.73 + return DO_XCOPYAREA; 1.74 + 1.75 + if (dst->buggy_repeat && src_attr->extend == CAIRO_EXTEND_REPEAT) 1.76 + return DO_XTILE; 1.77 + } 1.78 + 1.79 +@@ -2211,34 +2212,28 @@ _cairo_xlib_surface_composite (cairo_ope 1.80 + cairo_surface_attributes_t src_attr, mask_attr; 1.81 + cairo_xlib_surface_t *dst = abstract_dst; 1.82 + cairo_xlib_surface_t *src; 1.83 + cairo_xlib_surface_t *mask; 1.84 + cairo_int_status_t status; 1.85 + composite_operation_t operation; 1.86 + int itx, ity; 1.87 + cairo_bool_t is_integer_translation; 1.88 +- cairo_bool_t needs_alpha_composite; 1.89 + GC gc; 1.90 + 1.91 + if (mask_pattern != NULL && ! CAIRO_SURFACE_RENDER_HAS_COMPOSITE (dst)) 1.92 + return UNSUPPORTED ("no support for masks"); 1.93 + 1.94 + operation = _categorize_composite_operation (dst, op, src_pattern, 1.95 + mask_pattern != NULL); 1.96 + if (operation == DO_UNSUPPORTED) 1.97 + return UNSUPPORTED ("unsupported operation"); 1.98 + 1.99 + X_DEBUG ((dst->dpy, "composite (dst=%x)", (unsigned int) dst->drawable)); 1.100 + 1.101 +- needs_alpha_composite = 1.102 +- _operator_needs_alpha_composite (op, 1.103 +- _surface_has_alpha (dst), 1.104 +- ! _cairo_pattern_is_opaque (src_pattern)); 1.105 +- 1.106 + _cairo_xlib_display_notify (dst->display); 1.107 + 1.108 + status = 1.109 + _cairo_xlib_surface_acquire_pattern_surfaces (dst, 1.110 + src_pattern, mask_pattern, 1.111 + src_x, src_y, 1.112 + mask_x, mask_y, 1.113 + width, height,