[maemo-commits] [maemo-commits] r18209 - in projects/haf/trunk/clutter0.8: clutter clutter/cogl/common debian

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Thu Apr 30 16:42:29 EEST 2009
Author: gw
Date: 2009-04-30 16:42:26 +0300 (Thu, 30 Apr 2009)
New Revision: 18209

Modified:
   projects/haf/trunk/clutter0.8/clutter/clutter-actor.c
   projects/haf/trunk/clutter0.8/clutter/cogl/common/cogl-util.c
   projects/haf/trunk/clutter0.8/debian/changelog
Log:
  * Fixes: NB#113685 Changed cogl_util_unproject to detect potential divide by
    0 caused by a scale = 0 matrix.
  * Added checks to clutter_actor_set_scale to produce a g_critical when a 
    scale value is set to 0. While cogl_util_unproject is fixed, many other
    things will most likely be quite unhappy with a scale of 0.  


Modified: projects/haf/trunk/clutter0.8/clutter/clutter-actor.c
===================================================================
--- projects/haf/trunk/clutter0.8/clutter/clutter-actor.c	2009-04-30 11:50:01 UTC (rev 18208)
+++ projects/haf/trunk/clutter0.8/clutter/clutter-actor.c	2009-04-30 13:42:26 UTC (rev 18209)
@@ -4878,6 +4878,17 @@
   g_object_ref (self);
   g_object_freeze_notify (G_OBJECT (self));
 
+  if (scale_x==0)
+    {
+      g_critical("%s: X scale is being set to 0", __FUNCTION__);
+      scale_x = 1;
+    }
+  if (scale_y==0)
+    {
+      g_critical("%s: Y scale is being set to 0", __FUNCTION__);
+      scale_y = 1;
+    }
+
   self->priv->scale_x = scale_x;
   g_object_notify (G_OBJECT (self), "scale-x");
 

Modified: projects/haf/trunk/clutter0.8/clutter/cogl/common/cogl-util.c
===================================================================
--- projects/haf/trunk/clutter0.8/clutter/cogl/common/cogl-util.c	2009-04-30 11:50:01 UTC (rev 18208)
+++ projects/haf/trunk/clutter0.8/clutter/cogl/common/cogl-util.c	2009-04-30 13:42:26 UTC (rev 18209)
@@ -167,6 +167,9 @@
                            &res.y,
                            &res.z,
                            &_w);
+  if (_w == 0) {
+    _w = 1;
+  }
   res.x = MTX_GL_SCALE_X (res.x, _w, viewport[2], viewport[0]);
   res.y = MTX_GL_SCALE_Y2 (res.y, _w, viewport[3], viewport[1]);
   res.z = MTX_GL_SCALE_Z (res.z, _w, viewport[2], viewport[0]);
@@ -200,6 +203,9 @@
                              &res[1],
                              &res[2],
                              &res[3]);
+  if (res[3] == 0) {
+    res[3] = FLT_MIN;
+  }
   res[0] = MTX_GL_SCALE_X_F  (res[0], res[3], viewport_f[2], viewport_f[0]);
   res[1] = MTX_GL_SCALE_Y2_F (res[1], res[3], viewport_f[3], viewport_f[1]);
   res[2] = MTX_GL_SCALE_Z_F  (res[2], res[3], viewport_f[2], viewport_f[0]);

Modified: projects/haf/trunk/clutter0.8/debian/changelog
===================================================================
--- projects/haf/trunk/clutter0.8/debian/changelog	2009-04-30 11:50:01 UTC (rev 18208)
+++ projects/haf/trunk/clutter0.8/debian/changelog	2009-04-30 13:42:26 UTC (rev 18209)
@@ -1,6 +1,10 @@
 clutter (0.8.2-0maemo30~unreleased) unstable; urgency=low
 
-  * writeme
+  * Fixes: NB#113685 Changed cogl_util_unproject to detect potential divide by
+    0 caused by a scale = 0 matrix.
+  * Added checks to clutter_actor_set_scale to produce a g_critical when a 
+    scale value is set to 0. While cogl_util_unproject is fixed, many other
+    things will most likely be quite unhappy with a scale of 0.  
 
  -- Gordon Williams <gordon.williams at collabora.co.uk>  Thu, 30 Apr 2009 14:48:25 +0300
 


More information about the maemo-commits mailing list