diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2009-10-16 10:11:41 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2009-10-16 17:04:16 +0100 |
commit | 54df07a3da2bfbbdbe2dde92ca298ac0d7b8d255 (patch) | |
tree | 760fa258de427d0701291d8877b2e4741a81dc5e | |
parent | 6a19a82efd3afe8fb8bd30e5362b247de8efe159 (diff) |
[surface] Don't AND in the desired content.
Gah, that was a horrible mistake. It was a flawed hack to create Pixmaps
of the correct depth when cloning patterns for blitting to the xlib
backend. However, it had the nasty side-effect of discarding alpha when
targeting Window surfaces. The correct solution is to simply correct the
Pixmap of the desired depth and render a matching pattern onto the
surface - i.e. a reversal the current acquire -> clone. See the
forthcoming revised xcb backend on how I should have done it originally.
-rw-r--r-- | src/cairo-directfb-surface.c | 2 | ||||
-rw-r--r-- | src/cairo-gl-surface.c | 4 | ||||
-rw-r--r-- | src/cairo-glitz-surface.c | 3 | ||||
-rw-r--r-- | src/cairo-image-surface.c | 4 | ||||
-rw-r--r-- | src/cairo-pattern.c | 15 | ||||
-rw-r--r-- | src/cairo-quartz-surface.c | 1 | ||||
-rw-r--r-- | src/cairo-surface-fallback-private.h | 1 | ||||
-rw-r--r-- | src/cairo-surface-fallback.c | 3 | ||||
-rw-r--r-- | src/cairo-surface.c | 14 | ||||
-rw-r--r-- | src/cairo-xlib-surface.c | 18 | ||||
-rw-r--r-- | src/cairoint.h | 4 | ||||
-rw-r--r-- | src/test-fallback-surface.c | 1 | ||||
-rw-r--r-- | src/test-fallback16-surface.c | 2 |
13 files changed, 10 insertions, 62 deletions
diff --git a/src/cairo-directfb-surface.c b/src/cairo-directfb-surface.c index 8247fb94..afad2705 100644 --- a/src/cairo-directfb-surface.c +++ b/src/cairo-directfb-surface.c @@ -706,7 +706,6 @@ _cairo_directfb_surface_release_dest_image (void *abstract_surf static cairo_status_t _cairo_directfb_surface_clone_similar (void *abstract_surface, cairo_surface_t *src, - cairo_content_t content, int src_x, int src_y, int width, @@ -846,7 +845,6 @@ _directfb_prepare_composite (cairo_directfb_surface_t *dst, } status = _cairo_pattern_acquire_surface (src_pattern, &dst->base, - CAIRO_CONTENT_COLOR_ALPHA, *src_x, *src_y, width, height, CAIRO_PATTERN_ACQUIRE_NO_REFLECT, (cairo_surface_t **) &src, diff --git a/src/cairo-gl-surface.c b/src/cairo-gl-surface.c index 17bf4bc5..64ae29ba 100644 --- a/src/cairo-gl-surface.c +++ b/src/cairo-gl-surface.c @@ -801,7 +801,6 @@ _cairo_gl_surface_release_dest_image (void *abstract_surface, static cairo_status_t _cairo_gl_surface_clone_similar (void *abstract_surface, cairo_surface_t *src, - cairo_content_t content, int src_x, int src_y, int width, @@ -825,7 +824,7 @@ _cairo_gl_surface_clone_similar (void *abstract_surface, clone = (cairo_gl_surface_t *) _cairo_gl_surface_create_similar (&surface->base, - content, + src->content, width, height); if (clone == NULL) return CAIRO_INT_STATUS_UNSUPPORTED; @@ -1051,7 +1050,6 @@ _cairo_gl_pattern_texture_setup (cairo_gl_composite_operand_t *operand, } status = _cairo_pattern_acquire_surface (src, &dst->base, - CAIRO_CONTENT_COLOR_ALPHA, src_x, src_y, width, height, CAIRO_PATTERN_ACQUIRE_NONE, diff --git a/src/cairo-glitz-surface.c b/src/cairo-glitz-surface.c index a649d500..5f97f65e 100644 --- a/src/cairo-glitz-surface.c +++ b/src/cairo-glitz-surface.c @@ -332,7 +332,6 @@ _cairo_glitz_surface_release_dest_image (void *abstract_surfa static cairo_status_t _cairo_glitz_surface_clone_similar (void *abstract_surface, cairo_surface_t *src, - cairo_content_t content, int src_x, int src_y, int width, @@ -737,7 +736,6 @@ _cairo_glitz_pattern_acquire_surface (const cairo_pattern_t *pattern, cairo_int_status_t status; status = _cairo_pattern_acquire_surface (pattern, &dst->base, - CAIRO_CONTENT_COLOR_ALPHA, x, y, width, height, CAIRO_PATTERN_ACQUIRE_NONE, (cairo_surface_t **) &src, @@ -2223,7 +2221,6 @@ _cairo_glitz_surface_old_show_glyphs (cairo_scaled_font_t *scaled_font, status = _cairo_glitz_surface_clone_similar (abstract_surface, image, - CAIRO_CONTENT_COLOR_ALPHA, 0, 0, glyph_width, diff --git a/src/cairo-image-surface.c b/src/cairo-image-surface.c index 05b0edbb..4dbc2fee 100644 --- a/src/cairo-image-surface.c +++ b/src/cairo-image-surface.c @@ -854,7 +854,6 @@ _cairo_image_surface_release_dest_image (void *abstract_surfa static cairo_status_t _cairo_image_surface_clone_similar (void *abstract_surface, cairo_surface_t *src, - cairo_content_t content, int src_x, int src_y, int width, @@ -1093,7 +1092,6 @@ _cairo_image_surface_composite (cairo_operator_t op, status = _cairo_pattern_acquire_surfaces (src_pattern, mask_pattern, &dst->base, - CAIRO_CONTENT_COLOR_ALPHA, src_x, src_y, mask_x, mask_y, width, height, @@ -1313,7 +1311,6 @@ _cairo_image_surface_composite_trapezoids (cairo_operator_t op, return status; status = _cairo_pattern_acquire_surface (pattern, &dst->base, - CAIRO_CONTENT_COLOR_ALPHA, src_x, src_y, width, height, CAIRO_PATTERN_ACQUIRE_NONE, (cairo_surface_t **) &src, @@ -1565,7 +1562,6 @@ _cairo_image_surface_create_span_renderer (cairo_operator_t op, status = _cairo_pattern_acquire_surface ( renderer->pattern, &renderer->dst->base, - CAIRO_CONTENT_COLOR_ALPHA, rects->src.x, rects->src.y, width, height, CAIRO_PATTERN_ACQUIRE_NONE, diff --git a/src/cairo-pattern.c b/src/cairo-pattern.c index 2990e2a0..d72867a0 100644 --- a/src/cairo-pattern.c +++ b/src/cairo-pattern.c @@ -1603,9 +1603,6 @@ _cairo_pattern_acquire_surface_for_gradient (const cairo_gradient_pattern_t *pat _cairo_debug_check_image_surface_is_defined (&image->base); status = _cairo_surface_clone_similar (dst, &image->base, - opaque ? - CAIRO_CONTENT_COLOR : - CAIRO_CONTENT_COLOR_ALPHA, 0, 0, width, height, &clone_offset_x, &clone_offset_y, @@ -1931,7 +1928,6 @@ _pixman_nearest_sample (double d) static cairo_int_status_t _cairo_pattern_acquire_surface_for_surface (const cairo_surface_pattern_t *pattern, cairo_surface_t *dst, - cairo_content_t content, int x, int y, unsigned int width, @@ -2009,7 +2005,7 @@ _cairo_pattern_acquire_surface_for_surface (const cairo_surface_pattern_t *pat is_bounded = _cairo_surface_get_extents (surface, &extents); assert (is_bounded); - status = _cairo_surface_clone_similar (dst, surface, content, + status = _cairo_surface_clone_similar (dst, surface, extents.x, extents.y, extents.width, extents.height, &extents.x, &extents.y, &src); @@ -2150,7 +2146,7 @@ _cairo_pattern_acquire_surface_for_surface (const cairo_surface_pattern_t *pat /* XXX can we use is_empty? */ - status = _cairo_surface_clone_similar (dst, surface, content, + status = _cairo_surface_clone_similar (dst, surface, extents.x, extents.y, extents.width, extents.height, &x, &y, out); @@ -2224,7 +2220,6 @@ _cairo_pattern_acquire_surface_for_surface (const cairo_surface_pattern_t *pat cairo_int_status_t _cairo_pattern_acquire_surface (const cairo_pattern_t *pattern, cairo_surface_t *dst, - cairo_content_t content, int x, int y, unsigned int width, @@ -2318,7 +2313,6 @@ _cairo_pattern_acquire_surface (const cairo_pattern_t *pattern, cairo_surface_pattern_t *src = (cairo_surface_pattern_t *) pattern; status = _cairo_pattern_acquire_surface_for_surface (src, dst, - content, x, y, width, height, flags, @@ -2353,7 +2347,6 @@ cairo_int_status_t _cairo_pattern_acquire_surfaces (const cairo_pattern_t *src, const cairo_pattern_t *mask, cairo_surface_t *dst, - cairo_content_t src_content, int src_x, int src_y, int mask_x, @@ -2391,14 +2384,13 @@ _cairo_pattern_acquire_surfaces (const cairo_pattern_t *src, _cairo_color_multiply_alpha (&combined, mask_solid->color.alpha); _cairo_pattern_init_solid (&src_tmp.solid, &combined, - (src_solid->content | mask_solid->content) & src_content); + src_solid->content | mask_solid->content); src = &src_tmp.base; mask = NULL; } status = _cairo_pattern_acquire_surface (src, dst, - src_content, src_x, src_y, width, height, flags, @@ -2412,7 +2404,6 @@ _cairo_pattern_acquire_surfaces (const cairo_pattern_t *src, } status = _cairo_pattern_acquire_surface (mask, dst, - CAIRO_CONTENT_ALPHA, mask_x, mask_y, width, height, flags, diff --git a/src/cairo-quartz-surface.c b/src/cairo-quartz-surface.c index cc4a8ae8..17de3b1d 100644 --- a/src/cairo-quartz-surface.c +++ b/src/cairo-quartz-surface.c @@ -1633,7 +1633,6 @@ _cairo_quartz_surface_create_similar (void *abstract_surface, static cairo_status_t _cairo_quartz_surface_clone_similar (void *abstract_surface, cairo_surface_t *src, - cairo_content_t content, int src_x, int src_y, int width, diff --git a/src/cairo-surface-fallback-private.h b/src/cairo-surface-fallback-private.h index 236b7459..c63c36e7 100644 --- a/src/cairo-surface-fallback-private.h +++ b/src/cairo-surface-fallback-private.h @@ -128,7 +128,6 @@ _cairo_surface_fallback_composite_trapezoids (cairo_operator_t op, cairo_private cairo_status_t _cairo_surface_fallback_clone_similar (cairo_surface_t *surface, cairo_surface_t *src, - cairo_content_t content, int src_x, int src_y, int width, diff --git a/src/cairo-surface-fallback.c b/src/cairo-surface-fallback.c index f1453b8a..15d2a63f 100644 --- a/src/cairo-surface-fallback.c +++ b/src/cairo-surface-fallback.c @@ -1835,7 +1835,6 @@ _cairo_surface_fallback_composite_trapezoids (cairo_operator_t op, cairo_status_t _cairo_surface_fallback_clone_similar (cairo_surface_t *surface, cairo_surface_t *src, - cairo_content_t content, int src_x, int src_y, int width, @@ -1849,7 +1848,7 @@ _cairo_surface_fallback_clone_similar (cairo_surface_t *surface, cairo_status_t status; new_surface = _cairo_surface_create_similar_scratch (surface, - src->content & content, + src->content, width, height); if (new_surface == NULL) return CAIRO_INT_STATUS_UNSUPPORTED; diff --git a/src/cairo-surface.c b/src/cairo-surface.c index ab84bbf8..51eb6f0a 100644 --- a/src/cairo-surface.c +++ b/src/cairo-surface.c @@ -1413,7 +1413,6 @@ _cairo_surface_release_dest_image (cairo_surface_t *surface, static cairo_status_t _cairo_meta_surface_clone_similar (cairo_surface_t *surface, cairo_surface_t *src, - cairo_content_t content, int src_x, int src_y, int width, @@ -1428,7 +1427,7 @@ _cairo_meta_surface_clone_similar (cairo_surface_t *surface, similar = _cairo_surface_has_snapshot (src, surface->backend, - src->content & content); + src->content); if (similar != NULL) { *clone_out = cairo_surface_reference (similar); *clone_offset_x = 0; @@ -1441,7 +1440,7 @@ _cairo_meta_surface_clone_similar (cairo_surface_t *surface, { /* XXX use _solid to perform an initial CLEAR? */ similar = _cairo_surface_create_similar_scratch (surface, - src->content & content, + src->content, width, height); if (similar == NULL) return CAIRO_INT_STATUS_UNSUPPORTED; @@ -1457,7 +1456,7 @@ _cairo_meta_surface_clone_similar (cairo_surface_t *surface, } } else { similar = _cairo_surface_create_similar_scratch (surface, - src->content & content, + src->content, meta->extents.width, meta->extents.height); if (similar == NULL) @@ -1510,7 +1509,6 @@ _cairo_meta_surface_clone_similar (cairo_surface_t *surface, cairo_status_t _cairo_surface_clone_similar (cairo_surface_t *surface, cairo_surface_t *src, - cairo_content_t content, int src_x, int src_y, int width, @@ -1534,14 +1532,13 @@ _cairo_surface_clone_similar (cairo_surface_t *surface, match = _cairo_tee_surface_find_match (src, surface->backend, - content); + src->content); if (match != NULL) src = match; } if (surface->backend->clone_similar != NULL) { status = surface->backend->clone_similar (surface, src, - content, src_x, src_y, width, height, clone_offset_x, @@ -1554,7 +1551,6 @@ _cairo_surface_clone_similar (cairo_surface_t *surface, /* First check to see if we can replay to a similar surface */ if (_cairo_surface_is_meta (src)) { return _cairo_meta_surface_clone_similar (surface, src, - content, src_x, src_y, width, height, clone_offset_x, @@ -1567,7 +1563,6 @@ _cairo_surface_clone_similar (cairo_surface_t *surface, if (status == CAIRO_STATUS_SUCCESS) { status = surface->backend->clone_similar (surface, &image->base, - content, src_x, src_y, width, height, clone_offset_x, @@ -1583,7 +1578,6 @@ _cairo_surface_clone_similar (cairo_surface_t *surface, if (status == CAIRO_INT_STATUS_UNSUPPORTED) { status = _cairo_surface_fallback_clone_similar (surface, src, - content, src_x, src_y, width, height, clone_offset_x, diff --git a/src/cairo-xlib-surface.c b/src/cairo-xlib-surface.c index 81f2ec34..994a4f9d 100644 --- a/src/cairo-xlib-surface.c +++ b/src/cairo-xlib-surface.c @@ -1317,7 +1317,6 @@ _cairo_xlib_surface_same_screen (cairo_xlib_surface_t *dst, static cairo_status_t _cairo_xlib_surface_clone_similar (void *abstract_surface, cairo_surface_t *src, - cairo_content_t content, int src_x, int src_y, int width, @@ -1350,7 +1349,7 @@ _cairo_xlib_surface_clone_similar (void *abstract_surface, clone = (cairo_xlib_surface_t *) _cairo_xlib_surface_create_similar (surface, - image_src->base.content & content, + image_src->base.content, width, height); if (clone == NULL) return UNSUPPORTED ("unhandled image format, no similar surface"); @@ -1878,7 +1877,6 @@ _render_operator (cairo_operator_t op) static cairo_int_status_t _cairo_xlib_surface_acquire_pattern_surface (cairo_xlib_surface_t *dst, const cairo_pattern_t *pattern, - cairo_content_t content, int x, int y, int width, int height, cairo_xlib_surface_t **surface_out, @@ -2046,7 +2044,6 @@ _cairo_xlib_surface_acquire_pattern_surface (cairo_xlib_surface_t *dst, } return _cairo_pattern_acquire_surface (pattern, &dst->base, - content, x, y, width, height, dst->buggy_pad_reflect ? CAIRO_PATTERN_ACQUIRE_NO_REFLECT : @@ -2059,7 +2056,6 @@ static cairo_int_status_t _cairo_xlib_surface_acquire_pattern_surfaces (cairo_xlib_surface_t *dst, const cairo_pattern_t *src, const cairo_pattern_t *mask, - cairo_content_t src_content, int src_x, int src_y, int mask_x, @@ -2080,7 +2076,6 @@ _cairo_xlib_surface_acquire_pattern_surfaces (cairo_xlib_surface_t *dst, cairo_int_status_t status; status = _cairo_xlib_surface_acquire_pattern_surface (dst, src, - src_content, src_x, src_y, width, height, src_out, @@ -2090,7 +2085,6 @@ _cairo_xlib_surface_acquire_pattern_surfaces (cairo_xlib_surface_t *dst, if (mask) { status = _cairo_xlib_surface_acquire_pattern_surface (dst, mask, - CAIRO_CONTENT_ALPHA, mask_x, mask_y, width, @@ -2111,7 +2105,6 @@ _cairo_xlib_surface_acquire_pattern_surfaces (cairo_xlib_surface_t *dst, return _cairo_pattern_acquire_surfaces (src, mask, &dst->base, - src_content, src_x, src_y, mask_x, mask_y, width, height, @@ -2147,7 +2140,6 @@ _cairo_xlib_surface_composite (cairo_operator_t op, int itx, ity; cairo_bool_t is_integer_translation; cairo_bool_t needs_alpha_composite; - cairo_content_t src_content; GC gc; if (mask_pattern != NULL && ! CAIRO_SURFACE_RENDER_HAS_COMPOSITE (dst)) @@ -2164,16 +2156,12 @@ _cairo_xlib_surface_composite (cairo_operator_t op, _operator_needs_alpha_composite (op, _surface_has_alpha (dst), ! _cairo_pattern_is_opaque (src_pattern)); - src_content = CAIRO_CONTENT_COLOR_ALPHA; - if (! needs_alpha_composite) - src_content &= ~CAIRO_CONTENT_ALPHA; _cairo_xlib_display_notify (dst->display); status = _cairo_xlib_surface_acquire_pattern_surfaces (dst, src_pattern, mask_pattern, - src_content, src_x, src_y, mask_x, mask_y, width, height, @@ -2371,7 +2359,6 @@ _cairo_xlib_surface_solid_fill_rectangles (cairo_xlib_surface_t *surface, X_DEBUG ((surface->dpy, "solid_fill_rectangles (dst=%x)", (unsigned int) surface->drawable)); status = _cairo_pattern_acquire_surface (&solid.base, &surface->base, - CAIRO_CONTENT_COLOR_ALPHA, 0, 0, ARRAY_LENGTH (dither_pattern[0]), ARRAY_LENGTH (dither_pattern), @@ -2562,7 +2549,6 @@ _cairo_xlib_surface_composite_trapezoids (cairo_operator_t op, status = _cairo_xlib_surface_acquire_pattern_surface (dst, pattern, - CAIRO_CONTENT_COLOR_ALPHA, src_x, src_y, width, height, &src, &attributes); @@ -4462,7 +4448,6 @@ _cairo_xlib_surface_show_glyphs (void *abstract_dst, if (src_pattern->type == CAIRO_PATTERN_TYPE_SOLID) { status = _cairo_pattern_acquire_surface (src_pattern, &dst->base, - CAIRO_CONTENT_COLOR_ALPHA, 0, 0, 1, 1, CAIRO_PATTERN_ACQUIRE_NONE, (cairo_surface_t **) &src, @@ -4489,7 +4474,6 @@ _cairo_xlib_surface_show_glyphs (void *abstract_dst, } status = _cairo_xlib_surface_acquire_pattern_surface (dst, src_pattern, - dst->base.content, glyph_extents.x, glyph_extents.y, glyph_extents.width, diff --git a/src/cairoint.h b/src/cairoint.h index ccf790a3..b9139138 100644 --- a/src/cairoint.h +++ b/src/cairoint.h @@ -622,7 +622,6 @@ struct _cairo_surface_backend { cairo_warn cairo_status_t (*clone_similar) (void *surface, cairo_surface_t *src, - cairo_content_t content, int src_x, int src_y, int width, @@ -2072,7 +2071,6 @@ _cairo_surface_release_dest_image (cairo_surface_t *surface, cairo_private cairo_status_t _cairo_surface_clone_similar (cairo_surface_t *surface, cairo_surface_t *src, - cairo_content_t content, int src_x, int src_y, int width, @@ -2569,7 +2567,6 @@ enum { cairo_private cairo_int_status_t _cairo_pattern_acquire_surface (const cairo_pattern_t *pattern, cairo_surface_t *dst, - cairo_content_t content, int x, int y, unsigned int width, @@ -2587,7 +2584,6 @@ cairo_private cairo_int_status_t _cairo_pattern_acquire_surfaces (const cairo_pattern_t *src, const cairo_pattern_t *mask, cairo_surface_t *dst, - cairo_content_t src_content, int src_x, int src_y, int mask_x, diff --git a/src/test-fallback-surface.c b/src/test-fallback-surface.c index f331cf25..3b62e55b 100644 --- a/src/test-fallback-surface.c +++ b/src/test-fallback-surface.c @@ -172,7 +172,6 @@ _test_fallback_surface_release_dest_image (void *abstract_surface, static cairo_status_t _test_fallback_surface_clone_similar (void *abstract_surface, cairo_surface_t *src, - cairo_content_t content, int src_x, int src_y, int width, diff --git a/src/test-fallback16-surface.c b/src/test-fallback16-surface.c index 5f6bee4a..91699efc 100644 --- a/src/test-fallback16-surface.c +++ b/src/test-fallback16-surface.c @@ -166,7 +166,6 @@ _test_fallback16_surface_release_dest_image (void *abstract_surface, static cairo_status_t _test_fallback16_surface_clone_similar (void *abstract_surface, cairo_surface_t *src, - cairo_content_t content, int src_x, int src_y, int width, @@ -185,7 +184,6 @@ _test_fallback16_surface_clone_similar (void *abstract_surface, return CAIRO_STATUS_SUCCESS; } else { return _cairo_surface_clone_similar (surface->backing, src, - content, src_x, src_y, width, height, clone_offset_x, clone_offset_y, |