diff options
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r-- | source/blender/blenlib/BLI_math_vector.h | 5 | ||||
-rw-r--r-- | source/blender/blenlib/intern/math_color_blend_inline.c | 50 | ||||
-rw-r--r-- | source/blender/blenlib/intern/math_vector_inline.c | 24 |
3 files changed, 52 insertions, 27 deletions
diff --git a/source/blender/blenlib/BLI_math_vector.h b/source/blender/blenlib/BLI_math_vector.h index fc0dd76b003..01c00ddb48e 100644 --- a/source/blender/blenlib/BLI_math_vector.h +++ b/source/blender/blenlib/BLI_math_vector.h @@ -61,11 +61,14 @@ MINLINE void swap_v2_v2(float a[2], float b[2]); MINLINE void swap_v3_v3(float a[3], float b[3]); MINLINE void swap_v4_v4(float a[4], float b[4]); +/* unsigned char */ +MINLINE void copy_v2_v2_uchar(unsigned char r[2], const unsigned char a[2]); +MINLINE void copy_v3_v3_uchar(unsigned char r[3], const unsigned char a[3]); +MINLINE void copy_v4_v4_uchar(unsigned char r[4], const unsigned char a[4]); /* char */ MINLINE void copy_v2_v2_char(char r[2], const char a[2]); MINLINE void copy_v3_v3_char(char r[3], const char a[3]); MINLINE void copy_v4_v4_char(char r[4], const char a[4]); - /* short */ MINLINE void copy_v2_v2_short(short r[2], const short a[2]); MINLINE void copy_v3_v3_short(short r[3], const short a[3]); diff --git a/source/blender/blenlib/intern/math_color_blend_inline.c b/source/blender/blenlib/intern/math_color_blend_inline.c index 88be86aa1c2..048ab71c6dc 100644 --- a/source/blender/blenlib/intern/math_color_blend_inline.c +++ b/source/blender/blenlib/intern/math_color_blend_inline.c @@ -72,7 +72,7 @@ MINLINE void blend_color_mix_byte(unsigned char dst[4], const unsigned char src1 } else { /* no op */ - copy_v4_v4_char((char *)dst, (char *)src1); + copy_v4_v4_uchar(dst, src1); } } @@ -94,7 +94,7 @@ MINLINE void blend_color_add_byte(unsigned char dst[4], const unsigned char src1 } else { /* no op */ - copy_v4_v4_char((char *)dst, (char *)src1); + copy_v4_v4_uchar(dst, src1); } } @@ -116,7 +116,7 @@ MINLINE void blend_color_sub_byte(unsigned char dst[4], const unsigned char src1 } else { /* no op */ - copy_v4_v4_char((char *)dst, (char *)src1); + copy_v4_v4_uchar(dst, src1); } } @@ -139,7 +139,7 @@ MINLINE void blend_color_mul_byte(unsigned char dst[4], const unsigned char src1 } else { /* no op */ - copy_v4_v4_char((char *)dst, (char *)src1); + copy_v4_v4_uchar(dst, src1); } } @@ -162,7 +162,7 @@ MINLINE void blend_color_lighten_byte(unsigned char dst[4], const unsigned char } else { /* no op */ - copy_v4_v4_char((char *)dst, (char *)src1); + copy_v4_v4_uchar(dst, src1); } } @@ -185,7 +185,7 @@ MINLINE void blend_color_darken_byte(unsigned char dst[4], const unsigned char s } else { /* no op */ - copy_v4_v4_char((char *)dst, (char *)src1); + copy_v4_v4_uchar(dst, src1); } } @@ -202,7 +202,7 @@ MINLINE void blend_color_erase_alpha_byte(unsigned char dst[4], const unsigned c } else { /* no op */ - copy_v4_v4_char((char *)dst, (char *)src1); + copy_v4_v4_uchar(dst, src1); } } @@ -219,7 +219,7 @@ MINLINE void blend_color_add_alpha_byte(unsigned char dst[4], const unsigned cha } else { /* no op */ - copy_v4_v4_char((char *)dst, (char *)src1); + copy_v4_v4_uchar(dst, src1); } } @@ -244,7 +244,7 @@ MINLINE void blend_color_overlay_byte(unsigned char dst[4], unsigned const char } else { /* no op */ - copy_v4_v4_char((char *)dst, (char *)src1); + copy_v4_v4_uchar(dst, src1); } } @@ -270,7 +270,7 @@ MINLINE void blend_color_hardlight_byte(unsigned char dst[4], unsigned const cha } else { /* no op */ - copy_v4_v4_char((char *)dst, (char *)src1); + copy_v4_v4_uchar(dst, src1); } } @@ -289,7 +289,7 @@ MINLINE void blend_color_burn_byte(unsigned char dst[4], unsigned const char src } else { /* no op */ - copy_v4_v4_char((char *)dst, (char *)src1); + copy_v4_v4_uchar(dst, src1); } } @@ -308,7 +308,7 @@ MINLINE void blend_color_linearburn_byte(unsigned char dst[4], unsigned const ch } else { /* no op */ - copy_v4_v4_char((char *)dst, (char *)src1); + copy_v4_v4_uchar(dst, src1); } } @@ -327,7 +327,7 @@ MINLINE void blend_color_dodge_byte(unsigned char dst[4], unsigned const char sr } else { /* no op */ - copy_v4_v4_char((char *)dst, (char *)src1); + copy_v4_v4_uchar(dst, src1); } } @@ -345,7 +345,7 @@ MINLINE void blend_color_screen_byte(unsigned char dst[4], unsigned const char s } else { /* no op */ - copy_v4_v4_char((char *)dst, (char *)src1); + copy_v4_v4_uchar(dst, src1); } } @@ -371,7 +371,7 @@ MINLINE void blend_color_softlight_byte(unsigned char dst[4], unsigned const cha } else { /* no op */ - copy_v4_v4_char((char *)dst, (char *)src1); + copy_v4_v4_uchar(dst, src1); } } @@ -397,7 +397,7 @@ MINLINE void blend_color_pinlight_byte(unsigned char dst[4], unsigned const char } else { /* no op */ - copy_v4_v4_char((char *)dst, (char *)src1); + copy_v4_v4_uchar(dst, src1); } } @@ -423,7 +423,7 @@ MINLINE void blend_color_linearlight_byte(unsigned char dst[4], unsigned const c } else { /* no op */ - copy_v4_v4_char((char *)dst, (char *)src1); + copy_v4_v4_uchar(dst, src1); } } @@ -455,7 +455,7 @@ MINLINE void blend_color_vividlight_byte(unsigned char dst[4], unsigned const ch } else { /* no op */ - copy_v4_v4_char((char *)dst, (char *)src1); + copy_v4_v4_uchar(dst, src1); } } @@ -475,7 +475,7 @@ MINLINE void blend_color_difference_byte(unsigned char dst[4], unsigned const ch } else { /* no op */ - copy_v4_v4_char((char *)dst, (char *)src1); + copy_v4_v4_uchar(dst, src1); } } @@ -494,7 +494,7 @@ MINLINE void blend_color_exclusion_byte(unsigned char dst[4], unsigned const cha } else { /* no op */ - copy_v4_v4_char((char *)dst, (char *)src1); + copy_v4_v4_uchar(dst, src1); } } @@ -521,7 +521,7 @@ MINLINE void blend_color_color_byte(unsigned char dst[4], unsigned const char sr } else { /* no op */ - copy_v4_v4_char((char *)dst, (char *)src1); + copy_v4_v4_uchar(dst, src1); } } @@ -547,7 +547,7 @@ MINLINE void blend_color_hue_byte(unsigned char dst[4], unsigned const char src1 } else { /* no op */ - copy_v4_v4_char((char *)dst, (char *)src1); + copy_v4_v4_uchar(dst, src1); } } @@ -575,7 +575,7 @@ MINLINE void blend_color_saturation_byte(unsigned char dst[4], unsigned const ch } else { /* no op */ - copy_v4_v4_char((char *)dst, (char *)src1); + copy_v4_v4_uchar(dst, src1); } } @@ -601,7 +601,7 @@ MINLINE void blend_color_luminosity_byte(unsigned char dst[4], unsigned const ch } else { /* no op */ - copy_v4_v4_char((char *)dst, (char *)src1); + copy_v4_v4_uchar(dst, src1); } } @@ -621,7 +621,7 @@ MINLINE void blend_color_interpolate_byte(unsigned char dst[4], const unsigned c dst[3] = (unsigned char)divide_round_i(tmp, 255); } else { - copy_v4_v4_char((char *)dst, (char *)src1); + copy_v4_v4_uchar(dst, src1); } } diff --git a/source/blender/blenlib/intern/math_vector_inline.c b/source/blender/blenlib/intern/math_vector_inline.c index c21b09748c9..e625ac18685 100644 --- a/source/blender/blenlib/intern/math_vector_inline.c +++ b/source/blender/blenlib/intern/math_vector_inline.c @@ -97,7 +97,29 @@ MINLINE void copy_v4_fl(float r[4], float f) r[3] = f; } -/* short */ +/* unsigned char */ +MINLINE void copy_v2_v2_uchar(unsigned char r[2], const unsigned char a[2]) +{ + r[0] = a[0]; + r[1] = a[1]; +} + +MINLINE void copy_v3_v3_uchar(unsigned char r[3], const unsigned char a[3]) +{ + r[0] = a[0]; + r[1] = a[1]; + r[2] = a[2]; +} + +MINLINE void copy_v4_v4_uchar(unsigned char r[4], const unsigned char a[4]) +{ + r[0] = a[0]; + r[1] = a[1]; + r[2] = a[2]; + r[3] = a[3]; +} + +/* char */ MINLINE void copy_v2_v2_char(char r[2], const char a[2]) { r[0] = a[0]; |