[maemo-commits] [maemo-commits] r17330 - in projects/haf/trunk/clutter: clutter clutter/cogl/common debian

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Thu Jan 29 18:19:28 EET 2009
Author: gw
Date: 2009-01-29 18:19:26 +0200 (Thu, 29 Jan 2009)
New Revision: 17330

Modified:
   projects/haf/trunk/clutter/clutter/clutter-fixed.h
   projects/haf/trunk/clutter/clutter/cogl/common/cogl-clip-stack.c
   projects/haf/trunk/clutter/debian/changelog
Log:
 * Added FIXED_TO_INT_ROUND to round to the nearest(ish) integer rather than
    just clipping. Was to fix FP inaccuracies in the set_clip code



Modified: projects/haf/trunk/clutter/clutter/clutter-fixed.h
===================================================================
--- projects/haf/trunk/clutter/clutter/clutter-fixed.h	2009-01-29 14:17:11 UTC (rev 17329)
+++ projects/haf/trunk/clutter/clutter/clutter-fixed.h	2009-01-29 16:19:26 UTC (rev 17330)
@@ -217,6 +217,17 @@
  */
 #define CLUTTER_FIXED_TO_INT(x)         ((x) >> CFX_Q)
 
+/**
+ * CLUTTER_FIXED_TO_INT_ROUND:
+ * @x: a fixed point value
+ *
+ * Converts a fixed point value to integer, rounding it at the same time
+ *
+ * Since: 0.8.2-maemo15
+ */
+#define CLUTTER_FIXED_TO_INT_ROUND(x)         (((x)+CFX_HALF) >> CFX_Q)
+
+
 #ifndef CLUTTER_DISABLE_DEPRECATED
 
 /**

Modified: projects/haf/trunk/clutter/clutter/cogl/common/cogl-clip-stack.c
===================================================================
--- projects/haf/trunk/clutter/clutter/cogl/common/cogl-clip-stack.c	2009-01-29 14:17:11 UTC (rev 17329)
+++ projects/haf/trunk/clutter/clutter/cogl/common/cogl-clip-stack.c	2009-01-29 16:19:26 UTC (rev 17330)
@@ -204,10 +204,10 @@
         pta = cogl_util_unproject_f(entry->matrix, proj, viewport, pta);
         ptb = cogl_util_unproject_f(entry->matrix, proj, viewport, ptb);
 
-        entry->scr_x_1 = CLUTTER_FIXED_TO_INT(pta.x);
-        entry->scr_y_1 = CLUTTER_FIXED_TO_INT(pta.y);
-        entry->scr_x_2 = CLUTTER_FIXED_TO_INT(ptb.x);
-        entry->scr_y_2 = CLUTTER_FIXED_TO_INT(ptb.y);
+        entry->scr_x_1 = CLUTTER_FIXED_TO_INT_ROUND(pta.x);
+        entry->scr_y_1 = CLUTTER_FIXED_TO_INT_ROUND(pta.y);
+        entry->scr_x_2 = CLUTTER_FIXED_TO_INT_ROUND(ptb.x);
+        entry->scr_y_2 = CLUTTER_FIXED_TO_INT_ROUND(ptb.y);
         /* make sure _1 is < _2 for x and y */
         if (entry->scr_x_1 > entry->scr_x_2)
           {

Modified: projects/haf/trunk/clutter/debian/changelog
===================================================================
--- projects/haf/trunk/clutter/debian/changelog	2009-01-29 14:17:11 UTC (rev 17329)
+++ projects/haf/trunk/clutter/debian/changelog	2009-01-29 16:19:26 UTC (rev 17330)
@@ -2,8 +2,10 @@
 
   * Added Adam Endrodi's patch for DestroyNotify events causing the pixmap 
     to be destroyed in x11-texture-pixmap
+  * Added FIXED_TO_INT_ROUND to round to the nearest(ish) integer rather than
+    just clipping. Was to fix FP inaccuracies in the set_clip code
 
- -- Gordon Williams <gordon.williams at collabora.co.uk>  Mon, 26 Jan 2009 10:06:23 +0200
+ -- Gordon Williams <gordon.williams at collabora.co.uk>  Mon, 29 Jan 2009 16:06:23 +0000
 
 clutter (0.8.2-0maemo14) unstable; urgency=low
 


More information about the maemo-commits mailing list