[PATCH]: gl: Extend oversize check to cairo_gl_surface_create_for_texture

Martin Robinson <[email protected]>
Newsgroups gmane.comp.lib.cairo
Message-ID <[email protected]>
commit 1992984d8bc0116c6459b918564f4d00948d0c2a
Author: Martin Robinson <[email protected]>
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);

-- 
cairo mailing list
[email protected]
http://lists.cairographics.org/mailman/listinfo/cairo
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.