[gtk+] gl area: Avoid trivialities



commit 736ccd34f01bd9d8e753e45a7444f50c366dddf7
Author: Matthias Clasen <mclasen redhat com>
Date:   Wed Jan 17 14:43:50 2018 -0500

    gl area: Avoid trivialities
    
    If we have zero pixels, no need to snapshot anything,
    and produce GL errors while doing so.

 gtk/gtkglarea.c |   13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)
---
diff --git a/gtk/gtkglarea.c b/gtk/gtkglarea.c
index d93edd0..7c14521 100644
--- a/gtk/gtkglarea.c
+++ b/gtk/gtkglarea.c
@@ -582,6 +582,13 @@ gtk_gl_area_snapshot (GtkWidget   *widget,
   int w, h, scale;
   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)
     {
       gtk_gl_area_draw_error_screen (area,
@@ -603,10 +610,6 @@ gtk_gl_area_snapshot (GtkWidget   *widget,
  else
    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);
   if (status == GL_FRAMEBUFFER_COMPLETE_EXT)
     {
@@ -647,7 +650,7 @@ gtk_gl_area_snapshot (GtkWidget   *widget,
     }
   else
     {
-      g_warning ("fb setup not supported");
+      g_warning ("fb setup not supported (%x)", status);
     }
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]