Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2011-03-27 19:54:20 +0400
committerCampbell Barton <ideasman42@gmail.com>2011-03-27 19:54:20 +0400
commit59cdbfd8849315984e280b92968d6cf1d9d44c4b (patch)
treecc5cafe931596dc98d6761d07bb766f929ef13c5 /source/blender/blenlib/intern/math_color.c
parent617e6a83bc89ca36e18bd06d851a31c010e11db2 (diff)
math lib and UV project: floats were being implicitly promoted to doubles, adjust to use floats.
Diffstat (limited to 'source/blender/blenlib/intern/math_color.c')
-rw-r--r--source/blender/blenlib/intern/math_color.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/source/blender/blenlib/intern/math_color.c b/source/blender/blenlib/intern/math_color.c
index 8699c3664a6..85636d23f6f 100644
--- a/source/blender/blenlib/intern/math_color.c
+++ b/source/blender/blenlib/intern/math_color.c
@@ -45,9 +45,9 @@ void hsv_to_rgb(float h, float s, float v, float *r, float *g, float *b)
*b = v;
}
else {
- h= (h - floor(h))*6.0f;
+ h= (h - floorf(h))*6.0f;
- i = (int)floor(h);
+ i = (int)floorf(h);
f = h - i;
p = v*(1.0f-s);
q = v*(1.0f-(s*f));
@@ -308,11 +308,11 @@ unsigned int rgb_to_cpack(float r, float g, float b)
{
int ir, ig, ib;
- ir= (int)floor(255.0*r);
+ ir= (int)floor(255.0f*r);
if(ir<0) ir= 0; else if(ir>255) ir= 255;
- ig= (int)floor(255.0*g);
+ ig= (int)floor(255.0f*g);
if(ig<0) ig= 0; else if(ig>255) ig= 255;
- ib= (int)floor(255.0*b);
+ ib= (int)floor(255.0f*b);
if(ib<0) ib= 0; else if(ib>255) ib= 255;
return (ir+ (ig*256) + (ib*256*256));
@@ -342,9 +342,9 @@ void rgb_float_to_byte(const float *in, unsigned char *out)
{
int r, g, b;
- r= (int)(in[0] * 255.0);
- g= (int)(in[1] * 255.0);
- b= (int)(in[2] * 255.0);
+ r= (int)(in[0] * 255.0f);
+ g= (int)(in[1] * 255.0f);
+ b= (int)(in[2] * 255.0f);
out[0]= (char)((r <= 0)? 0 : (r >= 255)? 255 : r);
out[1]= (char)((g <= 0)? 0 : (g >= 255)? 255 : g);
@@ -509,8 +509,8 @@ void rgb_float_set_hue_float_offset(float rgb[3], float hue_offset)
rgb_to_hsv(rgb[0], rgb[1], rgb[2], hsv, hsv+1, hsv+2);
hsv[0]+= hue_offset;
- if(hsv[0]>1.0) hsv[0]-=1.0;
- else if(hsv[0]<0.0) hsv[0]+= 1.0;
+ if(hsv[0] > 1.0f) hsv[0] -= 1.0f;
+ else if(hsv[0] < 0.0f) hsv[0] += 1.0f;
hsv_to_rgb(hsv[0], hsv[1], hsv[2], rgb, rgb+1, rgb+2);
}