diff options
author | Benjamin Otte <otte@redhat.com> | 2010-04-07 21:58:18 +0200 |
---|---|---|
committer | Benjamin Otte <otte@redhat.com> | 2010-04-23 23:30:29 +0200 |
commit | 7be9c14cdafa9e556e30f8525a45ec3284a6bed8 (patch) | |
tree | ea6a124e0b6360974bc36ccc4834646f2e392e12 | |
parent | 9a138cd55e4b353a21f840eadf22e28085203c1a (diff) |
gl: Make device (un)lock (un)set the current context
-rw-r--r-- | src/cairo-gl-private.h | 1 | ||||
-rw-r--r-- | src/cairo-gl-surface.c | 20 | ||||
-rw-r--r-- | src/cairo-gl.h | 3 |
3 files changed, 24 insertions, 0 deletions
diff --git a/src/cairo-gl-private.h b/src/cairo-gl-private.h index c283620d..803b00ac 100644 --- a/src/cairo-gl-private.h +++ b/src/cairo-gl-private.h @@ -352,5 +352,6 @@ _cairo_gl_get_program (cairo_gl_context_t *ctx, cairo_gl_shader_program_t **out_program); slim_hidden_proto (cairo_gl_surface_create); +slim_hidden_proto (cairo_gl_surface_make_current); #endif /* CAIRO_GL_PRIVATE_H */ diff --git a/src/cairo-gl-surface.c b/src/cairo-gl-surface.c index 5c8419ab..eee0c271 100644 --- a/src/cairo-gl-surface.c +++ b/src/cairo-gl-surface.c @@ -356,6 +356,26 @@ _cairo_gl_set_destination (cairo_gl_surface_t *surface) glLoadIdentity (); } +void +cairo_gl_surface_make_current (cairo_surface_t *surface) +{ + cairo_gl_context_t *ctx = (cairo_gl_context_t *) surface->device; + + cairo_status_t status; + + if (! _cairo_surface_is_gl (surface)) { + status = _cairo_surface_set_error (surface, + CAIRO_STATUS_SURFACE_TYPE_MISMATCH); + return; + } + + /* external API calling into us is bad */ + assert (ctx->current_target == NULL); + _cairo_gl_set_destination ((cairo_gl_surface_t *) surface); + ctx->current_target = NULL; +} +slim_hidden_def (cairo_gl_surface_make_current); + cairo_bool_t _cairo_gl_operator_is_supported (cairo_operator_t op) { diff --git a/src/cairo-gl.h b/src/cairo-gl.h index 4f1912f4..b9ee88a3 100644 --- a/src/cairo-gl.h +++ b/src/cairo-gl.h @@ -46,6 +46,9 @@ cairo_gl_surface_create (cairo_device_t *device, int width, int height); cairo_public void +cairo_gl_surface_make_current (cairo_surface_t *surface); + +cairo_public void cairo_gl_surface_set_size (cairo_surface_t *surface, int width, int height); cairo_public int |