diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2013-01-05 00:34:06 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2013-01-05 00:34:06 +0400 |
commit | 52a81c8364c1da5d7607b6964d5e64d1cd00703a (patch) | |
tree | 4456291c2cf4d6766fd898a67d527ce2dda03e82 /source/blender/blenlib/intern/math_color_inline.c | |
parent | 0e676bf50bd961c86b48af2c0baf10136cdb60a9 (diff) |
There was a typo in previous commit
Additional changes:
- Made mipmapping operate with unsigned short instead of char
which allowed to eliminate extra division by 255, so prevision
should be a bit better now.
- Actually, this is not real unsigned short range, but it's a
range of 255*255 which is more convenient for mipmapping, so
made conversion functions private for scaling.c
Not sure it worth making this functions operate in 65535
range, for now current behavior seems to be just fine.
Diffstat (limited to 'source/blender/blenlib/intern/math_color_inline.c')
-rw-r--r-- | source/blender/blenlib/intern/math_color_inline.c | 28 |
1 files changed, 0 insertions, 28 deletions
diff --git a/source/blender/blenlib/intern/math_color_inline.c b/source/blender/blenlib/intern/math_color_inline.c index f8bb6b81a1d..b8eeca50db6 100644 --- a/source/blender/blenlib/intern/math_color_inline.c +++ b/source/blender/blenlib/intern/math_color_inline.c @@ -326,32 +326,4 @@ MINLINE void premul_float_to_straight_uchar(unsigned char *result, const float c } } -MINLINE void straight_uchar_to_premul_int(int result[4], const unsigned char color[4]) -{ - int alpha = color[3]; - - result[0] = (color[0] * alpha) / 255; - result[1] = (color[1] * alpha) / 255; - result[2] = (color[2] * alpha) / 255; - result[3] = alpha; -} - -MINLINE void premul_int_to_straight_uchar(unsigned char *result, const int color[4]) -{ - if (color[3] == 0 || color[3] == 255) { - result[0] = color[0]; - result[1] = color[1]; - result[2] = color[2]; - result[3] = color[3]; - } - else { - int alpha = color[3]; - - result[0] = color[0] * 255 / alpha; - result[0] = color[1] * 255 / alpha; - result[0] = color[2] * 255 / alpha; - result[3] = alpha; - } -} - #endif /* __MATH_COLOR_INLINE_C__ */ |