Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/blenlib/intern/math_color_inline.c')
-rw-r--r--source/blender/blenlib/intern/math_color_inline.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/source/blender/blenlib/intern/math_color_inline.c b/source/blender/blenlib/intern/math_color_inline.c
index f520b2318e5..4c8bd43ef73 100644
--- a/source/blender/blenlib/intern/math_color_inline.c
+++ b/source/blender/blenlib/intern/math_color_inline.c
@@ -164,7 +164,11 @@ MINLINE void linearrgb_to_srgb_ushort4_predivide(unsigned short srgb[4], const f
for (i = 0; i < 3; ++i) {
t = linear[i] * inv_alpha;
- srgb[i] = (t < 1.0f) ? (unsigned short) (to_srgb_table_lookup(t) * alpha) : FTOUSHORT(linearrgb_to_srgb(t) * alpha);
+ srgb[i] = (t <= 1.0f) ?
+ /* warning - converts: float -> short -> float -> short */
+ (unsigned short) (to_srgb_table_lookup(t) * alpha) :
+ /* if FTOUSHORT was an inline function this could be done less confusingly */
+ ((t = linearrgb_to_srgb(t) * alpha), FTOUSHORT(t));
}
srgb[3] = FTOUSHORT(linear[3]);