diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2013-01-15 12:37:17 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2013-01-15 12:37:17 +0400 |
commit | 0ce2d278b7a895a96c673f2c74020543b94413a3 (patch) | |
tree | 7f4bb96666c5cf26ca218c0bc53b6ec0d6edf06b /source/blender/blenlib | |
parent | 4f7465cac13262ca47e1196fe1cd585b79bcfe1f (diff) |
Follow general mathutils rules for naming straight<->premul functions
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r-- | source/blender/blenlib/BLI_math_color.h | 6 | ||||
-rw-r--r-- | source/blender/blenlib/intern/math_color_inline.c | 14 |
2 files changed, 16 insertions, 4 deletions
diff --git a/source/blender/blenlib/BLI_math_color.h b/source/blender/blenlib/BLI_math_color.h index 3831ec3cbb4..145427ea529 100644 --- a/source/blender/blenlib/BLI_math_color.h +++ b/source/blender/blenlib/BLI_math_color.h @@ -102,8 +102,10 @@ void BLI_init_srgb_conversion(void); /**************** Alpha Transformations *****************/ -MINLINE void premul_to_straight_v4(float straight[4], const float premul[4]); -MINLINE void straight_to_premul_v4(float straight[4], const float premul[4]); +MINLINE void premul_to_straight_v4_v4(float straight[4], const float premul[4]); +MINLINE void premul_to_straight_v4(float color[4]); +MINLINE void straight_to_premul_v4_v4(float straight[4], const float premul[4]); +MINLINE void straight_to_premul_v4(float color[4]); MINLINE void straight_uchar_to_premul_float(float result[4], const unsigned char color[4]); MINLINE void premul_float_to_straight_uchar(unsigned char *result, const float color[4]); diff --git a/source/blender/blenlib/intern/math_color_inline.c b/source/blender/blenlib/intern/math_color_inline.c index b8eeca50db6..c24da9fcf80 100644 --- a/source/blender/blenlib/intern/math_color_inline.c +++ b/source/blender/blenlib/intern/math_color_inline.c @@ -270,7 +270,7 @@ MINLINE int compare_rgb_uchar(const unsigned char col_a[3], const unsigned char /**************** Alpha Transformations *****************/ -MINLINE void premul_to_straight_v4(float straight[4], const float premul[4]) +MINLINE void premul_to_straight_v4_v4(float straight[4], const float premul[4]) { if (premul[3] == 0.0f || premul[3] == 1.0f) { straight[0] = premul[0]; @@ -287,7 +287,12 @@ MINLINE void premul_to_straight_v4(float straight[4], const float premul[4]) } } -MINLINE void straight_to_premul_v4(float premul[4], const float straight[4]) +MINLINE void premul_to_straight_v4(float color[4]) +{ + premul_to_straight_v4_v4(color, color); +} + +MINLINE void straight_to_premul_v4_v4(float premul[4], const float straight[4]) { float alpha = straight[3]; premul[0] = straight[0] * alpha; @@ -296,6 +301,11 @@ MINLINE void straight_to_premul_v4(float premul[4], const float straight[4]) premul[3] = straight[3]; } +MINLINE void straight_to_premul_v4(float color[4]) +{ + straight_to_premul_v4_v4(color, color); +} + MINLINE void straight_uchar_to_premul_float(float result[4], const unsigned char color[4]) { float alpha = color[3] / 255.0f; |