From ec1ca17b71b41159ea8754d42954863b62623536 Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Thu, 13 May 2010 12:07:53 +0200 Subject: [PATCH] gl: Don't create 0x0 surfaces We get a very annoyed libGL if we try to create 0x0 textures, so we return an image surface instead. Tested by the zero-mask test. --- src/cairo-gl-surface.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/cairo-gl-surface.c b/src/cairo-gl-surface.c index 27fc02c77..eb2e91b59 100644 --- a/src/cairo-gl-surface.c +++ b/src/cairo-gl-surface.c @@ -535,6 +535,10 @@ _cairo_gl_surface_create_similar (void *abstract_surface, cairo_gl_context_t *ctx; cairo_status_t status; + if (width < 1 || height < 1) + return cairo_image_surface_create (_cairo_format_from_content (content), + width, height); + status = _cairo_gl_context_acquire (surface->device, &ctx); if (unlikely (status)) return _cairo_surface_create_in_error (status);