mirror of
https://github.com/brl/mutter.git
synced 2024-11-23 08:30:42 -05:00
[fixed-to-float.sh] Apply the automatic changes to the tests as well
Some of the tests are using the Cogl API so they should be updated to float as well. The patches have been updated to apply cleanly.
This commit is contained in:
parent
7a96ea9255
commit
ae3615cfe3
@ -712,25 +712,24 @@ index dcd7c93..db4e16a 100644
|
||||
<SUBSECTION>
|
||||
cogl_color_get_red
|
||||
diff --git a/tests/conform/test-backface-culling.c b/tests/conform/test-backface-culling.c
|
||||
index 3b7948e..b22228b 100644
|
||||
index 50c19fd..6303949 100644
|
||||
--- a/tests/conform/test-backface-culling.c
|
||||
+++ b/tests/conform/test-backface-culling.c
|
||||
@@ -121,8 +121,7 @@ on_paint (ClutterActor *actor, TestState *state)
|
||||
@@ -121,7 +121,7 @@ on_paint (ClutterActor *actor, TestState *state)
|
||||
|
||||
/* Set the color to white so that all the textures will be drawn
|
||||
at their own color */
|
||||
- cogl_set_source_color4x (COGL_FIXED_1, COGL_FIXED_1,
|
||||
- COGL_FIXED_1, COGL_FIXED_1);
|
||||
+ cogl_set_source_color4f (1.0f, 1.0f, 1.0f, 1.0f);
|
||||
- cogl_set_source_color4x (1.0, 1.0,
|
||||
+ cogl_set_source_color4f (1.0, 1.0,
|
||||
1.0, 1.0);
|
||||
|
||||
x2 = x1 + COGL_FIXED_FROM_INT (TEXTURE_SIZE);
|
||||
|
||||
@@ -173,7 +172,7 @@ on_paint (ClutterActor *actor, TestState *state)
|
||||
x2 = x1 + COGL_FIXED_FROM_INT (TEXTURE_SIZE);
|
||||
x2 = x1 + (float)(TEXTURE_SIZE);
|
||||
@@ -173,7 +173,7 @@ on_paint (ClutterActor *actor, TestState *state)
|
||||
x2 = x1 + (float)(TEXTURE_SIZE);
|
||||
|
||||
/* Draw a regular rectangle (this should always show) */
|
||||
- cogl_set_source_color4x (COGL_FIXED_1, 0, 0, COGL_FIXED_1);
|
||||
+ cogl_set_source_color4f (1.0f, 0.0f, 0.0f, 1.0f);
|
||||
cogl_rectangle (COGL_FIXED_TO_INT (x1), COGL_FIXED_TO_INT (y1),
|
||||
COGL_FIXED_TO_INT (x2 - x1), COGL_FIXED_TO_INT (y2 - y1));
|
||||
- cogl_set_source_color4x (1.0, 0, 0, 1.0);
|
||||
+ cogl_set_source_color4f (1.0, 0, 0, 1.0);
|
||||
cogl_rectangle ( (x1), (y1),
|
||||
(x2 - x1), (y2 - y1));
|
||||
|
||||
|
@ -1,35 +1,24 @@
|
||||
diff --git a/tests/interactive/test-cogl-tex-tile.c b/tests/interactive/test-cogl-tex-tile.c
|
||||
index fe7138a..5be6dd5 100644
|
||||
index 5063dff..177d60e 100644
|
||||
--- a/tests/interactive/test-cogl-tex-tile.c
|
||||
+++ b/tests/interactive/test-cogl-tex-tile.c
|
||||
@@ -90,22 +90,22 @@ test_coglbox_paint(ClutterActor *self)
|
||||
@@ -90,14 +90,14 @@ test_coglbox_paint(ClutterActor *self)
|
||||
ClutterFixed sin_frame, cos_frame;
|
||||
ClutterFixed frac_frame;
|
||||
gint t;
|
||||
- sin_frame = clutter_sini (CLUTTER_ANGLE_FROM_DEG (priv->frame));
|
||||
- cos_frame = clutter_cosi (CLUTTER_ANGLE_FROM_DEG (priv->frame));
|
||||
+ sin_frame = clutter_sinx (CLUTTER_INT_TO_FIXED (priv->frame));
|
||||
+ cos_frame = clutter_cosx (CLUTTER_INT_TO_FIXED (priv->frame));
|
||||
+ sin_frame = clutter_sinx (priv->frame);
|
||||
+ cos_frame = clutter_cosx (priv->frame);
|
||||
|
||||
pingpong_frame = (priv->frame <= 180 ? priv->frame : 360 - priv->frame);
|
||||
- frac_frame = COGL_FIXED_DIV (CLUTTER_INT_TO_FIXED (pingpong_frame),
|
||||
frac_frame = (CLUTTER_INT_TO_FIXED (pingpong_frame) /
|
||||
- CLUTTER_INT_TO_FIXED (180));
|
||||
- frac_frame += (COGL_FIXED_1 >> 1);
|
||||
- frac_frame += (1.0 >> 1);
|
||||
- frac_frame <<= 1;
|
||||
+ frac_frame = CLUTTER_FIXED_DIV (CLUTTER_INT_TO_FIXED (pingpong_frame),
|
||||
+ CLUTTER_INT_TO_FIXED (180));
|
||||
+ CLUTTER_INT_TO_FIXED (180));
|
||||
+ frac_frame += 0.5;
|
||||
+ frac_frame *= 2;
|
||||
|
||||
for (t=0; t<4; t+=2)
|
||||
{
|
||||
texcoords[t] += cos_frame;
|
||||
texcoords[t+1] += sin_frame;
|
||||
|
||||
- texcoords[t] = COGL_FIXED_MUL (texcoords[t], frac_frame);
|
||||
- texcoords[t+1] = COGL_FIXED_MUL (texcoords[t+1], frac_frame);
|
||||
+ texcoords[t] = CLUTTER_FIXED_MUL (texcoords[t], frac_frame);
|
||||
+ texcoords[t+1] = CLUTTER_FIXED_MUL (texcoords[t+1], frac_frame);
|
||||
}
|
||||
|
||||
priv = TEST_COGLBOX_GET_PRIVATE (self);
|
||||
|
@ -4,7 +4,7 @@
|
||||
# CoglFixed type + macros using fixed point so now we convert all uses of
|
||||
# the Cogl fixed point macros within Clutter proper to use the ClutterFixed
|
||||
# macros instead.
|
||||
find ./clutter -maxdepth 1 -iname '*.c' -exec sed -i \
|
||||
find ./clutter ./tests -maxdepth 1 -iname '*.c' -exec sed -i \
|
||||
-e 's/COGL_FIXED_MUL/CLUTTER_FIXED_MUL/g' \
|
||||
-e 's/COGL_FIXED_DIV/CLUTTER_FIXED_DIV/g' \
|
||||
-e 's/COGL_FIXED_FAST_MUL/CLUTTER_FIXED_MUL/g' \
|
||||
@ -27,7 +27,7 @@ find ./clutter -maxdepth 1 -iname '*.c' -exec sed -i \
|
||||
# XXX: (Note in the third regexp there were examples of COGL_FIXED_MUL
|
||||
# being used as the RHS argument, but since we have already replaced
|
||||
# instances of COGL_FIXED_MUL, that works out ok.
|
||||
find ./clutter -iname '*.[ch]' -exec sed -i -r \
|
||||
find ./clutter ./tests -iname '*.[ch]' -exec sed -i -r \
|
||||
-e 's/COGL_FIXED_MUL (.*),/\1 */g' \
|
||||
-e 's|COGL_FIXED_FAST_DIV (.*),|\1 /|g' \
|
||||
-e 's|COGL_FIXED_DIV (.*),|\1 /|g' \
|
||||
@ -40,7 +40,7 @@ find ./clutter/cogl/gles -iname '*.[ch]' -exec sed -i 's/GLfixed/GLfloat/g' {} \
|
||||
|
||||
#we get some redundant brackets like this, but C's automatic type promotion
|
||||
#works out fine for most cases...
|
||||
find ./clutter -iname '*.[ch]' -exec sed -r -i \
|
||||
find ./clutter ./tests -iname '*.[ch]' -exec sed -r -i \
|
||||
-e 's/COGL_FIXED_TO_INT//g' \
|
||||
-e 's/COGL_FIXED_FROM_INT /(float)/g' \
|
||||
-e 's/COGL_FIXED_FROM_INT/(float)/g' \
|
||||
@ -72,7 +72,7 @@ find ./clutter -iname '*.[ch]' -exec sed -r -i \
|
||||
#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
|
||||
#coma of the line can simply be replaced with the corresponding operator
|
||||
find ./clutter -iname '*.[ch]' -exec sed -i -r \
|
||||
find ./clutter ./tests -iname '*.[ch]' -exec sed -i -r \
|
||||
-e 's|cogl_fixed_div (.*),|\1 /|g' \
|
||||
-e 's|cogl_fixed_mul (.*),|\1 *|g' \
|
||||
-e 's/cogl_fixed_pow2/pow2f/g' \
|
||||
@ -110,9 +110,11 @@ sed -i -e 's|>> 1|/ 2|g' -e 's|<< 1|* 2|g' \
|
||||
#find ./clutter -iname '*.[ch]' -exec sed -i 's|<< 1|* 2|g' {} \;
|
||||
|
||||
|
||||
find ./clutter -iname '*.[ch]' -exec sed -i 's/CoglFixed/float/g' {} \;
|
||||
find ./clutter ./tests -iname '*.[ch]' \
|
||||
-exec sed -i 's/CoglFixed/float/g' {} \;
|
||||
#XXX: This might need changing later...
|
||||
find ./clutter -iname '*.[ch]' -exec sed -i 's/CoglFixedVec2/CoglVec2/g' {} \;
|
||||
find ./clutter ./tests -iname '*.[ch]' \
|
||||
-exec sed -i 's/CoglFixedVec2/CoglVec2/g' {} \;
|
||||
sed -i 's/CoglFixed/float/g' ./clutter/cogl/cogl.h.in
|
||||
|
||||
# maintain the existing CoglFixed code as utility code for applications:
|
||||
@ -120,14 +122,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' {} \;
|
||||
find ./clutter ./tests -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' {} \;
|
||||
find ./clutter ./tests -iname '*.[ch]' ! -iname 'clutter-fixed.h' \
|
||||
-exec sed -i 's/ClutterAngle/float/g' {} \;
|
||||
|
||||
# use the floating point names for GL ES functions instead of the
|
||||
# fixed. These get #define'd to the float versions in one of the
|
||||
@ -137,9 +140,9 @@ find ./clutter/cogl -iname '*.[ch]' -exec perl -p -i -e \
|
||||
|glRotate|glOrtho|glTexEnv|glClipPlane|glFog|glColor4))x(v?)\b/$1f$2/gx' {} \;
|
||||
|
||||
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$'
|
||||
find ./clutter/ ./tests -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:"
|
||||
find ./clutter/ -iname '*.c' -exec grep '^clutter_[a-zA-Z_]*x ' {} \; | cut -d' ' -f1|grep -v 'box$'|grep -v 'matrix$'|grep -v '_x$'
|
||||
find ./clutter/ ./tests -iname '*.c' -exec grep '^clutter_[a-zA-Z_]*x ' {} \; | cut -d' ' -f1|grep -v 'box$'|grep -v 'matrix$'|grep -v '_x$'
|
||||
|
||||
#
|
||||
# Now the last mile is dealt with manually with a bunch of patches...
|
||||
|
Loading…
Reference in New Issue
Block a user