summaryrefslogtreecommitdiff
path: root/src/cairo-gl-spans-compositor.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2012-02-29 10:03:00 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2012-02-29 10:27:39 +0000
commita49a26f961bc284d496ea7e16dd79e0ddb36c98e (patch)
tree9a6adf5242bba70f4a4e7880da28373a988721d5 /src/cairo-gl-spans-compositor.c
parent3c665102c2b7ccd69aec7658e398ce6dd6dae38b (diff)
gl: Various fixes for glyphs
Not 100% improvement, there are still a variety of failures with GLXWindows, but getting there. At least it fixes more things than its breaks... Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src/cairo-gl-spans-compositor.c')
-rw-r--r--src/cairo-gl-spans-compositor.c43
1 files changed, 26 insertions, 17 deletions
diff --git a/src/cairo-gl-spans-compositor.c b/src/cairo-gl-spans-compositor.c
index c86b638d..0e31ea9d 100644
--- a/src/cairo-gl-spans-compositor.c
+++ b/src/cairo-gl-spans-compositor.c
@@ -240,13 +240,14 @@ emit_aligned_boxes (cairo_gl_context_t *ctx,
const struct _cairo_boxes_chunk *chunk;
int i;
+ TRACE ((stderr, "%s: num_boxes=%d\n", __FUNCTION__, boxes->num_boxes));
for (chunk = &boxes->chunks; chunk; chunk = chunk->next) {
for (i = 0; i < chunk->count; i++) {
int x1 = _cairo_fixed_integer_part (chunk->base[i].p1.x);
int y1 = _cairo_fixed_integer_part (chunk->base[i].p1.y);
int x2 = _cairo_fixed_integer_part (chunk->base[i].p2.x);
int y2 = _cairo_fixed_integer_part (chunk->base[i].p2.y);
- _cairo_gl_composite_emit_rect (ctx, x1, y1, x2, y2, 0);
+ _cairo_gl_composite_emit_rect (ctx, x1, y1, x2, y2, 255);
}
}
}
@@ -261,7 +262,8 @@ fill_boxes (void *_dst,
cairo_gl_context_t *ctx;
cairo_int_status_t status;
- status = _cairo_gl_composite_init (&setup, op, _dst, FALSE, NULL);
+ TRACE ((stderr, "%s\n", __FUNCTION__));
+ status = _cairo_gl_composite_init (&setup, op, _dst, FALSE);
if (unlikely (status))
goto FAIL;
@@ -297,15 +299,19 @@ composite_boxes (void *_dst,
cairo_gl_context_t *ctx;
cairo_int_status_t status;
- status = _cairo_gl_composite_init (&setup, op, _dst, FALSE, extents);
+ TRACE ((stderr, "%s mask=(%d,%d), dst=(%d, %d)\n", __FUNCTION__,
+ mask_x, mask_y, dst_x, dst_y));
+ status = _cairo_gl_composite_init (&setup, op, _dst, FALSE);
if (unlikely (status))
goto FAIL;
_cairo_gl_composite_set_source_operand (&setup,
source_to_operand (abstract_src));
+ _cairo_gl_operand_translate (&setup.mask, -src_x, -src_y);
_cairo_gl_composite_set_mask_operand (&setup,
source_to_operand (abstract_mask));
+ _cairo_gl_operand_translate (&setup.mask, -mask_x, -mask_y);
status = _cairo_gl_composite_begin (&setup, &ctx);
if (unlikely (status))
@@ -346,7 +352,7 @@ _cairo_gl_span_renderer_init (cairo_abstract_span_renderer_t *_r,
status = _cairo_gl_composite_init (&r->setup,
op, (cairo_gl_surface_t *)composite->surface,
- FALSE, &composite->unbounded);
+ FALSE);
if (unlikely (status))
goto FAIL;
@@ -416,21 +422,24 @@ _cairo_gl_span_renderer_fini (cairo_abstract_span_renderer_t *_r,
const cairo_compositor_t *
_cairo_gl_span_compositor_get (void)
{
- static cairo_spans_compositor_t compositor;
+ static cairo_spans_compositor_t spans;
+ static cairo_compositor_t shape;
- if (compositor.base.delegate == NULL) {
+ if (spans.base.delegate == NULL) {
/* The fallback to traps here is essentially just for glyphs... */
- _cairo_spans_compositor_init (&compositor,
- _cairo_gl_traps_compositor_get());
-
- compositor.fill_boxes = fill_boxes;
- //compositor.check_composite_boxes = check_composite_boxes;
- compositor.pattern_to_surface = _cairo_gl_pattern_to_source;
- compositor.composite_boxes = composite_boxes;
- //compositor.check_span_renderer = check_span_renderer;
- compositor.renderer_init = _cairo_gl_span_renderer_init;
- compositor.renderer_fini = _cairo_gl_span_renderer_fini;
+ _cairo_shape_mask_compositor_init (&shape,
+ _cairo_gl_traps_compositor_get());
+ shape.glyphs = NULL;
+
+ _cairo_spans_compositor_init (&spans, &shape);
+ spans.fill_boxes = fill_boxes;
+ //spans.check_composite_boxes = check_composite_boxes;
+ spans.pattern_to_surface = _cairo_gl_pattern_to_source;
+ spans.composite_boxes = composite_boxes;
+ //spans.check_span_renderer = check_span_renderer;
+ spans.renderer_init = _cairo_gl_span_renderer_init;
+ spans.renderer_fini = _cairo_gl_span_renderer_fini;
}
- return &compositor.base;
+ return &spans.base;
}