gl area: Avoid trivialities

If we have zero pixels, no need to snapshot anything,
and produce GL errors while doing so.
This commit is contained in:
Matthias Clasen 2018-01-17 14:43:50 -05:00
parent b6d85b9e31
commit 736ccd34f0

View File

@ -582,6 +582,13 @@ gtk_gl_area_snapshot (GtkWidget *widget,
int w, h, scale; int w, h, scale;
GLenum status; GLenum status;
scale = gtk_widget_get_scale_factor (widget);
w = gtk_widget_get_width (widget) * scale;
h = gtk_widget_get_height (widget) * scale;
if (w == 0 || h == 0)
return;
if (priv->error != NULL) if (priv->error != NULL)
{ {
gtk_gl_area_draw_error_screen (area, gtk_gl_area_draw_error_screen (area,
@ -603,10 +610,6 @@ gtk_gl_area_snapshot (GtkWidget *widget,
else else
glDisable (GL_DEPTH_TEST); glDisable (GL_DEPTH_TEST);
scale = gtk_widget_get_scale_factor (widget);
w = gtk_widget_get_width (widget) * scale;
h = gtk_widget_get_height (widget) * scale;
status = glCheckFramebufferStatusEXT (GL_FRAMEBUFFER_EXT); status = glCheckFramebufferStatusEXT (GL_FRAMEBUFFER_EXT);
if (status == GL_FRAMEBUFFER_COMPLETE_EXT) if (status == GL_FRAMEBUFFER_COMPLETE_EXT)
{ {
@ -647,7 +650,7 @@ gtk_gl_area_snapshot (GtkWidget *widget,
} }
else else
{ {
g_warning ("fb setup not supported"); g_warning ("fb setup not supported (%x)", status);
} }
} }