[cairo] [PATCH]: gl: Extend oversize check to cairo_gl_surface_create_for_texture

Martin Robinson mrobinson at igalia.com
Thu Aug 29 16:08:19 PDT 2013


commit 1992984d8bc0116c6459b918564f4d00948d0c2a
Author: Martin Robinson <mrobinson at igalia.com>
Date:   Thu Aug 29 16:04:19 2013 -0700

    gl: Extend oversize check to cairo_gl_surface_create_for_texture
    
    If a texture is too large to render to via a framebuffer, then eagerly
    fail with an error surface.

diff --git a/src/cairo-gl-surface.c b/src/cairo-gl-surface.c
index c287a01..b58c536 100644
--- a/src/cairo-gl-surface.c
+++ b/src/cairo-gl-surface.c
@@ -681,6 +681,11 @@ cairo_gl_surface_create_for_texture (cairo_device_t	*abstract_device,
     if (unlikely (status))
 	return _cairo_surface_create_in_error (status);
 
+    if (! _cairo_gl_surface_size_valid_for_context (ctx, width, height)) {
+	status = _cairo_gl_context_release (ctx, status);
+	return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_INVALID_SIZE));
+    }
+
     surface = (cairo_gl_surface_t *)
 	_cairo_gl_surface_create_scratch_for_texture (ctx, content,
 						      tex, width, height);



More information about the cairo mailing list