diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2012-02-21 00:55:30 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2012-02-21 00:55:30 +0400 |
commit | 83aeb9cbd5359403cc0b17c533cc72f11cb25173 (patch) | |
tree | 094c4fc7de5460ec296a82e26bad0c7c1bf4e079 /source | |
parent | 3bcca01c24147c565f84dfe6ce97bcbf215d7b69 (diff) |
Fix broken predivide option for reading in images, patch by Troy Sobotka.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenlib/intern/math_color_inline.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/source/blender/blenlib/intern/math_color_inline.c b/source/blender/blenlib/intern/math_color_inline.c index f8b986e799b..cd1c0470ae2 100644 --- a/source/blender/blenlib/intern/math_color_inline.c +++ b/source/blender/blenlib/intern/math_color_inline.c @@ -179,7 +179,7 @@ MINLINE void srgb_to_linearrgb_uchar4(float linear[4], const unsigned char srgb[ MINLINE void srgb_to_linearrgb_uchar4_predivide(float linear[4], const unsigned char srgb[4]) { - float alpha, inv_alpha; + float fsrgb[4]; int i; if(srgb[3] == 255 || srgb[3] == 0) { @@ -187,13 +187,10 @@ MINLINE void srgb_to_linearrgb_uchar4_predivide(float linear[4], const unsigned return; } - alpha = srgb[3] * (1.0f/255.0f); - inv_alpha = 1.0f/alpha; - - for(i=0; i<3; ++i) - linear[i] = linearrgb_to_srgb(srgb[i] * inv_alpha) * alpha; + for (i=0; i<4; i++) + fsrgb[i] = srgb[i] * (1.0f/255.0f); - linear[3] = alpha; + srgb_to_linearrgb_predivide_v4(linear, fsrgb); } #endif /* BLI_MATH_COLOR_INLINE_H */ |