diff options
author | Benjamin Otte <otte@redhat.com> | 2010-06-03 17:40:56 +0200 |
---|---|---|
committer | Benjamin Otte <otte@redhat.com> | 2010-06-07 13:37:49 +0200 |
commit | 9c17a477d29f633a4850ef8b458cbca82a19afc4 (patch) | |
tree | 744a374dd26c9001bdb97763ae3f93901c5201b0 /src/cairo-gl-composite.c | |
parent | df93802765afcf883abef5549bd5dff3465e2d79 (diff) |
gl: Use the generic functions for filter/extend in gradients
Diffstat (limited to 'src/cairo-gl-composite.c')
-rw-r--r-- | src/cairo-gl-composite.c | 26 |
1 files changed, 8 insertions, 18 deletions
diff --git a/src/cairo-gl-composite.c b/src/cairo-gl-composite.c index 6eb8f495..4b8fcdc3 100644 --- a/src/cairo-gl-composite.c +++ b/src/cairo-gl-composite.c @@ -188,24 +188,6 @@ _cairo_gl_create_gradient_texture (cairo_gl_surface_t *dst, glBindBufferARB (GL_PIXEL_UNPACK_BUFFER_ARB, 0); - glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - - switch (pattern->base.extend) { - case CAIRO_EXTEND_NONE: - glTexParameteri (GL_TEXTURE_1D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_BORDER); - break; - case CAIRO_EXTEND_PAD: - glTexParameteri (GL_TEXTURE_1D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - break; - case CAIRO_EXTEND_REPEAT: - glTexParameteri (GL_TEXTURE_1D, GL_TEXTURE_WRAP_S, GL_REPEAT); - break; - case CAIRO_EXTEND_REFLECT: - glTexParameteri (GL_TEXTURE_1D, GL_TEXTURE_WRAP_S, GL_MIRRORED_REPEAT); - break; - } - _cairo_gl_context_release (ctx); return CAIRO_STATUS_SUCCESS; } @@ -336,6 +318,8 @@ _cairo_gl_gradient_operand_init (cairo_gl_operand_t *operand, operand->linear.segment_x = x1 - x0; operand->linear.segment_y = y1 - y0; + operand->linear.extend = pattern->extend; + operand->type = CAIRO_GL_OPERAND_LINEAR_GRADIENT; return CAIRO_STATUS_SUCCESS; } else { @@ -370,6 +354,8 @@ _cairo_gl_gradient_operand_init (cairo_gl_operand_t *operand, operand->radial.radius_0 = r0; operand->radial.radius_1 = r1; + operand->radial.extend = pattern->extend; + operand->type = CAIRO_GL_OPERAND_RADIAL_GRADIENT; return CAIRO_STATUS_SUCCESS; } @@ -779,11 +765,15 @@ _cairo_gl_context_setup_operand (cairo_gl_context_t *ctx, case CAIRO_GL_OPERAND_LINEAR_GRADIENT: glActiveTexture (GL_TEXTURE0 + tex_unit); glBindTexture (GL_TEXTURE_1D, operand->linear.tex); + _cairo_gl_texture_set_extend (ctx, GL_TEXTURE_1D, operand->linear.extend); + _cairo_gl_texture_set_filter (ctx, GL_TEXTURE_1D, CAIRO_FILTER_BILINEAR); glEnable (GL_TEXTURE_1D); break; case CAIRO_GL_OPERAND_RADIAL_GRADIENT: glActiveTexture (GL_TEXTURE0 + tex_unit); glBindTexture (GL_TEXTURE_1D, operand->radial.tex); + _cairo_gl_texture_set_extend (ctx, GL_TEXTURE_1D, operand->radial.extend); + _cairo_gl_texture_set_filter (ctx, GL_TEXTURE_1D, CAIRO_FILTER_BILINEAR); glEnable (GL_TEXTURE_1D); break; } |