diff options
-rw-r--r-- | source/blender/editors/sculpt_paint/paint_image.c | 4 | ||||
-rw-r--r-- | source/blender/imbuf/intern/rectop.c | 32 |
2 files changed, 19 insertions, 17 deletions
diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c index 96f1f60a7e5..1cfb8ed40fd 100644 --- a/source/blender/editors/sculpt_paint/paint_image.c +++ b/source/blender/editors/sculpt_paint/paint_image.c @@ -3695,7 +3695,7 @@ typedef struct ProjectHandle { int thread_index; } ProjectHandle; -static void blend_color_mix(unsigned char *cp, const unsigned char *cp1, const unsigned char *cp2, const int fac) +static void blend_color_mix(unsigned char cp[4], const unsigned char cp1[4], const unsigned char cp2[4], const int fac) { /* this and other blending modes previously used >>8 instead of /255. both * are not equivalent (>>8 is /256), and the former results in rounding @@ -3708,7 +3708,7 @@ static void blend_color_mix(unsigned char *cp, const unsigned char *cp1, const u cp[3] = (mfac * cp1[3] + fac * cp2[3]) / 255; } -static void blend_color_mix_float(float *cp, const float *cp1, const float *cp2, const float fac) +static void blend_color_mix_float(float cp[4], const float cp1[4], const float cp2[4], const float fac) { const float mfac = 1.0f - fac; cp[0] = mfac * cp1[0] + fac * cp2[0]; diff --git a/source/blender/imbuf/intern/rectop.c b/source/blender/imbuf/intern/rectop.c index ab805ea6666..c3e23246638 100644 --- a/source/blender/imbuf/intern/rectop.c +++ b/source/blender/imbuf/intern/rectop.c @@ -46,19 +46,19 @@ /* blend modes */ -static void blend_color_mix(char *cp, char *cp1, char *cp2, int fac) +static void blend_color_mix(char cp[3], const char cp1[3], const char cp2[3], const int fac) { /* this and other blending modes previously used >>8 instead of /255. both * are not equivalent (>>8 is /256), and the former results in rounding * errors that can turn colors black fast after repeated blending */ - int mfac = 255 - fac; + const int mfac = 255 - fac; cp[0] = (mfac * cp1[0] + fac * cp2[0]) / 255; cp[1] = (mfac * cp1[1] + fac * cp2[1]) / 255; cp[2] = (mfac * cp1[2] + fac * cp2[2]) / 255; } -static void blend_color_add(char *cp, char *cp1, char *cp2, int fac) +static void blend_color_add(char cp[3], const char cp1[3], const char cp2[3], const int fac) { int temp; @@ -70,7 +70,7 @@ static void blend_color_add(char *cp, char *cp1, char *cp2, int fac) if (temp > 254) cp[2] = 255; else cp[2] = temp; } -static void blend_color_sub(char *cp, char *cp1, char *cp2, int fac) +static void blend_color_sub(char cp[3], const char cp1[3], const char cp2[3], const int fac) { int temp; @@ -82,7 +82,7 @@ static void blend_color_sub(char *cp, char *cp1, char *cp2, int fac) if (temp < 0) cp[2] = 0; else cp[2] = temp; } -static void blend_color_mul(char *cp, char *cp1, char *cp2, int fac) +static void blend_color_mul(char cp[3], const char cp1[3], const char cp2[3], const int fac) { int mfac = 255 - fac; @@ -92,7 +92,7 @@ static void blend_color_mul(char *cp, char *cp1, char *cp2, int fac) cp[2] = (mfac * cp1[2] + fac * ((cp1[2] * cp2[2]) / 255)) / 255; } -static void blend_color_lighten(char *cp, char *cp1, char *cp2, int fac) +static void blend_color_lighten(char cp[3], const char cp1[3], const char cp2[3], const int fac) { /* See if are lighter, if so mix, else don't do anything. * if the paint col is darker then the original, then ignore */ @@ -101,11 +101,12 @@ static void blend_color_lighten(char *cp, char *cp1, char *cp2, int fac) cp[1] = cp1[1]; cp[2] = cp1[2]; } - else + else { blend_color_mix(cp, cp1, cp2, fac); + } } -static void blend_color_darken(char *cp, char *cp1, char *cp2, int fac) +static void blend_color_darken(char cp[3], const char cp1[3], const char cp2[3], const int fac) { /* See if were darker, if so mix, else don't do anything. * if the paint col is brighter then the original, then ignore */ @@ -114,8 +115,9 @@ static void blend_color_darken(char *cp, char *cp1, char *cp2, int fac) cp[1] = cp1[1]; cp[2] = cp1[2]; } - else + else { blend_color_mix(cp, cp1, cp2, fac); + } } unsigned int IMB_blend_color(unsigned int src1, unsigned int src2, int fac, IMB_BlendMode mode) @@ -162,7 +164,7 @@ unsigned int IMB_blend_color(unsigned int src1, unsigned int src2, int fac, IMB_ return dst; } -static void blend_color_mix_float(float *cp, float *cp1, float *cp2, float fac) +static void blend_color_mix_float(float cp[3], const float cp1[3], const float cp2[3], const float fac) { float mfac = 1.0f - fac; cp[0] = mfac * cp1[0] + fac * cp2[0]; @@ -170,7 +172,7 @@ static void blend_color_mix_float(float *cp, float *cp1, float *cp2, float fac) cp[2] = mfac * cp1[2] + fac * cp2[2]; } -static void blend_color_add_float(float *cp, float *cp1, float *cp2, float fac) +static void blend_color_add_float(float cp[3], const float cp1[3], const float cp2[3], const float fac) { cp[0] = cp1[0] + fac * cp2[0]; cp[1] = cp1[1] + fac * cp2[1]; @@ -181,7 +183,7 @@ static void blend_color_add_float(float *cp, float *cp1, float *cp2, float fac) if (cp[2] > 1.0f) cp[2] = 1.0f; } -static void blend_color_sub_float(float *cp, float *cp1, float *cp2, float fac) +static void blend_color_sub_float(float cp[3], const float cp1[3], const float cp2[3], const float fac) { cp[0] = cp1[0] - fac * cp2[0]; cp[1] = cp1[1] - fac * cp2[1]; @@ -192,7 +194,7 @@ static void blend_color_sub_float(float *cp, float *cp1, float *cp2, float fac) if (cp[2] < 0.0f) cp[2] = 0.0f; } -static void blend_color_mul_float(float *cp, float *cp1, float *cp2, float fac) +static void blend_color_mul_float(float cp[3], const float cp1[3], const float cp2[3], const float fac) { float mfac = 1.0f - fac; @@ -201,7 +203,7 @@ static void blend_color_mul_float(float *cp, float *cp1, float *cp2, float fac) cp[2] = mfac * cp1[2] + fac * (cp1[2] * cp2[2]); } -static void blend_color_lighten_float(float *cp, float *cp1, float *cp2, float fac) +static void blend_color_lighten_float(float cp[3], const float cp1[3], const float cp2[3], const float fac) { /* See if are lighter, if so mix, else don't do anything. * if the pafloat col is darker then the original, then ignore */ @@ -214,7 +216,7 @@ static void blend_color_lighten_float(float *cp, float *cp1, float *cp2, float f blend_color_mix_float(cp, cp1, cp2, fac); } -static void blend_color_darken_float(float *cp, float *cp1, float *cp2, float fac) +static void blend_color_darken_float(float cp[3], const float cp1[3], const float cp2[3], const float fac) { /* See if were darker, if so mix, else don't do anything. * if the pafloat col is brighter then the original, then ignore */ |