diff options
author | Alexandros Frantzis <alexandros.frantzis@linaro.org> | 2011-03-01 14:50:25 +0200 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2011-05-10 08:19:40 +0100 |
commit | 63aa65cfbb0fa25d679c24cd78139d2557bbed37 (patch) | |
tree | 3db788d120a02914b58630d5f701ffa4d74f854c /src/cairo-gl-composite.c | |
parent | 7185ce4ddb0d291ecbecd31b5855be798cca2058 (diff) |
gl: Add functions to get the filter and extend of gl operands.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src/cairo-gl-composite.c')
-rw-r--r-- | src/cairo-gl-composite.c | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/src/cairo-gl-composite.c b/src/cairo-gl-composite.c index 05982c47..1a4467e9 100644 --- a/src/cairo-gl-composite.c +++ b/src/cairo-gl-composite.c @@ -308,6 +308,63 @@ _cairo_gl_operand_init (cairo_gl_operand_t *operand, } } +cairo_filter_t +_cairo_gl_operand_get_filter (cairo_gl_operand_t *operand) +{ + cairo_filter_t filter; + + switch ((int) operand->type) { + case CAIRO_GL_OPERAND_TEXTURE: + filter = operand->texture.attributes.filter; + break; + case CAIRO_GL_OPERAND_LINEAR_GRADIENT: + case CAIRO_GL_OPERAND_RADIAL_GRADIENT_A0: + case CAIRO_GL_OPERAND_RADIAL_GRADIENT_NONE: + case CAIRO_GL_OPERAND_RADIAL_GRADIENT_EXT: + filter = CAIRO_FILTER_BILINEAR; + break; + default: + filter = CAIRO_FILTER_DEFAULT; + break; + } + + return filter; +} + +GLint +_cairo_gl_operand_get_gl_filter (cairo_gl_operand_t *operand) +{ + cairo_filter_t filter = _cairo_gl_operand_get_filter (operand); + + return filter != CAIRO_FILTER_FAST && filter != CAIRO_FILTER_NEAREST ? + GL_LINEAR : + GL_NEAREST; +} + +cairo_extend_t +_cairo_gl_operand_get_extend (cairo_gl_operand_t *operand) +{ + cairo_extend_t extend; + + switch ((int) operand->type) { + case CAIRO_GL_OPERAND_TEXTURE: + extend = operand->texture.attributes.extend; + break; + case CAIRO_GL_OPERAND_LINEAR_GRADIENT: + case CAIRO_GL_OPERAND_RADIAL_GRADIENT_A0: + case CAIRO_GL_OPERAND_RADIAL_GRADIENT_NONE: + case CAIRO_GL_OPERAND_RADIAL_GRADIENT_EXT: + extend = operand->gradient.extend; + break; + default: + extend = CAIRO_EXTEND_NONE; + break; + } + + return extend; +} + + cairo_int_status_t _cairo_gl_composite_set_source (cairo_gl_composite_t *setup, const cairo_pattern_t *pattern, |