summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Mikos <metastability@opencompositing.org>2008-01-29 10:37:05 +1030
committerDavid Mikos <metastability@opencompositing.org>2008-01-29 10:37:05 +1030
commit4c9996f7c44436e77abccde5d333d425630b759a (patch)
tree9e158f830b7c1202370fec0d430d93233299c12e
parentb6f81794236e48cf3b1abff8fa93f1771f37eb6d (diff)
downloadrubik-4c9996f7c44436e77abccde5d333d425630b759a.tar.gz
rubik-4c9996f7c44436e77abccde5d333d425630b759a.tar.bz2
Replace some utility functions with macros.
-rw-r--r--rubik-internal.h8
-rw-r--r--rubik.c8
-rw-r--r--util.c18
3 files changed, 8 insertions, 26 deletions
diff --git a/rubik-internal.h b/rubik-internal.h
index 6758d36..6a0769d 100644
--- a/rubik-internal.h
+++ b/rubik-internal.h
@@ -19,7 +19,10 @@
#include <math.h>
#include <float.h>
-#include <math.h>
+//return random number in range [0,x)
+#define randf(x) ((float) (rand()/(((double)RAND_MAX + 1)/(x))))
+
+
#include <compiz-core.h>
#include <compiz-cube.h>
@@ -162,9 +165,6 @@ void updateSpeedFactor(float);
//utility methods
-float randf(float); //random float
-float minimum(float,float); //my compiler at home didn't have min or fminf!
-float maximum(float,float); //nor did it have max or fmaxf!
void setColor(float *, float, float, float, float, float, float);
void setSpecifiedColor (float *, int);
void rotateClockwise (squareRec * square);
diff --git a/rubik.c b/rubik.c
index 6b0e5ce..e925008 100644
--- a/rubik.c
+++ b/rubik.c
@@ -544,11 +544,11 @@ static void rubikPaintInside (CompScreen *s,
x = ((float) w->attrib.x)/((float) s->width);
- float wh1 = maximum (y, h1);
- float wh2 = minimum (y+height, h2);
+ float wh1 = MAX (y, h1);
+ float wh2 = MIN (y+height, h2);
- float wv1 = maximum (x, v1);
- float wv2 = minimum (x+width, v2);
+ float wv1 = MAX (x, v1);
+ float wv2 = MIN (x+width, v2);
if (y>h1)
h1=y;
diff --git a/util.c b/util.c
index 278e192..7ebc983 100644
--- a/util.c
+++ b/util.c
@@ -4,24 +4,6 @@
#include <math.h>
#include <float.h>
-float
-randf(float x)
-{ //return random number in range [0,x)
- return rand()/(((double)RAND_MAX + 1) / x);
-}
-
-float
-minimum(float x, float y)
-{
- return ((x) < (y) ? (x) : (y));
-}
-
-float
-maximum(float x, float y)
-{
- return ((x) > (y) ? (x) : (y));
-}
-
void
setColor(float* color, float r, float g, float b, float a,
float randomOffset, float randomness)