gl: Add an assertion that a context cannot call _begin() twice

Evert _begin() call must be followed by an _end() call to avoid any
nastiness. Just like GL. :)
This commit is contained in:
Benjamin Otte 2010-05-19 21:54:32 +02:00
parent 5b8b1fe1cb
commit d9d5976bdf
2 changed files with 9 additions and 0 deletions

View file

@ -1072,6 +1072,8 @@ _cairo_gl_composite_begin (cairo_gl_context_t *ctx,
unsigned int dst_size, src_size, mask_size;
cairo_status_t status;
assert (! _cairo_gl_context_is_in_progress (ctx));
/* Do various magic for component alpha */
if (setup->has_component_alpha) {
status = _cairo_gl_composite_begin_component_alpha (ctx, setup);

View file

@ -221,6 +221,13 @@ _cairo_gl_context_create_in_error (cairo_status_t status)
cairo_private cairo_status_t
_cairo_gl_context_init (cairo_gl_context_t *ctx);
static cairo_always_inline cairo_bool_t cairo_warn
_cairo_gl_context_is_in_progress (cairo_gl_context_t *ctx)
{
/* This variable gets set when _begin() is called */
return ctx->vertex_size != 0;
}
cairo_private void
_cairo_gl_surface_init (cairo_device_t *device,
cairo_gl_surface_t *surface,