summaryrefslogtreecommitdiff
path: root/src/cairo-gl-composite.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/cairo-gl-composite.c')
-rw-r--r--src/cairo-gl-composite.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/src/cairo-gl-composite.c b/src/cairo-gl-composite.c
index 760aabbc..55154c3a 100644
--- a/src/cairo-gl-composite.c
+++ b/src/cairo-gl-composite.c
@@ -606,11 +606,13 @@ _cairo_gl_texture_set_attributes (cairo_gl_context_t *ctx,
}
static void
-_cairo_gl_operand_setup_texture (cairo_gl_context_t *ctx,
- cairo_gl_operand_t *operand,
+_cairo_gl_context_setup_operand (cairo_gl_context_t *ctx,
GLuint tex_unit,
+ cairo_gl_operand_t *operand,
unsigned int vertex_offset)
{
+ memcpy (&ctx->operands[tex_unit], operand, sizeof (cairo_gl_operand_t));
+
switch (operand->type) {
default:
case CAIRO_GL_OPERAND_COUNT:
@@ -657,6 +659,13 @@ _cairo_gl_operand_setup_texture (cairo_gl_context_t *ctx,
}
static void
+_cairo_gl_context_destroy_operand (cairo_gl_context_t *ctx,
+ GLuint tex_unit)
+{
+ memset (&ctx->operands[tex_unit], 0, sizeof (cairo_gl_operand_t));
+}
+
+static void
_cairo_gl_operand_setup_fixed (cairo_gl_operand_t *operand,
GLuint tex_unit)
{
@@ -995,8 +1004,8 @@ _cairo_gl_composite_begin (cairo_gl_composite_t *setup,
glVertexPointer (2, GL_FLOAT, ctx->vertex_size, NULL);
glEnableClientState (GL_VERTEX_ARRAY);
- _cairo_gl_operand_setup_texture (ctx, &setup->src, 0, dst_size);
- _cairo_gl_operand_setup_texture (ctx, &setup->mask, 1, dst_size + src_size);
+ _cairo_gl_context_setup_operand (ctx, 0, &setup->src, dst_size);
+ _cairo_gl_context_setup_operand (ctx, 1, &setup->mask, dst_size + src_size);
_cairo_gl_set_src_operand (ctx, setup);
if (setup->has_component_alpha)
@@ -1241,6 +1250,9 @@ _cairo_gl_composite_end (cairo_gl_context_t *ctx,
glDisable (GL_TEXTURE_1D);
glDisable (ctx->tex_target);
+ _cairo_gl_context_destroy_operand (ctx, 0);
+ _cairo_gl_context_destroy_operand (ctx, 1);
+
ctx->pre_shader = NULL;
ctx->vertex_size = 0;