rearranged previous patch to compile with C89
authorJason Wilkins <Jason.A.Wilkins@gmail.com>
Sat, 28 May 2011 12:33:53 +0000 (12:33 +0000)
committerJason Wilkins <Jason.A.Wilkins@gmail.com>
Sat, 28 May 2011 12:33:53 +0000 (12:33 +0000)
conversion to double probably not needed
better comments

source/blender/makesrna/intern/rna_brush.c

index 97f6b902c46c034b16b4e4459edc3123bd89706a..c0c054ea2ac82345aa1908a61a661c1e3bc441c6 100644 (file)
@@ -168,11 +168,14 @@ static void rna_Brush_set_size(PointerRNA *ptr, int value)
 {
        Brush* me = (Brush*)(ptr->data);
 
-       // set unprojected radius, so they remain consistent
-       double size= (double)brush_size(me);
-       float unprojected_radius = 0.0f;
-       assert(size != 0); // paranoia: sanity checks during load and rna make sure we don't divide by zero here
-       unprojected_radius= (float)(brush_unprojected_radius(me) * (double)value / size);
+       float size= (float)brush_size(me);
+       float unprojected_radius;
+
+       // paranoia: previous checks should make sure we don't divide by zero
+       assert(size != 0);
+
+       // set unprojected radius, so it remains consistent with size
+       unprojected_radius= (float)(brush_unprojected_radius(me) * value / size);
        brush_set_unprojected_radius(me, unprojected_radius);
 
        brush_set_size(me, value);
@@ -224,11 +227,14 @@ static void rna_Brush_set_unprojected_radius(PointerRNA *ptr, float value)
 {
        Brush* me = (Brush*)(ptr->data);
 
-       // set size, so they remain consistent
-       double unprojected_radius= (double)brush_unprojected_radius(me);
-       int size = 0;
-       assert(unprojected_radius != 0); // paranoia: sanity checks during load and rna make sure we don't divide by zero here
-       size= (int)((double)brush_size(me) * (double)value / unprojected_radius);
+       float unprojected_radius= brush_unprojected_radius(me);
+       int size;
+
+       // paranoia: previous checks should make sure we don't divide by zero
+       assert(unprojected_radius != 0.0f);
+
+       // set size, so that it is consistent with unprojected_radius
+       size= (int)((float)brush_size(me) * value / unprojected_radius);
        brush_set_size(me, size);
 
        brush_set_unprojected_radius(me, value);