diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-01-19 14:04:51 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-01-19 14:04:51 +0400 |
commit | a87c5eb52cd4951b138f518bf12d498bc5e5eb8a (patch) | |
tree | 7b023285cb2ff41924d9e390f3d6a25715284d14 /source/blender/blenkernel/intern/image_gen.c | |
parent | 47514a0d7129ba49cd9ad039a886c52909ea565d (diff) |
use color conversions functions in more places.
also add rgba_float_to_uchar, rgba_uchar_to_float
Diffstat (limited to 'source/blender/blenkernel/intern/image_gen.c')
-rw-r--r-- | source/blender/blenkernel/intern/image_gen.c | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/source/blender/blenkernel/intern/image_gen.c b/source/blender/blenkernel/intern/image_gen.c index a93d0221cf0..c6cb8c9582a 100644 --- a/source/blender/blenkernel/intern/image_gen.c +++ b/source/blender/blenkernel/intern/image_gen.c @@ -33,7 +33,7 @@ #include "BLI_math_base.h" #include "BLF_api.h" -void BKE_image_buf_fill_color(unsigned char *rect, float *rect_float, int width, int height, float color[4]) +void BKE_image_buf_fill_color(unsigned char *rect, float *rect_float, int width, int height, const float color[4]) { int x, y; @@ -41,22 +41,17 @@ void BKE_image_buf_fill_color(unsigned char *rect, float *rect_float, int width, if(rect_float) { for(y= 0; y<height; y++) { for(x= 0; x<width; x++) { - rect_float[0]= color[0]; - rect_float[1]= color[1]; - rect_float[2]= color[2]; - rect_float[3]= color[3]; + copy_v4_v4(rect_float, color); rect_float+= 4; } } } if(rect) { - char ccol[4]; + unsigned char ccol[4]; + + rgba_float_to_uchar(ccol, color); - ccol[0]= (char)(color[0]*255.0f); - ccol[1]= (char)(color[1]*255.0f); - ccol[2]= (char)(color[2]*255.0f); - ccol[3]= (char)(color[3]*255.0f); for(y= 0; y<height; y++) { for(x= 0; x<width; x++) { |