From 49192f60b61d97be9b1705dd898dd97e2d5634fb Mon Sep 17 00:00:00 2001 From: Neil Roberts Date: Mon, 20 Oct 2008 09:43:12 +0000 Subject: [PATCH] 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. --- ChangeLog | 9 +++++++++ clutter/clutter-behaviour-bspline.c | 12 +++++++----- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index ff6bb5a07..bf37455db 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2008-10-20 Neil Roberts + + 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 reviewed by: Emmanuele Bassi diff --git a/clutter/clutter-behaviour-bspline.c b/clutter/clutter-behaviour-bspline.c index fd5a0204b..53c44d1db 100644 --- a/clutter/clutter-behaviour-bspline.c +++ b/clutter/clutter-behaviour-bspline.c @@ -68,14 +68,16 @@ ****************************************************************************/ /* - * 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) /*