Bug 1195 - ClutterBehaviourBspline only works for very short paths
authorNeil Roberts <neil@openedhand.com>
Mon, 20 Oct 2008 09:43:12 +0000 (09:43 +0000)
committerNeil Roberts <neil@openedhand.com>
Mon, 20 Oct 2008 09:43:12 +0000 (09:43 +0000)
        * clutter/clutter-behaviour-bspline.c: Changed the CBZ_T_POW3 and
        CBZ_T_MUL functions so that they preserve more of the least
        significant bits. This fixes some of the jaggy behaviour with
        longer paths.

ChangeLog
clutter/clutter-behaviour-bspline.c

index ff6bb5a..bf37455 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2008-10-20  Neil Roberts  <neil@linux.intel.com>
+
+       Bug 1195 - ClutterBehaviourBspline only works for very short paths
+
+       * clutter/clutter-behaviour-bspline.c: Changed the CBZ_T_POW3 and
+       CBZ_T_MUL functions so that they preserve more of the least
+       significant bits. This fixes some of the jaggy behaviour with
+       longer paths.
+
 2008-10-17  Thomas Wood  <thomas@linux.intel.com>
 
        reviewed by: Emmanuele Bassi <ebassi@linux.intel.com>
index fd5a020..53c44d1 100644 (file)
  ****************************************************************************/
 
 /*
- * The t parameter of the bezier is from interval <0,1>, so we use
- * 14.18 fixed format to improve precission and simplify POW3 calculation.
+ * The t parameter of the bezier is from interval <0,1>, so we can use
+ * 14.18 format and special multiplication functions that preserve
+ * more of the least significant bits but would overflow if the value
+ * is > 1
  */
 #define CBZ_T_Q 18
 #define CBZ_T_ONE (1 << CBZ_T_Q)
-#define CBZ_T_POW2(x) ((x >> 9) * (x >> 9))
-#define CBZ_T_POW3(x) ((x >> 12) * (x >> 12) * (x >> 12))
-#define CBZ_T_MUL(x,y) ((x >> 9) * (y >> 9))
+#define CBZ_T_MUL(x,y) ((((x) >> 3) * ((y) >> 3)) >> 12)
+#define CBZ_T_POW2(x) CBZ_T_MUL (x, x)
+#define CBZ_T_POW3(x) CBZ_T_MUL (CBZ_T_POW2 (x), x)
 #define CBZ_T_DIV(x,y) ((((x) << 9)/(y)) << 9)
 
 /*