summaryrefslogtreecommitdiff
path: root/src/cairo-gl-surface.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2011-11-23 23:05:14 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2011-11-24 10:16:22 +0000
commit5e4a0bd892263a5801fdaaa9fa5dbbcfc14c211a (patch)
tree87ab0b3e9931dd4f0659b05b6b317f455c5e7a80 /src/cairo-gl-surface.c
parent4cf001244a589b5bf1b3745327948f87c397c22f (diff)
gl: Embed a operand into the surface for pass-through
The traps compositor expects to be able to pass either in a surface or a source to its composite functions, so make it so. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src/cairo-gl-surface.c')
-rw-r--r--src/cairo-gl-surface.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/cairo-gl-surface.c b/src/cairo-gl-surface.c
index 49066320..a439a7b8 100644
--- a/src/cairo-gl-surface.c
+++ b/src/cairo-gl-surface.c
@@ -349,6 +349,28 @@ _cairo_gl_operator_is_supported (cairo_operator_t op)
return op < CAIRO_OPERATOR_SATURATE;
}
+static void
+_cairo_gl_surface_embedded_operand_init (cairo_gl_surface_t *surface)
+{
+ cairo_gl_operand_t *operand = &surface->operand;
+ cairo_surface_attributes_t *attributes = &operand->texture.attributes;
+
+ operand->type = CAIRO_GL_OPERAND_TEXTURE;
+ operand->texture.surface = surface;
+ operand->texture.tex = surface->tex;
+
+ if (_cairo_gl_device_requires_power_of_two_textures (surface->base.device)) {
+ cairo_matrix_init_identity (&attributes->matrix);
+ } else {
+ cairo_matrix_init_scale (&attributes->matrix,
+ 1.0 / surface->width,
+ 1.0 / surface->height);
+ }
+
+ attributes->extend = CAIRO_EXTEND_NONE;
+ attributes->filter = CAIRO_FILTER_NEAREST;
+}
+
void
_cairo_gl_surface_init (cairo_device_t *device,
cairo_gl_surface_t *surface,
@@ -363,6 +385,8 @@ _cairo_gl_surface_init (cairo_device_t *device,
surface->width = width;
surface->height = height;
surface->needs_update = FALSE;
+
+ _cairo_gl_surface_embedded_operand_init (surface);
}
static cairo_surface_t *