Replaces uses of CoglAngle with floats (Though the CoglAngle type remains)

The CoglAngle type can still be used for focused optimisations since the type
and macros remain. Uses of CoglAngle within Cogl have been replaced with floats;
COGL_ANGLE_FROM_DEG is no longer used anywhere and the replacements for
cogl_angle_cos -> cosf (same for sin) have been fixed to convert float values
in degrees to radians. This fixes the cogl-primitives API.
This commit is contained in:
Robert Bragg 2009-01-07 15:33:24 +00:00
parent 1eeb21c155
commit 65e7bc6363

View File

@ -51,9 +51,11 @@ find ./clutter -iname '*.[ch]' -exec sed -i 's/COGL_FIXED_1/1.0/g' {} \;
find ./clutter -iname '*.[ch]' -exec sed -i 's/COGL_FIXED_0_5/0.5/g' {} \;
find ./clutter -iname '*.[ch]' -exec sed -i 's/COGL_FIXED_PI/G_PI/g' {} \;
find ./clutter -iname '*.[ch]' -exec sed -i 's/cogl_angle_cos/cosf/g' {} \;
find ./clutter -iname '*.[ch]' -exec sed -i 's/cogl_angle_sin/sinf/g' {} \;
find ./clutter -iname '*.[ch]' -exec sed -i 's/cogl_angle_tan/tanf/g' {} \;
find ./clutter -iname '*.[ch]' -exec sed -i -r 's/COGL_ANGLE_FROM_DEG \((.*)\),/\1,/g' {} \;
find ./clutter -iname '*.[ch]' -exec perl -p -i -e "s|cogl_angle_cos \((.*?)\)|cosf (\1 * (G_PI/180.0))|;" {} \;
find ./clutter -iname '*.[ch]' -exec perl -p -i -e "s|cogl_angle_sin \((.*?)\)|sinf (\1 * (G_PI/180.0))|;" {} \;
find ./clutter -iname '*.[ch]' -exec perl -p -i -e "s|cogl_angle_tan \((.*?)\)|tanf (\1 * (G_PI/180.0))|;" {} \;
#XXX: NB: cogl_fixed_div must be done before mul since there is a case were they
#are nested which would otherwise break the assumption used here that the last
@ -104,6 +106,15 @@ sed -i 's/float:/CoglFixed:/g' clutter/cogl/cogl-types.h
sed -i 's/gint32 float/gint32 CoglFixed/g' clutter/cogl/cogl-types.h
git-checkout clutter/cogl/cogl-fixed.h clutter/cogl/common/cogl-fixed.c
find ./clutter -iname '*.[ch]' -exec sed -i 's/CoglAngle/float/g' {} \;
# maintain the existing CoglAngle code as utility code for applications:
sed -i 's/float:/CoglAngle:/g' clutter/cogl/cogl-types.h
sed -i 's/gint32 float/gint32 CoglAngle/g' clutter/cogl/cogl-types.h
git-checkout clutter/cogl/cogl-fixed.h clutter/cogl/common/cogl-fixed.c
find ./clutter -iname '*.[ch]' ! -iname 'clutter-fixed.h' -exec sed -i 's/ClutterAngle/float/g' {} \;
echo "Cogl API to remove/replace with float versions:"
find ./clutter/ -iname '*.c' -exec grep '^cogl_[a-zA-Z_]*x ' {} \; | cut -d' ' -f1|grep -v 'box$'|grep -v 'matrix$'
echo "Clutter API to remove/replace with float versions:"