|
1 diff --git a/gfx/cairo/cairo/src/cairo-xlib-surface.c b/gfx/cairo/cairo/src/cairo-xlib-surface.c |
|
2 --- a/gfx/cairo/cairo/src/cairo-xlib-surface.c |
|
3 +++ b/gfx/cairo/cairo/src/cairo-xlib-surface.c |
|
4 @@ -1722,30 +1722,31 @@ _surface_has_alpha (cairo_xlib_surface_t |
|
5 else |
|
6 return FALSE; |
|
7 } else { |
|
8 /* In the no-render case, we never have alpha */ |
|
9 return FALSE; |
|
10 } |
|
11 } |
|
12 |
|
13 -/* Returns true if the given operator and source-alpha combination |
|
14 - * requires alpha compositing to complete. |
|
15 +/* Returns true if the given operator and alpha combination requires alpha |
|
16 + * compositing to complete on source and destination surfaces with the same |
|
17 + * format. i.e. if a simple bitwise copy is not appropriate. |
|
18 */ |
|
19 static cairo_bool_t |
|
20 _operator_needs_alpha_composite (cairo_operator_t op, |
|
21 - cairo_bool_t destination_has_alpha, |
|
22 - cairo_bool_t source_has_alpha) |
|
23 + cairo_bool_t surfaces_have_alpha) |
|
24 { |
|
25 - if (op == CAIRO_OPERATOR_SOURCE || |
|
26 - (! source_has_alpha && |
|
27 - (op == CAIRO_OPERATOR_OVER || |
|
28 - op == CAIRO_OPERATOR_ATOP || |
|
29 - op == CAIRO_OPERATOR_IN))) |
|
30 - return destination_has_alpha; |
|
31 + if (op == CAIRO_OPERATOR_SOURCE) |
|
32 + return FALSE; |
|
33 + |
|
34 + if (op == CAIRO_OPERATOR_OVER || |
|
35 + op == CAIRO_OPERATOR_IN || |
|
36 + op == CAIRO_OPERATOR_ATOP) |
|
37 + return surfaces_have_alpha; |
|
38 |
|
39 return TRUE; |
|
40 } |
|
41 |
|
42 /* There is a bug in most older X servers with compositing using a |
|
43 * untransformed repeating source pattern when the source is in off-screen |
|
44 * video memory, and another with repeated transformed images using a |
|
45 * general transform matrix. When these bugs could be triggered, we need a |
|
46 @@ -1843,24 +1844,24 @@ _categorize_composite_operation (cairo_x |
|
47 */ |
|
48 static composite_operation_t |
|
49 _recategorize_composite_operation (cairo_xlib_surface_t *dst, |
|
50 cairo_operator_t op, |
|
51 cairo_xlib_surface_t *src, |
|
52 cairo_surface_attributes_t *src_attr, |
|
53 cairo_bool_t have_mask) |
|
54 { |
|
55 - /* Can we use the core protocol? */ |
|
56 + /* Can we use the core protocol? (If _surfaces_compatible, then src and |
|
57 + * dst have the same format and _surface_has_alpha is the same for each.) |
|
58 + */ |
|
59 if (! have_mask && |
|
60 src->owns_pixmap && |
|
61 - src->depth == dst->depth && |
|
62 + _surfaces_compatible (src, dst) && |
|
63 _cairo_matrix_is_integer_translation (&src_attr->matrix, NULL, NULL) && |
|
64 - ! _operator_needs_alpha_composite (op, |
|
65 - _surface_has_alpha (dst), |
|
66 - _surface_has_alpha (src))) |
|
67 + ! _operator_needs_alpha_composite (op, _surface_has_alpha (dst))) |
|
68 { |
|
69 if (src_attr->extend == CAIRO_EXTEND_NONE) |
|
70 return DO_XCOPYAREA; |
|
71 |
|
72 if (dst->buggy_repeat && src_attr->extend == CAIRO_EXTEND_REPEAT) |
|
73 return DO_XTILE; |
|
74 } |
|
75 |
|
76 @@ -2211,34 +2212,28 @@ _cairo_xlib_surface_composite (cairo_ope |
|
77 cairo_surface_attributes_t src_attr, mask_attr; |
|
78 cairo_xlib_surface_t *dst = abstract_dst; |
|
79 cairo_xlib_surface_t *src; |
|
80 cairo_xlib_surface_t *mask; |
|
81 cairo_int_status_t status; |
|
82 composite_operation_t operation; |
|
83 int itx, ity; |
|
84 cairo_bool_t is_integer_translation; |
|
85 - cairo_bool_t needs_alpha_composite; |
|
86 GC gc; |
|
87 |
|
88 if (mask_pattern != NULL && ! CAIRO_SURFACE_RENDER_HAS_COMPOSITE (dst)) |
|
89 return UNSUPPORTED ("no support for masks"); |
|
90 |
|
91 operation = _categorize_composite_operation (dst, op, src_pattern, |
|
92 mask_pattern != NULL); |
|
93 if (operation == DO_UNSUPPORTED) |
|
94 return UNSUPPORTED ("unsupported operation"); |
|
95 |
|
96 X_DEBUG ((dst->dpy, "composite (dst=%x)", (unsigned int) dst->drawable)); |
|
97 |
|
98 - needs_alpha_composite = |
|
99 - _operator_needs_alpha_composite (op, |
|
100 - _surface_has_alpha (dst), |
|
101 - ! _cairo_pattern_is_opaque (src_pattern)); |
|
102 - |
|
103 _cairo_xlib_display_notify (dst->display); |
|
104 |
|
105 status = |
|
106 _cairo_xlib_surface_acquire_pattern_surfaces (dst, |
|
107 src_pattern, mask_pattern, |
|
108 src_x, src_y, |
|
109 mask_x, mask_y, |
|
110 width, height, |