b=583115 use XCopyArea for operator SOURCE with compatible COLOR_ALPHA surfaces to support simple overlapping self-copies r=jrmuizel

--HG--
extra : rebase_source : 201d9032b9dca80f71e154c68f0724e6826162eb
This commit is contained in:
Karl Tomlinson 2010-08-03 13:26:27 +12:00
Родитель 7a391911a2
Коммит 4be01c9897
3 изменённых файлов: 128 добавлений и 21 удалений

Просмотреть файл

@ -135,6 +135,8 @@ empty-clip-extents.patch: b79ea8a6cab8bd28aebecf6e1e8229d5ac017264
clip-rects-surface-extents.patch: 108b1c7825116ed3f93aa57384bbd3290cdc9181
disable-previous-scaled-font-cache.patch: Disable the previous-scaled-font-cache until we figure out our ctm handling (#583035)
copyarea-with-alpha.patch: support simple overlapping self copies in (some) color_alpha xlib surfaces. https://bugs.freedesktop.org/show_bug.cgi?id=29250
==== pixman patches ====

Просмотреть файл

@ -1727,20 +1727,21 @@ _surface_has_alpha (cairo_xlib_surface_t *surface)
}
}
/* Returns true if the given operator and source-alpha combination
* requires alpha compositing to complete.
/* Returns true if the given operator and alpha combination requires alpha
* compositing to complete on source and destination surfaces with the same
* format. i.e. if a simple bitwise copy is not appropriate.
*/
static cairo_bool_t
_operator_needs_alpha_composite (cairo_operator_t op,
cairo_bool_t destination_has_alpha,
cairo_bool_t source_has_alpha)
cairo_bool_t surfaces_have_alpha)
{
if (op == CAIRO_OPERATOR_SOURCE ||
(! source_has_alpha &&
(op == CAIRO_OPERATOR_OVER ||
op == CAIRO_OPERATOR_ATOP ||
op == CAIRO_OPERATOR_IN)))
return destination_has_alpha;
if (op == CAIRO_OPERATOR_SOURCE)
return FALSE;
if (op == CAIRO_OPERATOR_OVER ||
op == CAIRO_OPERATOR_IN ||
op == CAIRO_OPERATOR_ATOP)
return surfaces_have_alpha;
return TRUE;
}
@ -1848,14 +1849,14 @@ _recategorize_composite_operation (cairo_xlib_surface_t *dst,
cairo_surface_attributes_t *src_attr,
cairo_bool_t have_mask)
{
/* Can we use the core protocol? */
/* Can we use the core protocol? (If _surfaces_compatible, then src and
* dst have the same format and _surface_has_alpha is the same for each.)
*/
if (! have_mask &&
src->owns_pixmap &&
src->depth == dst->depth &&
_surfaces_compatible (src, dst) &&
_cairo_matrix_is_integer_translation (&src_attr->matrix, NULL, NULL) &&
! _operator_needs_alpha_composite (op,
_surface_has_alpha (dst),
_surface_has_alpha (src)))
! _operator_needs_alpha_composite (op, _surface_has_alpha (dst)))
{
if (src_attr->extend == CAIRO_EXTEND_NONE)
return DO_XCOPYAREA;
@ -2216,7 +2217,6 @@ _cairo_xlib_surface_composite (cairo_operator_t op,
composite_operation_t operation;
int itx, ity;
cairo_bool_t is_integer_translation;
cairo_bool_t needs_alpha_composite;
GC gc;
if (mask_pattern != NULL && ! CAIRO_SURFACE_RENDER_HAS_COMPOSITE (dst))
@ -2229,11 +2229,6 @@ _cairo_xlib_surface_composite (cairo_operator_t op,
X_DEBUG ((dst->dpy, "composite (dst=%x)", (unsigned int) dst->drawable));
needs_alpha_composite =
_operator_needs_alpha_composite (op,
_surface_has_alpha (dst),
! _cairo_pattern_is_opaque (src_pattern));
_cairo_xlib_display_notify (dst->display);
status =

Просмотреть файл

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