[cairo-commit] 11 commits - configure.ac src/cairo-directfb-surface.c src/cairo-egl-context.c src/cairo-gl.h src/cairo-gl-private.h src/cairo-gl-surface.c src/cairo-glx-context.c src/cairo-image-surface.c src/cairo-pattern.c src/cairo-surface-snapshot.c src/cairo-surface-subsurface.c src/cairo-xcb-surface-render.c src/cairo-xlib-surface.c src/drm
Benjamin Otte
company at kemper.freedesktop.org
Thu Apr 15 09:41:33 PDT 2010
configure.ac | 2
src/cairo-directfb-surface.c | 16 -
src/cairo-egl-context.c | 2
src/cairo-gl-private.h | 5
src/cairo-gl-surface.c | 87 +++++--
src/cairo-gl.h | 6
src/cairo-glx-context.c | 67 +++++
src/cairo-image-surface.c | 463 +++++++++++++++++++----------------------
src/cairo-pattern.c | 16 -
src/cairo-surface-snapshot.c | 12 -
src/cairo-surface-subsurface.c | 24 +-
src/cairo-xcb-surface-render.c | 46 +---
src/cairo-xlib-surface.c | 62 ++---
src/drm/cairo-drm-intel.c | 12 -
14 files changed, 444 insertions(+), 376 deletions(-)
New commits:
commit 2bffa2467ed67517419e425fc34fb5b8294a9e96
Author: Benjamin Otte <otte at redhat.com>
Date: Wed Jan 27 10:56:22 2010 +0100
Use pixman_image_composite32()
Replace all occurences of pixman_image_composite()
diff --git a/src/cairo-directfb-surface.c b/src/cairo-directfb-surface.c
index e3ee366..26de0df 100644
--- a/src/cairo-directfb-surface.c
+++ b/src/cairo-directfb-surface.c
@@ -764,14 +764,14 @@ _cairo_directfb_surface_clone_similar (void *abstract_surface,
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
}
- pixman_image_composite (PIXMAN_OP_SRC,
- image_src->pixman_image,
- NULL,
- pixman_image,
- src_x, src_y,
- 0, 0,
- 0, 0,
- width, height);
+ pixman_image_composite32 (PIXMAN_OP_SRC,
+ image_src->pixman_image,
+ NULL,
+ pixman_image,
+ src_x, src_y,
+ 0, 0,
+ 0, 0,
+ width, height);
pixman_image_unref (pixman_image);
diff --git a/src/cairo-image-surface.c b/src/cairo-image-surface.c
index 9921c0f..7538826 100644
--- a/src/cairo-image-surface.c
+++ b/src/cairo-image-surface.c
@@ -1561,12 +1561,12 @@ _cairo_image_surface_fixup_unbounded (cairo_image_surface_t *dst,
if (mask != NULL) {
for (i = 0; i < n_boxes; i++) {
- pixman_image_composite (PIXMAN_OP_OUT_REVERSE,
- mask, NULL, dst->pixman_image,
- boxes[i].x1 + mask_x, boxes[i].y1 + mask_y,
- 0, 0,
- boxes[i].x1, boxes[i].y1,
- boxes[i].x2 - boxes[i].x1, boxes[i].y2 - boxes[i].y1);
+ pixman_image_composite32 (PIXMAN_OP_OUT_REVERSE,
+ mask, NULL, dst->pixman_image,
+ boxes[i].x1 + mask_x, boxes[i].y1 + mask_y,
+ 0, 0,
+ boxes[i].x1, boxes[i].y1,
+ boxes[i].x2 - boxes[i].x1, boxes[i].y2 - boxes[i].y1);
}
} else {
pixman_color_t color = { 0, };
@@ -1793,11 +1793,11 @@ _clip_and_composite_with_mask (cairo_clip_t *clip,
if (pattern == NULL) {
if (dst->pixman_format == PIXMAN_a8) {
- pixman_image_composite (_pixman_operator (op),
- mask, NULL, dst->pixman_image,
- 0, 0, 0, 0,
- extents->x, extents->y,
- extents->width, extents->height);
+ pixman_image_composite32 (_pixman_operator (op),
+ mask, NULL, dst->pixman_image,
+ 0, 0, 0, 0,
+ extents->x, extents->y,
+ extents->width, extents->height);
} else {
pixman_image_t *src;
@@ -1807,11 +1807,11 @@ _clip_and_composite_with_mask (cairo_clip_t *clip,
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
}
- pixman_image_composite (_pixman_operator (op),
- src, mask, dst->pixman_image,
- 0, 0, 0, 0,
- extents->x, extents->y,
- extents->width, extents->height);
+ pixman_image_composite32 (_pixman_operator (op),
+ src, mask, dst->pixman_image,
+ 0, 0, 0, 0,
+ extents->x, extents->y,
+ extents->width, extents->height);
pixman_image_unref (src);
}
} else {
@@ -1824,12 +1824,12 @@ _clip_and_composite_with_mask (cairo_clip_t *clip,
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
}
- pixman_image_composite (_pixman_operator (op),
- src, mask, dst->pixman_image,
- extents->x + src_x, extents->y + src_y,
- 0, 0,
- extents->x, extents->y,
- extents->width, extents->height);
+ pixman_image_composite32 (_pixman_operator (op),
+ src, mask, dst->pixman_image,
+ extents->x + src_x, extents->y + src_y,
+ 0, 0,
+ extents->x, extents->y,
+ extents->width, extents->height);
pixman_image_unref (src);
}
@@ -1869,12 +1869,12 @@ _clip_and_composite_combine (cairo_clip_t *clip,
} else {
/* Initialize the temporary surface from the destination surface */
if (! dst->base.is_clear) {
- pixman_image_composite (PIXMAN_OP_SRC,
- dst->pixman_image, NULL, tmp,
- extents->x, extents->y,
- 0, 0,
- 0, 0,
- extents->width, extents->height);
+ pixman_image_composite32 (PIXMAN_OP_SRC,
+ dst->pixman_image, NULL, tmp,
+ extents->x, extents->y,
+ 0, 0,
+ 0, 0,
+ extents->width, extents->height);
}
status = (*draw_func) (draw_closure,
@@ -1893,47 +1893,47 @@ _clip_and_composite_combine (cairo_clip_t *clip,
if (! dst->base.is_clear) {
#if PIXMAN_HAS_OP_LERP
- pixman_image_composite (PIXMAN_OP_LERP,
- tmp,
- ((cairo_image_surface_t *) clip_surface)->pixman_image,
- dst->pixman_image,
- 0, 0,
- extents->x - clip->path->extents.x,
- extents->y - clip->path->extents.y,
- extents->x, extents->y,
- extents->width, extents->height);
+ pixman_image_composite32 (PIXMAN_OP_LERP,
+ tmp,
+ ((cairo_image_surface_t *) clip_surface)->pixman_image,
+ dst->pixman_image,
+ 0, 0,
+ extents->x - clip->path->extents.x,
+ extents->y - clip->path->extents.y,
+ extents->x, extents->y,
+ extents->width, extents->height);
#else
/* Punch the clip out of the destination */
- pixman_image_composite (PIXMAN_OP_OUT_REVERSE,
- ((cairo_image_surface_t *) clip_surface)->pixman_image,
- NULL, dst->pixman_image,
- extents->x - clip->path->extents.x,
- extents->y - clip->path->extents.y,
- 0, 0,
- extents->x, extents->y,
- extents->width, extents->height);
+ pixman_image_composite32 (PIXMAN_OP_OUT_REVERSE,
+ ((cairo_image_surface_t *) clip_surface)->pixman_image,
+ NULL, dst->pixman_image,
+ extents->x - clip->path->extents.x,
+ extents->y - clip->path->extents.y,
+ 0, 0,
+ extents->x, extents->y,
+ extents->width, extents->height);
/* Now add the two results together */
- pixman_image_composite (PIXMAN_OP_ADD,
- tmp,
- ((cairo_image_surface_t *) clip_surface)->pixman_image,
- dst->pixman_image,
- 0, 0,
- extents->x - clip->path->extents.x,
- extents->y - clip->path->extents.y,
- extents->x, extents->y,
- extents->width, extents->height);
+ pixman_image_composite32 (PIXMAN_OP_ADD,
+ tmp,
+ ((cairo_image_surface_t *) clip_surface)->pixman_image,
+ dst->pixman_image,
+ 0, 0,
+ extents->x - clip->path->extents.x,
+ extents->y - clip->path->extents.y,
+ extents->x, extents->y,
+ extents->width, extents->height);
#endif
} else {
- pixman_image_composite (PIXMAN_OP_SRC,
- tmp,
- ((cairo_image_surface_t *) clip_surface)->pixman_image,
- dst->pixman_image,
- 0, 0,
- extents->x - clip->path->extents.x,
- extents->y - clip->path->extents.y,
- extents->x, extents->y,
- extents->width, extents->height);
+ pixman_image_composite32 (PIXMAN_OP_SRC,
+ tmp,
+ ((cairo_image_surface_t *) clip_surface)->pixman_image,
+ dst->pixman_image,
+ 0, 0,
+ extents->x - clip->path->extents.x,
+ extents->y - clip->path->extents.y,
+ extents->x, extents->y,
+ extents->width, extents->height);
}
CLEANUP_SURFACE:
@@ -1987,35 +1987,35 @@ _clip_and_composite_source (cairo_clip_t *clip,
if (! dst->base.is_clear) {
#if PIXMAN_HAS_OP_LERP
- pixman_image_composite (PIXMAN_OP_LERP,
- src, mask, dst->pixman_image,
- extents->x + src_x, extents->y + src_y,
- 0, 0,
- extents->x, extents->y,
- extents->width, extents->height);
+ pixman_image_composite32 (PIXMAN_OP_LERP,
+ src, mask, dst->pixman_image,
+ extents->x + src_x, extents->y + src_y,
+ 0, 0,
+ extents->x, extents->y,
+ extents->width, extents->height);
#else
/* Compute dest' = dest OUT (mask IN clip) */
- pixman_image_composite (PIXMAN_OP_OUT_REVERSE,
- mask, NULL, dst->pixman_image,
- 0, 0, 0, 0,
- extents->x, extents->y,
- extents->width, extents->height);
+ pixman_image_composite32 (PIXMAN_OP_OUT_REVERSE,
+ mask, NULL, dst->pixman_image,
+ 0, 0, 0, 0,
+ extents->x, extents->y,
+ extents->width, extents->height);
/* Now compute (src IN (mask IN clip)) ADD dest' */
- pixman_image_composite (PIXMAN_OP_ADD,
- src, mask, dst->pixman_image,
- extents->x + src_x, extents->y + src_y,
- 0, 0,
- extents->x, extents->y,
- extents->width, extents->height);
+ pixman_image_composite32 (PIXMAN_OP_ADD,
+ src, mask, dst->pixman_image,
+ extents->x + src_x, extents->y + src_y,
+ 0, 0,
+ extents->x, extents->y,
+ extents->width, extents->height);
#endif
} else {
- pixman_image_composite (PIXMAN_OP_SRC,
- src, mask, dst->pixman_image,
- extents->x + src_x, extents->y + src_y,
- 0, 0,
- extents->x, extents->y,
- extents->width, extents->height);
+ pixman_image_composite32 (PIXMAN_OP_SRC,
+ src, mask, dst->pixman_image,
+ extents->x + src_x, extents->y + src_y,
+ 0, 0,
+ extents->x, extents->y,
+ extents->width, extents->height);
}
pixman_image_unref (src);
@@ -2253,12 +2253,12 @@ _composite_traps (void *closure,
}
_pixman_image_add_traps (mask, extents->x, extents->y, info);
- pixman_image_composite (_pixman_operator (op),
- src, mask, dst,
- extents->x + src_x, extents->y + src_y,
- 0, 0,
- extents->x - dst_x, extents->y - dst_y,
- extents->width, extents->height);
+ pixman_image_composite32 (_pixman_operator (op),
+ src, mask, dst,
+ extents->x + src_x, extents->y + src_y,
+ 0, 0,
+ extents->x - dst_x, extents->y - dst_y,
+ extents->width, extents->height);
pixman_image_unref (mask);
@@ -2389,11 +2389,11 @@ _fill_span (void *abstract_renderer,
}
do {
- pixman_image_composite (PIXMAN_OP_OVER,
- renderer->src, renderer->mask, renderer->dst,
- 0, 0, 0, 0,
- spans[0].x, y++,
- spans[i].x - spans[0].x, 1);
+ pixman_image_composite32 (PIXMAN_OP_OVER,
+ renderer->src, renderer->mask, renderer->dst,
+ 0, 0, 0, 0,
+ spans[0].x, y++,
+ spans[i].x - spans[0].x, 1);
} while (--height);
return CAIRO_STATUS_SUCCESS;
@@ -2648,12 +2648,12 @@ _composite_unaligned_boxes (cairo_image_surface_t *dst,
goto CLEANUP;
}
- pixman_image_composite (_pixman_operator (op),
- src, mask, dst->pixman_image,
- extents->bounded.x + src_x, extents->bounded.y + src_y,
- 0, 0,
- extents->bounded.x, extents->bounded.y,
- extents->bounded.width, extents->bounded.height);
+ pixman_image_composite32 (_pixman_operator (op),
+ src, mask, dst->pixman_image,
+ extents->bounded.x + src_x, extents->bounded.y + src_y,
+ 0, 0,
+ extents->bounded.x, extents->bounded.y,
+ extents->bounded.width, extents->bounded.height);
pixman_image_unref (src);
CLEANUP:
@@ -2780,12 +2780,12 @@ _composite_boxes (cairo_image_surface_t *dst,
if (x2 == x1 || y2 == y1)
continue;
- pixman_image_composite (pixman_op,
- src, mask, dst->pixman_image,
- x1 + src_x, y1 + src_y,
- x1 + mask_x, y1 + mask_y,
- x1, y1,
- x2 - x1, y2 - y1);
+ pixman_image_composite32 (pixman_op,
+ src, mask, dst->pixman_image,
+ x1 + src_x, y1 + src_y,
+ x1 + mask_x, y1 + mask_y,
+ x1, y1,
+ x2 - x1, y2 - y1);
}
}
@@ -3102,11 +3102,11 @@ _composite_mask (void *closure,
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
}
- pixman_image_composite (_pixman_operator (op), src, mask, dst,
- extents->x + src_x, extents->y + src_y,
- extents->x + mask_x, extents->y + mask_y,
- extents->x - dst_x, extents->y - dst_y,
- extents->width, extents->height);
+ pixman_image_composite32 (_pixman_operator (op), src, mask, dst,
+ extents->x + src_x, extents->y + src_y,
+ extents->x + mask_x, extents->y + mask_y,
+ extents->x - dst_x, extents->y - dst_y,
+ extents->width, extents->height);
if (mask != NULL)
pixman_image_unref (mask);
@@ -3257,11 +3257,11 @@ _composite_spans (void *closure,
goto CLEANUP_RENDERER;
}
- pixman_image_composite (_pixman_operator (op), src, mask, dst,
- extents->x + src_x, extents->y + src_y,
- 0, 0, /* mask.x, mask.y */
- extents->x - dst_x, extents->y - dst_y,
- extents->width, extents->height);
+ pixman_image_composite32 (_pixman_operator (op), src, mask, dst,
+ extents->x + src_x, extents->y + src_y,
+ 0, 0, /* mask.x, mask.y */
+ extents->x - dst_x, extents->y - dst_y,
+ extents->width, extents->height);
pixman_image_unref (src);
}
@@ -3619,10 +3619,10 @@ _composite_glyphs_via_mask (void *closure,
goto CLEANUP;
}
- pixman_image_composite (PIXMAN_OP_SRC,
- white, mask, new_mask,
- 0, 0, 0, 0, 0, 0,
- extents->width, extents->height);
+ pixman_image_composite32 (PIXMAN_OP_SRC,
+ white, mask, new_mask,
+ 0, 0, 0, 0, 0, 0,
+ extents->width, extents->height);
pixman_image_unref (mask);
mask = new_mask;
@@ -3637,28 +3637,28 @@ _composite_glyphs_via_mask (void *closure,
y = _cairo_lround (glyphs[i].y -
glyph_surface->base.device_transform.y0);
if (glyph_surface->pixman_format == mask_format) {
- pixman_image_composite (PIXMAN_OP_ADD,
- glyph_surface->pixman_image, NULL, mask,
- 0, 0, 0, 0,
- x - extents->x, y - extents->y,
- glyph_surface->width,
- glyph_surface->height);
+ pixman_image_composite32 (PIXMAN_OP_ADD,
+ glyph_surface->pixman_image, NULL, mask,
+ 0, 0, 0, 0,
+ x - extents->x, y - extents->y,
+ glyph_surface->width,
+ glyph_surface->height);
} else {
- pixman_image_composite (PIXMAN_OP_ADD,
- white, glyph_surface->pixman_image, mask,
- 0, 0, 0, 0,
- x - extents->x, y - extents->y,
- glyph_surface->width,
- glyph_surface->height);
+ pixman_image_composite32 (PIXMAN_OP_ADD,
+ white, glyph_surface->pixman_image, mask,
+ 0, 0, 0, 0,
+ x - extents->x, y - extents->y,
+ glyph_surface->width,
+ glyph_surface->height);
}
}
- pixman_image_composite (_pixman_operator (op),
- src, mask, dst,
- extents->x + src_x, extents->y + src_y,
- 0, 0,
- extents->x - dst_x, extents->y - dst_y,
- extents->width, extents->height);
+ pixman_image_composite32 (_pixman_operator (op),
+ src, mask, dst,
+ extents->x + src_x, extents->y + src_y,
+ 0, 0,
+ extents->x - dst_x, extents->y - dst_y,
+ extents->width, extents->height);
CLEANUP:
_cairo_scaled_font_thaw_cache (font);
@@ -3734,13 +3734,13 @@ _composite_glyphs (void *closure,
y = _cairo_lround (info->glyphs[i].y -
glyph_surface->base.device_transform.y0);
- pixman_image_composite (pixman_op,
- src, glyph_surface->pixman_image, dst,
- x + src_x, y + src_y,
- 0, 0,
- x - dst_x, y - dst_y,
- glyph_surface->width,
- glyph_surface->height);
+ pixman_image_composite32 (pixman_op,
+ src, glyph_surface->pixman_image, dst,
+ x + src_x, y + src_y,
+ 0, 0,
+ x - dst_x, y - dst_y,
+ glyph_surface->width,
+ glyph_surface->height);
}
}
_cairo_scaled_font_thaw_cache (info->font);
@@ -3954,22 +3954,22 @@ _cairo_image_surface_composite (cairo_operator_t op,
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
}
- pixman_image_composite (_pixman_operator (op),
- src, mask, dst->pixman_image,
- src_x + src_offset_x,
- src_y + src_offset_y,
- mask_x + mask_offset_x,
- mask_y + mask_offset_y,
- dst_x, dst_y, width, height);
+ pixman_image_composite32 (_pixman_operator (op),
+ src, mask, dst->pixman_image,
+ src_x + src_offset_x,
+ src_y + src_offset_y,
+ mask_x + mask_offset_x,
+ mask_y + mask_offset_y,
+ dst_x, dst_y, width, height);
pixman_image_unref (mask);
} else {
- pixman_image_composite (_pixman_operator (op),
- src, NULL, dst->pixman_image,
- src_x + src_offset_x,
- src_y + src_offset_y,
- 0, 0,
- dst_x, dst_y, width, height);
+ pixman_image_composite32 (_pixman_operator (op),
+ src, NULL, dst->pixman_image,
+ src_x + src_offset_x,
+ src_y + src_offset_y,
+ 0, 0,
+ dst_x, dst_y, width, height);
}
pixman_image_unref (src);
@@ -4217,15 +4217,15 @@ _cairo_image_surface_span_renderer_finish (void *abstract_renderer)
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
- pixman_image_composite (_pixman_operator (renderer->op),
- src,
- renderer->mask,
- dst->pixman_image,
- rects->bounded.x + src_x,
- rects->bounded.y + src_y,
- 0, 0,
- rects->bounded.x, rects->bounded.y,
- rects->bounded.width, rects->bounded.height);
+ pixman_image_composite32 (_pixman_operator (renderer->op),
+ src,
+ renderer->mask,
+ dst->pixman_image,
+ rects->bounded.x + src_x,
+ rects->bounded.y + src_y,
+ 0, 0,
+ rects->bounded.x, rects->bounded.y,
+ rects->bounded.width, rects->bounded.height);
if (! rects->is_bounded)
_cairo_image_surface_fixup_unbounded (dst, rects, NULL);
@@ -4372,12 +4372,12 @@ _cairo_image_surface_coerce_to_format (cairo_image_surface_t *surface,
if (unlikely (clone->base.status))
return clone;
- pixman_image_composite (PIXMAN_OP_SRC,
- surface->pixman_image, NULL, clone->pixman_image,
- 0, 0,
- 0, 0,
- 0, 0,
- surface->width, surface->height);
+ pixman_image_composite32 (PIXMAN_OP_SRC,
+ surface->pixman_image, NULL, clone->pixman_image,
+ 0, 0,
+ 0, 0,
+ 0, 0,
+ surface->width, surface->height);
clone->base.is_clear = FALSE;
clone->base.device_transform =
diff --git a/src/cairo-pattern.c b/src/cairo-pattern.c
index 8ae4b81..7a9bf67 100644
--- a/src/cairo-pattern.c
+++ b/src/cairo-pattern.c
@@ -1530,14 +1530,14 @@ _cairo_pattern_acquire_surface_for_gradient (const cairo_gradient_pattern_t *pat
break;
}
- pixman_image_composite (PIXMAN_OP_SRC,
- pixman_image,
- NULL,
- image->pixman_image,
- x, y,
- 0, 0,
- 0, 0,
- width, height);
+ pixman_image_composite32 (PIXMAN_OP_SRC,
+ pixman_image,
+ NULL,
+ image->pixman_image,
+ x, y,
+ 0, 0,
+ 0, 0,
+ width, height);
pixman_image_unref (pixman_image);
diff --git a/src/cairo-surface-snapshot.c b/src/cairo-surface-snapshot.c
index 629b800..745bc58 100644
--- a/src/cairo-surface-snapshot.c
+++ b/src/cairo-surface-snapshot.c
@@ -131,12 +131,12 @@ _cairo_surface_snapshot_copy_on_write (cairo_surface_t *surface)
image->height,
0);
if (likely (clone->base.status == CAIRO_STATUS_SUCCESS)) {
- pixman_image_composite (PIXMAN_OP_SRC,
- image->pixman_image, NULL, clone->pixman_image,
- 0, 0,
- 0, 0,
- 0, 0,
- image->width, image->height);
+ pixman_image_composite32 (PIXMAN_OP_SRC,
+ image->pixman_image, NULL, clone->pixman_image,
+ 0, 0,
+ 0, 0,
+ 0, 0,
+ image->width, image->height);
clone->base.is_clear = FALSE;
snapshot->clone = &clone->base;
diff --git a/src/cairo-surface-subsurface.c b/src/cairo-surface-subsurface.c
index 34e0a60..a4b345b 100644
--- a/src/cairo-surface-subsurface.c
+++ b/src/cairo-surface-subsurface.c
@@ -317,12 +317,12 @@ _cairo_surface_subsurface_acquire_source_image (void *abstrac
if (unlikely ((status = image->base.status)))
goto CLEANUP_IMAGE;
- pixman_image_composite (PIXMAN_OP_SRC,
- image->pixman_image, NULL, extra->image->pixman_image,
- surface->extents.x, surface->extents.y,
- 0, 0,
- 0, 0,
- surface->extents.width, surface->extents.height);
+ pixman_image_composite32 (PIXMAN_OP_SRC,
+ image->pixman_image, NULL, extra->image->pixman_image,
+ surface->extents.x, surface->extents.y,
+ 0, 0,
+ 0, 0,
+ surface->extents.width, surface->extents.height);
}
*image_out = image;
@@ -375,12 +375,12 @@ _cairo_surface_subsurface_snapshot (void *abstract_surface)
if (unlikely (clone->base.status))
return &clone->base;
- pixman_image_composite (PIXMAN_OP_SRC,
- image->pixman_image, NULL, clone->pixman_image,
- surface->extents.x, surface->extents.y,
- 0, 0,
- 0, 0,
- surface->extents.width, surface->extents.height);
+ pixman_image_composite32 (PIXMAN_OP_SRC,
+ image->pixman_image, NULL, clone->pixman_image,
+ surface->extents.x, surface->extents.y,
+ 0, 0,
+ 0, 0,
+ surface->extents.width, surface->extents.height);
_cairo_surface_release_source_image (surface->target, image, image_extra);
diff --git a/src/cairo-xlib-surface.c b/src/cairo-xlib-surface.c
index bd18e18..51c0f83 100644
--- a/src/cairo-xlib-surface.c
+++ b/src/cairo-xlib-surface.c
@@ -1052,14 +1052,14 @@ _draw_image_surface (cairo_xlib_surface_t *surface,
if (pixman_image == NULL)
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
- pixman_image_composite (PIXMAN_OP_SRC,
- image->pixman_image,
- NULL,
- pixman_image,
- 0, 0,
- 0, 0,
- 0, 0,
- image->width, image->height);
+ pixman_image_composite32 (PIXMAN_OP_SRC,
+ image->pixman_image,
+ NULL,
+ pixman_image,
+ 0, 0,
+ 0, 0,
+ 0, 0,
+ image->width, image->height);
ximage.bits_per_pixel = image_masks.bpp;
ximage.data = (char *) pixman_image_get_data (pixman_image);
diff --git a/src/drm/cairo-drm-intel.c b/src/drm/cairo-drm-intel.c
index 351b597..2549e13 100644
--- a/src/drm/cairo-drm-intel.c
+++ b/src/drm/cairo-drm-intel.c
@@ -1461,12 +1461,12 @@ intel_gradient_render (intel_device_t *device,
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
}
- pixman_image_composite (PIXMAN_OP_SRC,
- gradient, NULL, image,
- 0, 0,
- 0, 0,
- 0, 0,
- width, 1);
+ pixman_image_composite32 (PIXMAN_OP_SRC,
+ gradient, NULL, image,
+ 0, 0,
+ 0, 0,
+ 0, 0,
+ width, 1);
pixman_image_unref (gradient);
commit 567923d66a375259a6a8083aa4ef1051097a60c5
Author: Benjamin Otte <otte at redhat.com>
Date: Wed Jan 27 09:39:20 2010 +0100
image: Make unbounded fixup code not use pixman_fill()
The new pixman_image_fill_boxes() does proper fallbacks for weird pixman
formats.
diff --git a/src/cairo-image-surface.c b/src/cairo-image-surface.c
index 9b23800..9921c0f 100644
--- a/src/cairo-image-surface.c
+++ b/src/cairo-image-surface.c
@@ -1476,7 +1476,8 @@ _cairo_image_surface_fixup_unbounded (cairo_image_surface_t *dst,
cairo_clip_t *clip)
{
pixman_image_t *mask = NULL;
- int mask_x = 0, mask_y = 0;
+ pixman_box32_t boxes[4];
+ int i, mask_x = 0, mask_y = 0, n_boxes = 0;
if (clip != NULL) {
cairo_surface_t *clip_surface;
@@ -1510,10 +1511,13 @@ _cairo_image_surface_fixup_unbounded (cairo_image_surface_t *dst,
x, y,
width, height);
} else {
- pixman_fill ((uint32_t *) dst->data, dst->stride / sizeof (uint32_t),
- PIXMAN_FORMAT_BPP (dst->pixman_format),
- x, y, width, height,
- 0);
+ pixman_color_t color = { 0, };
+ pixman_box32_t box = { x, y, width, height };
+
+ pixman_image_fill_boxes (PIXMAN_OP_CLEAR,
+ dst->pixman_image,
+ &color,
+ 1, &box);
}
return;
@@ -1521,90 +1525,57 @@ _cairo_image_surface_fixup_unbounded (cairo_image_surface_t *dst,
/* top */
if (rects->bounded.y != rects->unbounded.y) {
- int x = rects->unbounded.x;
- int y = rects->unbounded.y;
- int width = rects->unbounded.width;
- int height = rects->bounded.y - y;
-
- if (mask != NULL) {
- pixman_image_composite (PIXMAN_OP_OUT_REVERSE,
- mask, NULL, dst->pixman_image,
- x + mask_x, y + mask_y,
- 0, 0,
- x, y,
- width, height);
- } else {
- pixman_fill ((uint32_t *) dst->data, dst->stride / sizeof (uint32_t),
- PIXMAN_FORMAT_BPP (dst->pixman_format),
- x, y, width, height,
- 0);
- }
+ boxes[n_boxes].x1 = rects->unbounded.x;
+ boxes[n_boxes].y1 = rects->unbounded.y;
+ boxes[n_boxes].x2 = rects->unbounded.x + rects->unbounded.width;
+ boxes[n_boxes].y2 = rects->bounded.y;
+ n_boxes++;
}
/* left */
if (rects->bounded.x != rects->unbounded.x) {
- int x = rects->unbounded.x;
- int y = rects->bounded.y;
- int width = rects->bounded.x - rects->unbounded.x;
- int height = rects->bounded.height;
-
- if (mask != NULL) {
- pixman_image_composite (PIXMAN_OP_OUT_REVERSE,
- mask, NULL, dst->pixman_image,
- x + mask_x, y + mask_y,
- 0, 0,
- x, y,
- width, height);
- } else {
- pixman_fill ((uint32_t *) dst->data, dst->stride / sizeof (uint32_t),
- PIXMAN_FORMAT_BPP (dst->pixman_format),
- x, y, width, height,
- 0);
- }
+ boxes[n_boxes].x1 = rects->unbounded.x;
+ boxes[n_boxes].y1 = rects->bounded.y;
+ boxes[n_boxes].x2 = rects->bounded.x;
+ boxes[n_boxes].y2 = rects->bounded.y + rects->bounded.height;
+ n_boxes++;
}
/* right */
if (rects->bounded.x + rects->bounded.width != rects->unbounded.x + rects->unbounded.width) {
- int x = rects->bounded.x + rects->bounded.width;
- int y = rects->bounded.y;
- int width = rects->unbounded.x + rects->unbounded.width - x;
- int height = rects->bounded.height;
-
- if (mask != NULL) {
- pixman_image_composite (PIXMAN_OP_OUT_REVERSE,
- mask, NULL, dst->pixman_image,
- x + mask_x, y + mask_y,
- 0, 0,
- x, y,
- width, height);
- } else {
- pixman_fill ((uint32_t *) dst->data, dst->stride / sizeof (uint32_t),
- PIXMAN_FORMAT_BPP (dst->pixman_format),
- x, y, width, height,
- 0);
- }
+ boxes[n_boxes].x1 = rects->bounded.x + rects->bounded.width;
+ boxes[n_boxes].y1 = rects->bounded.y;
+ boxes[n_boxes].x2 = rects->unbounded.x + rects->unbounded.width;
+ boxes[n_boxes].y2 = rects->bounded.y + rects->bounded.height;
+ n_boxes++;
}
/* bottom */
if (rects->bounded.y + rects->bounded.height != rects->unbounded.y + rects->unbounded.height) {
- int x = rects->unbounded.x;
- int y = rects->bounded.y + rects->bounded.height;
- int width = rects->unbounded.width;
- int height = rects->unbounded.y + rects->unbounded.height - y;
+ boxes[n_boxes].x1 = rects->unbounded.x;
+ boxes[n_boxes].y1 = rects->bounded.y + rects->bounded.height;
+ boxes[n_boxes].x2 = rects->unbounded.x + rects->unbounded.width;
+ boxes[n_boxes].y2 = rects->unbounded.y + rects->unbounded.height;
+ n_boxes++;
+ }
- if (mask != NULL) {
- pixman_image_composite (PIXMAN_OP_OUT_REVERSE,
- mask, NULL, dst->pixman_image,
- x + mask_x, y + mask_y,
- 0, 0,
- x, y,
- width, height);
- } else {
- pixman_fill ((uint32_t *) dst->data, dst->stride / sizeof (uint32_t),
- PIXMAN_FORMAT_BPP (dst->pixman_format),
- x, y, width, height,
- 0);
- }
+ if (mask != NULL) {
+ for (i = 0; i < n_boxes; i++) {
+ pixman_image_composite (PIXMAN_OP_OUT_REVERSE,
+ mask, NULL, dst->pixman_image,
+ boxes[i].x1 + mask_x, boxes[i].y1 + mask_y,
+ 0, 0,
+ boxes[i].x1, boxes[i].y1,
+ boxes[i].x2 - boxes[i].x1, boxes[i].y2 - boxes[i].y1);
+ }
+ } else {
+ pixman_color_t color = { 0, };
+
+ pixman_image_fill_boxes (PIXMAN_OP_CLEAR,
+ dst->pixman_image,
+ &color,
+ n_boxes,
+ boxes);
}
}
commit b648365cfa2d808b34b924a6b105718e0673bb9b
Author: Benjamin Otte <otte at redhat.com>
Date: Wed Jan 27 09:21:41 2010 +0100
Require pixman 0.17.5
We want pixman_image_composite32() and pixman_image_fill_boxes()
diff --git a/configure.ac b/configure.ac
index dc29cc3..64b043d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -611,7 +611,7 @@ CAIRO_ENABLE(test_surfaces, test surfaces, no)
dnl ===========================================================================
CAIRO_ENABLE_SURFACE_BACKEND(image, image, always, [
- pixman_REQUIRES="pixman-1 >= 0.15.16"
+ pixman_REQUIRES="pixman-1 >= 0.17.5"
PKG_CHECK_MODULES(pixman, $pixman_REQUIRES, , [AC_MSG_RESULT(no)
use_image="no (requires $pixman_REQUIRES http://cairographics.org/releases/)"])
image_REQUIRES=$pixman_REQUIRES
commit 0a19ad7c104cd81fa2b93aaf7ef9302f50b3f369
Author: Benjamin Otte <otte at redhat.com>
Date: Thu Apr 15 17:58:16 2010 +0200
gl: Get rid of "return value not checked" warnings
Assert that those functions only return successfully.
diff --git a/src/cairo-gl-surface.c b/src/cairo-gl-surface.c
index df50db0..8067e9e 100644
--- a/src/cairo-gl-surface.c
+++ b/src/cairo-gl-surface.c
@@ -1575,18 +1575,21 @@ _cairo_gl_set_tex_combine_constant_color (cairo_gl_context_t *ctx,
{
if (setup->shader) {
const char *uniform_name;
+ cairo_status_t status;
if (tex_unit == 0)
uniform_name = "constant_source";
else
uniform_name = "constant_mask";
- bind_vec4_to_shader(setup->shader->program,
- uniform_name,
- color[0],
- color[1],
- color[2],
- color[3]);
+ status = bind_vec4_to_shader(setup->shader->program,
+ uniform_name,
+ color[0],
+ color[1],
+ color[2],
+ color[3]);
+ assert (! _cairo_status_is_error (status));
+
return;
}
@@ -1833,12 +1836,14 @@ _cairo_gl_set_component_alpha_mask_operand (cairo_gl_context_t *ctx,
case OPERAND_CONSTANT:
/* Have to have a dummy texture bound in order to use the combiner unit. */
if (setup->shader) {
- bind_vec4_to_shader(setup->shader->program,
- "constant_mask",
- setup->src.operand.constant.color[0],
- setup->src.operand.constant.color[1],
- setup->src.operand.constant.color[2],
- setup->src.operand.constant.color[3]);
+ cairo_status_t status;
+ status = bind_vec4_to_shader(setup->shader->program,
+ "constant_mask",
+ setup->src.operand.constant.color[0],
+ setup->src.operand.constant.color[1],
+ setup->src.operand.constant.color[2],
+ setup->src.operand.constant.color[3]);
+ assert (! _cairo_status_is_error (status));
} else {
glBindTexture (ctx->tex_target, ctx->dummy_tex);
glActiveTexture (GL_TEXTURE1);
@@ -2593,12 +2598,13 @@ _cairo_gl_surface_fill_rectangles_glsl (void *abstract_surface,
_cairo_gl_set_destination (surface);
_cairo_gl_set_operator (surface, op, FALSE);
- bind_vec4_to_shader (ctx->fill_rectangles_shader.program,
- "color",
- color->red * color->alpha,
- color->green * color->alpha,
- color->blue * color->alpha,
- color->alpha);
+ status = bind_vec4_to_shader (ctx->fill_rectangles_shader.program,
+ "color",
+ color->red * color->alpha,
+ color->green * color->alpha,
+ color->blue * color->alpha,
+ color->alpha);
+ assert (! _cairo_status_is_error (status));
for (i = 0; i < num_rects; i++) {
vertices[i * 8 + 0] = rects[i].x;
commit 7745ea21e104d0a5eec1814f19bacb7334f42185
Author: Benjamin Otte <otte at redhat.com>
Date: Wed Apr 14 15:59:36 2010 +0200
gl: acquire/release properly in _cairo_gl_draw_image()
Fixes various testsuite failures, in particular ones related to masks.
diff --git a/src/cairo-gl-surface.c b/src/cairo-gl-surface.c
index ccad4c6..df50db0 100644
--- a/src/cairo-gl-surface.c
+++ b/src/cairo-gl-surface.c
@@ -680,8 +680,14 @@ cairo_gl_surface_swapbuffers (cairo_surface_t *abstract_surface)
}
if (! surface->fb) {
- cairo_gl_context_t *ctx = (cairo_gl_context_t *) surface->base.device;
+ cairo_gl_context_t *ctx;
+
+ if (_cairo_gl_context_acquire (surface->base.device, &ctx))
+ return;
+
ctx->swap_buffers (ctx, surface);
+
+ _cairo_gl_context_release (ctx);
}
}
@@ -721,7 +727,7 @@ _cairo_gl_surface_draw_image (cairo_gl_surface_t *dst,
GLenum internal_format, format, type;
cairo_bool_t has_alpha;
cairo_image_surface_t *clone = NULL;
- cairo_gl_context_t *ctx = (cairo_gl_context_t *) dst->base.device;
+ cairo_gl_context_t *ctx;
int cpp;
cairo_status_t status = CAIRO_STATUS_SUCCESS;
@@ -749,6 +755,10 @@ _cairo_gl_surface_draw_image (cairo_gl_surface_t *dst,
cpp = PIXMAN_FORMAT_BPP (src->pixman_format) / 8;
+ status = _cairo_gl_context_acquire (dst->base.device, &ctx);
+ if (unlikely (status))
+ return status;
+
glPixelStorei (GL_UNPACK_ALIGNMENT, 1);
glPixelStorei (GL_UNPACK_ROW_LENGTH, src->stride / cpp);
if (dst->fb) {
@@ -876,6 +886,8 @@ _cairo_gl_surface_draw_image (cairo_gl_surface_t *dst,
fail:
glPixelStorei (GL_UNPACK_ROW_LENGTH, 0);
+ _cairo_gl_context_release (ctx);
+
cairo_surface_destroy (&clone->base);
return CAIRO_STATUS_SUCCESS;
commit 596d3017a1b11cb9844e69330cdece7441929725
Author: Benjamin Otte <otte at redhat.com>
Date: Tue Apr 13 20:53:47 2010 +0200
gl: acquire/release context when getting images
Avoids Mesa complaining about no current context.
diff --git a/src/cairo-gl-surface.c b/src/cairo-gl-surface.c
index 5fca018..ccad4c6 100644
--- a/src/cairo-gl-surface.c
+++ b/src/cairo-gl-surface.c
@@ -888,10 +888,12 @@ _cairo_gl_surface_get_image (cairo_gl_surface_t *surface,
cairo_rectangle_int_t *rect_out)
{
cairo_image_surface_t *image;
+ cairo_gl_context_t *ctx;
GLenum err;
GLenum format, type;
cairo_format_t cairo_format;
unsigned int cpp;
+ cairo_status_t status;
/* Want to use a switch statement here but the compiler gets whiny. */
if (surface->base.content == CAIRO_CONTENT_COLOR_ALPHA) {
@@ -924,6 +926,9 @@ _cairo_gl_surface_get_image (cairo_gl_surface_t *surface,
* it the destination. But then, this is the fallback path, so let's not
* fall back instead.
*/
+ status = _cairo_gl_context_acquire (surface->base.device, &ctx);
+ if (unlikely (status))
+ return status;
_cairo_gl_set_destination (surface);
glPixelStorei (GL_PACK_ALIGNMENT, 1);
@@ -939,6 +944,8 @@ _cairo_gl_surface_get_image (cairo_gl_surface_t *surface,
while ((err = glGetError ()))
fprintf (stderr, "GL error 0x%08x\n", (int) err);
+ _cairo_gl_context_release (ctx);
+
*image_out = image;
if (rect_out != NULL)
*rect_out = *interest;
commit 46ef05c3d73af2b222602954b986832e77355a12
Author: Benjamin Otte <otte at redhat.com>
Date: Mon Mar 29 12:58:18 2010 +0200
glx: Add getters for device's Display and GLXContext
diff --git a/src/cairo-gl.h b/src/cairo-gl.h
index 2b73f3f..4f1912f 100644
--- a/src/cairo-gl.h
+++ b/src/cairo-gl.h
@@ -66,6 +66,12 @@ cairo_gl_surface_glfinish (cairo_surface_t *surface);
cairo_public cairo_device_t *
cairo_glx_device_create (Display *dpy, GLXContext gl_ctx);
+cairo_public Display *
+cairo_glx_device_get_display (cairo_device_t *device);
+
+cairo_public GLXContext
+cairo_glx_device_get_context (cairo_device_t *device);
+
cairo_public cairo_surface_t *
cairo_gl_surface_create_for_window (cairo_device_t *device,
Window win,
diff --git a/src/cairo-glx-context.c b/src/cairo-glx-context.c
index f519443..e261cf8 100644
--- a/src/cairo-glx-context.c
+++ b/src/cairo-glx-context.c
@@ -209,6 +209,36 @@ cairo_glx_device_create (Display *dpy, GLXContext gl_ctx)
return &ctx->base.base;
}
+Display *
+cairo_glx_device_get_display (cairo_device_t *device)
+{
+ cairo_glx_context_t *ctx;
+
+ if (device->backend->type != CAIRO_DEVICE_TYPE_GL) {
+ _cairo_error_throw (CAIRO_STATUS_DEVICE_TYPE_MISMATCH);
+ return NULL;
+ }
+
+ ctx = (cairo_glx_context_t *) device;
+
+ return ctx->display;
+}
+
+GLXContext
+cairo_glx_device_get_context (cairo_device_t *device)
+{
+ cairo_glx_context_t *ctx;
+
+ if (device->backend->type != CAIRO_DEVICE_TYPE_GL) {
+ _cairo_error_throw (CAIRO_STATUS_DEVICE_TYPE_MISMATCH);
+ return NULL;
+ }
+
+ ctx = (cairo_glx_context_t *) device;
+
+ return ctx->context;
+}
+
cairo_surface_t *
cairo_gl_surface_create_for_window (cairo_device_t *device,
Window win,
commit 712919223d08f8b4c43f828322fdc285560c137f
Author: Benjamin Otte <otte at redhat.com>
Date: Fri Mar 26 15:50:10 2010 +0100
gl: Make code safe for multithreaded access
The code callss the gl device's acquire/release in
cairo_device_acquire/release(). This way, external APIs can use these
functions to prepare for rendering GL.
Also adds code to unset the glx context if it wasn't set when acquiring
the device. This allows multithreaded apps to work fine with just using
cairo APIs, but might introduce penalties in single-threaded
applications.
diff --git a/src/cairo-egl-context.c b/src/cairo-egl-context.c
index 7093ea0..c373bd8 100644
--- a/src/cairo-egl-context.c
+++ b/src/cairo-egl-context.c
@@ -104,6 +104,8 @@ cairo_egl_device_create (EGLDisplay dpy, EGLContext egl)
ctx->display = dpy;
ctx->context = egl;
+ ctx->base.acquire = NULL; /* FIXME */
+ ctx->base.release = NULL; /* FIXME */
ctx->base.make_current = _egl_make_current;
ctx->base.swap_buffers = _egl_swap_buffers;
ctx->base.destroy = _egl_destroy;
diff --git a/src/cairo-gl-private.h b/src/cairo-gl-private.h
index cfb563b..c283620 100644
--- a/src/cairo-gl-private.h
+++ b/src/cairo-gl-private.h
@@ -136,7 +136,10 @@ typedef struct _cairo_gl_context {
cairo_gl_glyph_cache_t glyph_cache[2];
cairo_list_t fonts;
- void (*make_current)(void *ctx, cairo_gl_surface_t *surface);
+ void (*acquire) (void *ctx);
+ void (*release) (void *ctx);
+
+ void (*make_current) (void *ctx, cairo_gl_surface_t *surface);
void (*swap_buffers)(void *ctx, cairo_gl_surface_t *surface);
void (*destroy) (void *ctx);
} cairo_gl_context_t;
diff --git a/src/cairo-gl-surface.c b/src/cairo-gl-surface.c
index 9107d4d..5fca018 100644
--- a/src/cairo-gl-surface.c
+++ b/src/cairo-gl-surface.c
@@ -68,6 +68,23 @@ static cairo_bool_t _cairo_surface_is_gl (cairo_surface_t *surface)
}
static void
+_gl_lock (void *device)
+{
+ cairo_gl_context_t *ctx = (cairo_gl_context_t *) device;
+
+ ctx->acquire (ctx);
+}
+
+static void
+_gl_unlock (void *device)
+{
+ cairo_gl_context_t *ctx = (cairo_gl_context_t *) device;
+
+ ctx->release (ctx);
+ ctx->current_target = NULL;
+}
+
+static void
_gl_destroy (void *device)
{
cairo_gl_context_t *ctx = device;
@@ -94,7 +111,8 @@ _gl_destroy (void *device)
static const cairo_device_backend_t _cairo_gl_device_backend = {
CAIRO_DEVICE_TYPE_GL,
- NULL, NULL, /* lock, unlock */
+ _gl_lock,
+ _gl_unlock,
NULL, /* flush */
NULL, /* finish */
diff --git a/src/cairo-glx-context.c b/src/cairo-glx-context.c
index 0cc31d3..f519443 100644
--- a/src/cairo-glx-context.c
+++ b/src/cairo-glx-context.c
@@ -52,6 +52,9 @@ typedef struct _cairo_glx_context {
Display *display;
Window dummy_window;
GLXContext context;
+
+ GLXContext prev_context;
+ GLXDrawable prev_drawable;
} cairo_glx_context_t;
typedef struct _cairo_glx_surface {
@@ -61,8 +64,20 @@ typedef struct _cairo_glx_surface {
} cairo_glx_surface_t;
static void
-_glx_make_current (void *abstract_ctx,
- cairo_gl_surface_t *abstract_surface)
+_glx_acquire (void *abstract_ctx)
+{
+ cairo_glx_context_t *ctx = abstract_ctx;
+
+ ctx->prev_context = glXGetCurrentContext ();
+ ctx->prev_drawable = glXGetCurrentDrawable ();
+
+ /* XXX: This is necessary with current code, but shouldn't be */
+ if (ctx->prev_context != ctx->context)
+ glXMakeCurrent (ctx->display, ctx->dummy_window, ctx->context);
+}
+
+static void
+_glx_make_current (void *abstract_ctx, cairo_gl_surface_t *abstract_surface)
{
cairo_glx_context_t *ctx = abstract_ctx;
cairo_glx_surface_t *surface = (cairo_glx_surface_t *) abstract_surface;
@@ -72,6 +87,18 @@ _glx_make_current (void *abstract_ctx,
}
static void
+_glx_release (void *abstract_ctx)
+{
+ cairo_glx_context_t *ctx = abstract_ctx;
+
+ if (ctx->prev_context != glXGetCurrentContext () ||
+ ctx->prev_drawable != glXGetCurrentDrawable ())
+ glXMakeCurrent (ctx->display,
+ ctx->prev_drawable,
+ ctx->prev_context);
+}
+
+static void
_glx_swap_buffers (void *abstract_ctx,
cairo_gl_surface_t *abstract_surface)
{
@@ -162,7 +189,11 @@ cairo_glx_device_create (Display *dpy, GLXContext gl_ctx)
ctx->display = dpy;
ctx->dummy_window = dummy;
ctx->context = gl_ctx;
+ ctx->prev_context = NULL;
+ ctx->prev_drawable = None;
+ ctx->base.acquire = _glx_acquire;
+ ctx->base.release = _glx_release;
ctx->base.make_current = _glx_make_current;
ctx->base.swap_buffers = _glx_swap_buffers;
ctx->base.destroy = _glx_destroy;
@@ -173,6 +204,8 @@ cairo_glx_device_create (Display *dpy, GLXContext gl_ctx)
return _cairo_gl_context_create_in_error (status);
}
+ ctx->base.release (ctx);
+
return &ctx->base.base;
}
commit 8f2e82cea3405fa9a6591911c0d42ea3dd0c6180
Author: Benjamin Otte <otte at redhat.com>
Date: Thu Apr 15 17:48:24 2010 +0200
xcb: Make code not complain about every new format
diff --git a/src/cairo-xcb-surface-render.c b/src/cairo-xcb-surface-render.c
index 72a448e..9cd51f8 100644
--- a/src/cairo-xcb-surface-render.c
+++ b/src/cairo-xcb-surface-render.c
@@ -3840,6 +3840,18 @@ _native_byte_order_lsb (void)
return *((char *) &x) == 1;
}
+static int
+_cairo_xcb_get_glyphset_index_for_format (cairo_format_t format)
+{
+ if (format == CAIRO_FORMAT_A8)
+ return GLYPHSET_INDEX_A8;
+ if (format == CAIRO_FORMAT_A1)
+ return GLYPHSET_INDEX_A1;
+
+ assert (format == CAIRO_FORMAT_ARGB32);
+ return GLYPHSET_INDEX_ARGB32;
+}
+
static cairo_xcb_font_glyphset_info_t *
_cairo_xcb_scaled_font_get_glyphset_info_for_format (cairo_scaled_font_t *scaled_font,
cairo_format_t format)
@@ -3848,17 +3860,7 @@ _cairo_xcb_scaled_font_get_glyphset_info_for_format (cairo_scaled_font_t *scaled
cairo_xcb_font_glyphset_info_t *glyphset_info;
int glyphset_index;
- switch (format) {
- default:
- case CAIRO_FORMAT_INVALID:
- case CAIRO_FORMAT_RGB16_565:
- case CAIRO_FORMAT_RGB24:
- ASSERT_NOT_REACHED;
- case CAIRO_FORMAT_ARGB32: glyphset_index = GLYPHSET_INDEX_ARGB32; break;
- case CAIRO_FORMAT_A8: glyphset_index = GLYPHSET_INDEX_A8; break;
- case CAIRO_FORMAT_A1: glyphset_index = GLYPHSET_INDEX_A1; break;
- }
-
+ glyphset_index = _cairo_xcb_get_glyphset_index_for_format (format);
font_private = scaled_font->surface_private;
glyphset_info = &font_private->glyphset_info[glyphset_index];
if (glyphset_info->glyphset == XCB_NONE) {
@@ -3914,16 +3916,7 @@ _cairo_xcb_scaled_font_get_glyphset_info_for_pending_free_glyph (
return NULL;
if (surface != NULL) {
- switch (surface->format) {
- default:
- case CAIRO_FORMAT_INVALID:
- case CAIRO_FORMAT_RGB16_565:
- case CAIRO_FORMAT_RGB24:
- ASSERT_NOT_REACHED;
- case CAIRO_FORMAT_ARGB32: i = GLYPHSET_INDEX_ARGB32; break;
- case CAIRO_FORMAT_A8: i = GLYPHSET_INDEX_A8; break;
- case CAIRO_FORMAT_A1: i = GLYPHSET_INDEX_A1; break;
- }
+ i = _cairo_xcb_get_glyphset_index_for_format (surface->format);
if (_cairo_xcb_glyphset_info_has_pending_free_glyph (
&font_private->glyphset_info[i],
@@ -4032,8 +4025,8 @@ _cairo_xcb_surface_add_glyph (cairo_xcb_connection_t *connection,
data = glyph_surface->data;
/* flip formats around */
- switch (scaled_glyph->surface->format) {
- case CAIRO_FORMAT_A1:
+ switch (_cairo_xcb_get_glyphset_index_for_format (scaled_glyph->surface->format)) {
+ case GLYPHSET_INDEX_A1:
/* local bitmaps are always stored with bit == byte */
if (_native_byte_order_lsb() != (connection->root->bitmap_format_bit_order == XCB_IMAGE_ORDER_LSB_FIRST)) {
int c = glyph_surface->stride * glyph_surface->height;
@@ -4059,10 +4052,10 @@ _cairo_xcb_surface_add_glyph (cairo_xcb_connection_t *connection,
}
break;
- case CAIRO_FORMAT_A8:
+ case GLYPHSET_INDEX_A8:
break;
- case CAIRO_FORMAT_ARGB32:
+ case GLYPHSET_INDEX_ARGB32:
if (_native_byte_order_lsb() != (connection->root->image_byte_order == XCB_IMAGE_ORDER_LSB_FIRST)) {
unsigned int c = glyph_surface->stride * glyph_surface->height / 4;
const uint32_t *d;
@@ -4084,9 +4077,6 @@ _cairo_xcb_surface_add_glyph (cairo_xcb_connection_t *connection,
}
break;
- case CAIRO_FORMAT_RGB16_565:
- case CAIRO_FORMAT_RGB24:
- case CAIRO_FORMAT_INVALID:
default:
ASSERT_NOT_REACHED;
break;
commit 1d753b2f4d724c5ac3e452848ca4dda5891816a6
Author: Benjamin Otte <otte at redhat.com>
Date: Tue Feb 23 21:53:31 2010 +0100
xlib: Make code not complain about every new format
diff --git a/src/cairo-xlib-surface.c b/src/cairo-xlib-surface.c
index 27ced5b..bd18e18 100644
--- a/src/cairo-xlib-surface.c
+++ b/src/cairo-xlib-surface.c
@@ -3747,6 +3747,18 @@ _native_byte_order_lsb (void)
return *((char *) &x) == 1;
}
+static int
+_cairo_xlib_get_glyphset_index_for_format (cairo_format_t format)
+{
+ if (format == CAIRO_FORMAT_A8)
+ return GLYPHSET_INDEX_A8;
+ if (format == CAIRO_FORMAT_A1)
+ return GLYPHSET_INDEX_A1;
+
+ assert (format == CAIRO_FORMAT_ARGB32);
+ return GLYPHSET_INDEX_ARGB32;
+}
+
static cairo_xlib_font_glyphset_info_t *
_cairo_xlib_scaled_font_get_glyphset_info_for_format (cairo_scaled_font_t *scaled_font,
cairo_format_t format)
@@ -3755,17 +3767,7 @@ _cairo_xlib_scaled_font_get_glyphset_info_for_format (cairo_scaled_font_t *scale
cairo_xlib_font_glyphset_info_t *glyphset_info;
int glyphset_index;
- switch (format) {
- default:
- case CAIRO_FORMAT_INVALID:
- case CAIRO_FORMAT_RGB16_565:
- case CAIRO_FORMAT_RGB24:
- ASSERT_NOT_REACHED;
- case CAIRO_FORMAT_ARGB32: glyphset_index = GLYPHSET_INDEX_ARGB32; break;
- case CAIRO_FORMAT_A8: glyphset_index = GLYPHSET_INDEX_A8; break;
- case CAIRO_FORMAT_A1: glyphset_index = GLYPHSET_INDEX_A1; break;
- }
-
+ glyphset_index = _cairo_xlib_get_glyphset_index_for_format (format);
font_private = scaled_font->surface_private;
glyphset_info = &font_private->glyphset_info[glyphset_index];
if (glyphset_info->glyphset == None) {
@@ -3819,16 +3821,7 @@ _cairo_xlib_scaled_font_get_glyphset_info_for_pending_free_glyph (
return NULL;
if (surface != NULL) {
- switch (surface->format) {
- default:
- case CAIRO_FORMAT_INVALID:
- case CAIRO_FORMAT_RGB16_565:
- case CAIRO_FORMAT_RGB24:
- ASSERT_NOT_REACHED;
- case CAIRO_FORMAT_ARGB32: i = GLYPHSET_INDEX_ARGB32; break;
- case CAIRO_FORMAT_A8: i = GLYPHSET_INDEX_A8; break;
- case CAIRO_FORMAT_A1: i = GLYPHSET_INDEX_A1; break;
- }
+ i = _cairo_xlib_get_glyphset_index_for_format (surface->format);
if (_cairo_xlib_glyphset_info_has_pending_free_glyph (
&font_private->glyphset_info[i],
glyph_index))
@@ -3966,8 +3959,8 @@ _cairo_xlib_surface_add_glyph (Display *dpy,
data = glyph_surface->data;
/* flip formats around */
- switch (scaled_glyph->surface->format) {
- case CAIRO_FORMAT_A1:
+ switch (_cairo_xlib_get_glyphset_index_for_format (scaled_glyph->surface->format)) {
+ case GLYPHSET_INDEX_A1:
/* local bitmaps are always stored with bit == byte */
if (_native_byte_order_lsb() != (BitmapBitOrder (dpy) == LSBFirst)) {
int c = glyph_surface->stride * glyph_surface->height;
@@ -3991,9 +3984,9 @@ _cairo_xlib_surface_add_glyph (Display *dpy,
data = new;
}
break;
- case CAIRO_FORMAT_A8:
+ case GLYPHSET_INDEX_A8:
break;
- case CAIRO_FORMAT_ARGB32:
+ case GLYPHSET_INDEX_ARGB32:
if (_native_byte_order_lsb() != (ImageByteOrder (dpy) == LSBFirst)) {
unsigned int c = glyph_surface->stride * glyph_surface->height / 4;
const uint32_t *d;
@@ -4013,9 +4006,6 @@ _cairo_xlib_surface_add_glyph (Display *dpy,
data = (uint8_t *) new;
}
break;
- case CAIRO_FORMAT_RGB16_565:
- case CAIRO_FORMAT_RGB24:
- case CAIRO_FORMAT_INVALID:
default:
ASSERT_NOT_REACHED;
break;
commit ebc9cc46fe7740c6d97e02edc66bae383413764b
Author: Benjamin Otte <otte at redhat.com>
Date: Fri Mar 5 15:08:34 2010 +0100
gl: Use right format
The internal format should always be GL_RGBA.
diff --git a/src/cairo-gl-surface.c b/src/cairo-gl-surface.c
index 96eb1b6..9107d4d 100644
--- a/src/cairo-gl-surface.c
+++ b/src/cairo-gl-surface.c
@@ -209,7 +209,7 @@ _cairo_gl_get_image_format_and_type (pixman_format_code_t pixman_format,
*has_alpha = FALSE;
return TRUE;
case PIXMAN_b8g8r8a8:
- *internal_format = GL_BGRA;
+ *internal_format = GL_RGBA;
*format = GL_BGRA;
*type = GL_UNSIGNED_INT_8_8_8_8;
return TRUE;
More information about the cairo-commit
mailing list