diff options
author | Campbell Barton <campbell@blender.org> | 2022-09-25 10:04:52 +0300 |
---|---|---|
committer | Campbell Barton <campbell@blender.org> | 2022-09-25 11:26:27 +0300 |
commit | 891949cbb47143420f4324cb60efc05ef5d70b39 (patch) | |
tree | fe70a45612ae96f9ce1f37378ef5ff035d3127f5 /source/blender/blenkernel/intern/image_gen.c | |
parent | c9e35c2ced92082c86f1ecb9ecd16c6230218c7c (diff) |
Cleanup: use 'u' prefixed integer types for brevity & cast style
To use function style cast '(unsigned char)x' can't be replaced by
'unsigned char(x)'.
Diffstat (limited to 'source/blender/blenkernel/intern/image_gen.c')
-rw-r--r-- | source/blender/blenkernel/intern/image_gen.c | 35 |
1 files changed, 15 insertions, 20 deletions
diff --git a/source/blender/blenkernel/intern/image_gen.c b/source/blender/blenkernel/intern/image_gen.c index 32795baaa37..a0474d1ae7c 100644 --- a/source/blender/blenkernel/intern/image_gen.c +++ b/source/blender/blenkernel/intern/image_gen.c @@ -19,14 +19,14 @@ #include "BLF_api.h" typedef struct FillColorThreadData { - unsigned char *rect; + uchar *rect; float *rect_float; int width; float color[4]; } FillColorThreadData; static void image_buf_fill_color_slice( - unsigned char *rect, float *rect_float, int width, int height, const float color[4]) + uchar *rect, float *rect_float, int width, int height, const float color[4]) { int x, y; @@ -41,7 +41,7 @@ static void image_buf_fill_color_slice( } if (rect) { - unsigned char ccol[4]; + uchar ccol[4]; rgba_float_to_uchar(ccol, color); for (y = 0; y < height; y++) { for (x = 0; x < width; x++) { @@ -60,13 +60,13 @@ static void image_buf_fill_color_thread_do(void *data_v, int scanline) FillColorThreadData *data = (FillColorThreadData *)data_v; const int num_scanlines = 1; size_t offset = ((size_t)scanline) * data->width * 4; - unsigned char *rect = (data->rect != NULL) ? (data->rect + offset) : NULL; + uchar *rect = (data->rect != NULL) ? (data->rect + offset) : NULL; float *rect_float = (data->rect_float != NULL) ? (data->rect_float + offset) : NULL; image_buf_fill_color_slice(rect, rect_float, data->width, num_scanlines, data->color); } void BKE_image_buf_fill_color( - unsigned char *rect, float *rect_float, int width, int height, const float color[4]) + uchar *rect, float *rect_float, int width, int height, const float color[4]) { if (((size_t)width) * height < 64 * 64) { image_buf_fill_color_slice(rect, rect_float, width, height, color); @@ -82,7 +82,7 @@ void BKE_image_buf_fill_color( } static void image_buf_fill_checker_slice( - unsigned char *rect, float *rect_float, int width, int height, int offset) + uchar *rect, float *rect_float, int width, int height, int offset) { /* these two passes could be combined into one, but it's more readable and * easy to tweak like this, speed isn't really that much of an issue in this situation... */ @@ -90,7 +90,7 @@ static void image_buf_fill_checker_slice( int checkerwidth = 32; int x, y; - unsigned char *rect_orig = rect; + uchar *rect_orig = rect; float *rect_float_orig = rect_float; float hsv[3] = {0.0f, 0.9f, 0.9f}; @@ -178,7 +178,7 @@ static void image_buf_fill_checker_slice( } typedef struct FillCheckerThreadData { - unsigned char *rect; + uchar *rect; float *rect_float; int width; } FillCheckerThreadData; @@ -188,12 +188,12 @@ static void image_buf_fill_checker_thread_do(void *data_v, int scanline) FillCheckerThreadData *data = (FillCheckerThreadData *)data_v; size_t offset = ((size_t)scanline) * data->width * 4; const int num_scanlines = 1; - unsigned char *rect = (data->rect != NULL) ? (data->rect + offset) : NULL; + uchar *rect = (data->rect != NULL) ? (data->rect + offset) : NULL; float *rect_float = (data->rect_float != NULL) ? (data->rect_float + offset) : NULL; image_buf_fill_checker_slice(rect, rect_float, data->width, num_scanlines, scanline); } -void BKE_image_buf_fill_checker(unsigned char *rect, float *rect_float, int width, int height) +void BKE_image_buf_fill_checker(uchar *rect, float *rect_float, int width, int height) { if (((size_t)width) * height < 64 * 64) { image_buf_fill_checker_slice(rect, rect_float, width, height, 0); @@ -214,7 +214,7 @@ void BKE_image_buf_fill_checker(unsigned char *rect, float *rect_float, int widt ((real + (char)(add * 255.0f)) <= 255) ? (real + (char)(add * 255.0f)) : 255 static void checker_board_color_fill( - unsigned char *rect, float *rect_float, int width, int height, int offset, int total_height) + uchar *rect, float *rect_float, int width, int height, int offset, int total_height) { int hue_step, y, x; float hsv[3], rgb[3]; @@ -255,13 +255,8 @@ static void checker_board_color_fill( } } -static void checker_board_color_tint(unsigned char *rect, - float *rect_float, - int width, - int height, - int size, - float blend, - int offset) +static void checker_board_color_tint( + uchar *rect, float *rect_float, int width, int height, int size, float blend, int offset) { int x, y; float blend_half = blend * 0.5f; @@ -310,7 +305,7 @@ static void checker_board_color_tint(unsigned char *rect, } static void checker_board_grid_fill( - unsigned char *rect, float *rect_float, int width, int height, float blend, int offset) + uchar *rect, float *rect_float, int width, int height, float blend, int offset) { int x, y; for (y = offset; y < height + offset; y++) { @@ -348,7 +343,7 @@ static void checker_board_grid_fill( /* defined in image.c */ static void checker_board_text( - unsigned char *rect, float *rect_float, int width, int height, int step, int outline) + uchar *rect, float *rect_float, int width, int height, int step, int outline) { int x, y; int pen_x, pen_y; |