gl: Fix coverage passing for spans not being endian safe.

This commit is contained in:
Benjamin Otte 2010-05-20 16:08:38 +02:00
parent 2a0f34c6da
commit f9cf07b126
3 changed files with 19 additions and 16 deletions

View file

@ -1171,7 +1171,7 @@ _cairo_gl_operand_emit (cairo_gl_operand_t *operand,
GLfloat ** vb,
GLfloat x,
GLfloat y,
uint32_t color)
uint8_t alpha)
{
switch (operand->type) {
default:
@ -1186,10 +1186,13 @@ _cairo_gl_operand_emit (cairo_gl_operand_t *operand,
{
union fi {
float f;
uint32_t u;
GLbyte bytes[4];
} fi;
fi.u = color;
fi.bytes[0] = 0;
fi.bytes[1] = 0;
fi.bytes[2] = 0;
fi.bytes[3] = alpha;
*(*vb)++ = fi.f;
}
break;
@ -1212,15 +1215,15 @@ _cairo_gl_composite_emit_vertex (cairo_gl_context_t *ctx,
cairo_gl_composite_t *setup,
GLfloat x,
GLfloat y,
uint32_t color)
uint8_t alpha)
{
GLfloat *vb = (GLfloat *) (void *) &ctx->vb[ctx->vb_offset];
*vb++ = x;
*vb++ = y;
_cairo_gl_operand_emit (&setup->src, &vb, x, y, color);
_cairo_gl_operand_emit (&setup->mask, &vb, x, y, color);
_cairo_gl_operand_emit (&setup->src, &vb, x, y, alpha);
_cairo_gl_operand_emit (&setup->mask, &vb, x, y, alpha);
ctx->vb_offset += ctx->vertex_size;
}
@ -1232,17 +1235,17 @@ _cairo_gl_composite_emit_rect (cairo_gl_context_t *ctx,
GLfloat y1,
GLfloat x2,
GLfloat y2,
uint32_t color)
uint8_t alpha)
{
_cairo_gl_composite_prepare_buffer (ctx, setup, 6);
_cairo_gl_composite_emit_vertex (ctx, setup, x1, y1, color);
_cairo_gl_composite_emit_vertex (ctx, setup, x2, y1, color);
_cairo_gl_composite_emit_vertex (ctx, setup, x1, y2, color);
_cairo_gl_composite_emit_vertex (ctx, setup, x1, y1, alpha);
_cairo_gl_composite_emit_vertex (ctx, setup, x2, y1, alpha);
_cairo_gl_composite_emit_vertex (ctx, setup, x1, y2, alpha);
_cairo_gl_composite_emit_vertex (ctx, setup, x2, y1, color);
_cairo_gl_composite_emit_vertex (ctx, setup, x2, y2, color);
_cairo_gl_composite_emit_vertex (ctx, setup, x1, y2, color);
_cairo_gl_composite_emit_vertex (ctx, setup, x2, y1, alpha);
_cairo_gl_composite_emit_vertex (ctx, setup, x2, y2, alpha);
_cairo_gl_composite_emit_vertex (ctx, setup, x1, y2, alpha);
}
static inline void

View file

@ -326,7 +326,7 @@ _cairo_gl_composite_emit_rect (cairo_gl_context_t *ctx,
GLfloat y1,
GLfloat x2,
GLfloat y2,
uint32_t color);
uint8_t alpha);
cairo_private void
_cairo_gl_composite_emit_glyph (cairo_gl_context_t *ctx,

View file

@ -1113,7 +1113,7 @@ _cairo_gl_render_bounded_spans (void *abstract_renderer,
&renderer->setup,
spans[0].x, y,
spans[1].x, y + height,
spans[0].coverage << 24);
spans[0].coverage);
}
spans++;
@ -1152,7 +1152,7 @@ _cairo_gl_render_unbounded_spans (void *abstract_renderer,
&renderer->setup,
spans[0].x, y,
spans[1].x, y + height,
spans[0].coverage << 24);
spans[0].coverage);
spans++;
} while (--num_spans > 1);