[cairo-commit] src/cairo-gl-gradient.c
Benjamin Otte
company at kemper.freedesktop.org
Sun Aug 8 08:25:36 PDT 2010
src/cairo-gl-gradient.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
New commits:
commit 9669faa936fe38da3615d7831e423befa5ecdfad
Author: Benjamin Otte <otte at redhat.com>
Date: Sun Aug 8 17:23:05 2010 +0200
gl: Handle errors from _cairo_gl_gradient_render()
Thanks Andrea for finding this.
diff --git a/src/cairo-gl-gradient.c b/src/cairo-gl-gradient.c
index 8ebcdfe..94c220b 100644
--- a/src/cairo-gl-gradient.c
+++ b/src/cairo-gl-gradient.c
@@ -192,6 +192,7 @@ _cairo_gl_gradient_create (cairo_gl_context_t *ctx,
{
unsigned long hash;
cairo_gl_gradient_t *gradient;
+ cairo_status_t status;
int tex_width;
void *data;
@@ -224,10 +225,16 @@ _cairo_gl_gradient_create (cairo_gl_context_t *ctx,
glBufferDataARB (GL_PIXEL_UNPACK_BUFFER_ARB, tex_width * sizeof (uint32_t), 0, GL_STREAM_DRAW);
data = glMapBufferARB (GL_PIXEL_UNPACK_BUFFER_ARB, GL_WRITE_ONLY);
- _cairo_gl_gradient_render (ctx, n_stops, stops, data, tex_width);
+ status = _cairo_gl_gradient_render (ctx, n_stops, stops, data, tex_width);
glUnmapBufferARB (GL_PIXEL_UNPACK_BUFFER_ARB);
+ if (unlikely (status)) {
+ glBindBufferARB (GL_PIXEL_UNPACK_BUFFER_ARB, 0);
+ free (gradient);
+ return status;
+ }
+
glGenTextures (1, &gradient->tex);
_cairo_gl_context_activate (ctx, CAIRO_GL_TEX_TEMP);
glBindTexture (GL_TEXTURE_1D, gradient->tex);
More information about the cairo-commit
mailing list