diff options
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++) { |