gl: Change _cairo_gl_composite_emit_rect()

Two changes:
- The function now takes x1/y1,x2/y2 instead of x,y,width,height
- The function takes a color uint32_t. This will be used by spans.
This commit is contained in:
Benjamin Otte 2010-05-16 03:27:28 +02:00
parent f8398cc2d8
commit 6e81d85e36
3 changed files with 26 additions and 20 deletions

View file

@ -1111,7 +1111,8 @@ static inline void
_cairo_gl_operand_emit (cairo_gl_operand_t *operand,
GLfloat ** vb,
GLfloat x,
GLfloat y)
GLfloat y,
uint32_t color)
{
switch (operand->type) {
default:
@ -1143,15 +1144,16 @@ static inline void
_cairo_gl_composite_emit_vertex (cairo_gl_context_t *ctx,
cairo_gl_composite_t *setup,
GLfloat x,
GLfloat y)
GLfloat y,
uint32_t color)
{
GLfloat *vb = (GLfloat *) (void *) &setup->vb[setup->vb_offset];
*vb++ = x;
*vb++ = y;
_cairo_gl_operand_emit (&setup->src, &vb, x, y);
_cairo_gl_operand_emit (&setup->mask, &vb, x, y);
_cairo_gl_operand_emit (&setup->src, &vb, x, y, color);
_cairo_gl_operand_emit (&setup->mask, &vb, x, y, color);
setup->vb_offset += setup->vertex_size;
}
@ -1159,17 +1161,18 @@ _cairo_gl_composite_emit_vertex (cairo_gl_context_t *ctx,
void
_cairo_gl_composite_emit_rect (cairo_gl_context_t *ctx,
cairo_gl_composite_t *setup,
GLfloat x,
GLfloat y,
GLfloat width,
GLfloat height)
GLfloat x1,
GLfloat y1,
GLfloat x2,
GLfloat y2,
uint32_t color)
{
_cairo_gl_composite_prepare_buffer (ctx, setup, 4);
_cairo_gl_composite_emit_vertex (ctx, setup, x, y);
_cairo_gl_composite_emit_vertex (ctx, setup, x + width, y);
_cairo_gl_composite_emit_vertex (ctx, setup, x + width, y + height);
_cairo_gl_composite_emit_vertex (ctx, setup, x, y + height);
_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, x2, y2, color);
_cairo_gl_composite_emit_vertex (ctx, setup, x1, y2, color);
}
void

View file

@ -304,10 +304,11 @@ _cairo_gl_composite_begin (cairo_gl_context_t *ctx,
cairo_private void
_cairo_gl_composite_emit_rect (cairo_gl_context_t *ctx,
cairo_gl_composite_t *setup,
GLfloat x,
GLfloat y,
GLfloat width,
GLfloat height);
GLfloat x1,
GLfloat y1,
GLfloat x2,
GLfloat y2,
uint32_t color);
cairo_private void
_cairo_gl_composite_end (cairo_gl_context_t *ctx,

View file

@ -1001,13 +1001,15 @@ _cairo_gl_surface_composite (cairo_operator_t op,
cairo_region_get_rectangle (clip_region, i, &rect);
_cairo_gl_composite_emit_rect (ctx, &setup,
rect.x, rect.y,
rect.width, rect.height);
rect.x, rect.y,
rect.x + rect.width, rect.y + rect.height,
0);
}
} else {
_cairo_gl_composite_emit_rect (ctx, &setup,
dst_x, dst_y,
width, height);
dst_x, dst_y,
dst_x + width, dst_y + height,
0);
}
_cairo_gl_composite_end (ctx, &setup);