From 0159d0b73436a8001b70bf15d131ac069311920d Mon Sep 17 00:00:00 2001 From: Alexandre Prokoudine Date: Sat, 4 Feb 2017 22:58:35 +0300 Subject: [PATCH] Fix the vivid light formula --- app/operations/layer-modes/gimpoperationlayermode.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/operations/layer-modes/gimpoperationlayermode.c b/app/operations/layer-modes/gimpoperationlayermode.c index 263b58a826..1274f88897 100644 --- a/app/operations/layer-modes/gimpoperationlayermode.c +++ b/app/operations/layer-modes/gimpoperationlayermode.c @@ -1726,7 +1726,7 @@ blendfun_copy (const float *dest, } /* added according to: - http://www.deepskycolors.com/archivo/2010/04/21/formulas-for-Photoshop-blending-modes.html */ + http://www.simplefilter.de/en/basics/mixmods.html */ static inline void blendfun_vivid_light (const float *dest, const float *src, @@ -1743,13 +1743,13 @@ blendfun_vivid_light (const float *dest, { gfloat comp; - if (src[c] > 0.5f) + if (src[c] <= 0.5f) { - comp = (1.0f - (1.0f - dest[c]) / (2.0f * (src[c]))); + comp = 1.0f - (1.0f - dest[c]) / (2.0f * (src[c])); } else { - comp = dest[c] / (1.0f - 2.0f * (src[c] - 0.5)); + comp = dest[c] / (2.0f * (1.0f - src[c])); } comp = MIN (comp, 1.0f);