canvas: avoid emission of "draw" signal when the size is zero
authorStefano Facchini <stefano.facchini@gmail.com>
Thu, 29 Mar 2012 12:35:50 +0000 (14:35 +0200)
committerStefano Facchini <stefano.facchini@gmail.com>
Thu, 29 Mar 2012 13:14:29 +0000 (15:14 +0200)
This also avoids the warning

  Cogl-WARNING **: ./cogl-buffer.c:215: GL error (1285): Out of memory

generated by cogl_buffer_map when the CoglBuffer has zero length.

clutter/clutter-canvas.c

index 7913936..b77af55 100644 (file)
@@ -333,7 +333,7 @@ clutter_canvas_emit_draw (ClutterCanvas *self)
   gboolean res;
   cairo_t *cr;
 
-  g_assert (priv->width >= 0 && priv->width >= 0);
+  g_assert (priv->width > 0 && priv->width > 0);
 
   if (priv->buffer == NULL)
     {
@@ -411,7 +411,7 @@ clutter_canvas_invalidate (ClutterContent *content)
       priv->buffer = NULL;
     }
 
-  if (priv->width < 0 || priv->height < 0)
+  if (priv->width <= 0 || priv->height <= 0)
     return;
 
   clutter_canvas_emit_draw (self);