summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Otte <otte@redhat.com>2010-05-19 21:54:32 +0200
committerBenjamin Otte <otte@redhat.com>2010-05-20 11:02:49 +0200
commitd9d5976bdf333a5a7ea7707bc3076696f3c079d2 (patch)
treee52ac82bd3cafdf4304af04655cb597430342796
parent5b8b1fe1cb692530b40db330c3040cd85a8b6bd7 (diff)
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. :)
-rw-r--r--src/cairo-gl-composite.c2
-rw-r--r--src/cairo-gl-private.h7
2 files changed, 9 insertions, 0 deletions
diff --git a/src/cairo-gl-composite.c b/src/cairo-gl-composite.c
index 8e3d32e3..76b6da04 100644
--- a/src/cairo-gl-composite.c
+++ b/src/cairo-gl-composite.c
@@ -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);
diff --git a/src/cairo-gl-private.h b/src/cairo-gl-private.h
index b88751d6..0cdbe732 100644
--- a/src/cairo-gl-private.h
+++ b/src/cairo-gl-private.h
@@ -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,