From e69924b4eb2c1d13c03616fa5fd9bdc2eae2a4aa Mon Sep 17 00:00:00 2001 From: Alexandre Prokoudine Date: Sun, 5 Feb 2017 01:17:33 +0300 Subject: [PATCH] Fix the linear light layer mode formula This simpler version provides the rendering that matches Photoshop's one. --- app/operations/layer-modes/gimpoperationlayermode.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/app/operations/layer-modes/gimpoperationlayermode.c b/app/operations/layer-modes/gimpoperationlayermode.c index 01b12972c5..9b11bcf39b 100644 --- a/app/operations/layer-modes/gimpoperationlayermode.c +++ b/app/operations/layer-modes/gimpoperationlayermode.c @@ -1766,7 +1766,7 @@ blendfun_vivid_light (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_linear_light (const float *dest, const float *src, @@ -1782,14 +1782,7 @@ blendfun_linear_light (const float *dest, for (c = 0; c < 3; c++) { gfloat comp; - if (src[c] > 0.5f) - { - comp = dest[c] + 2.0 * (src[c] - 0.5); - } - else - { - comp = dest[c] + 2.0 * src[c] - 1.0; - } + comp = dest[c] + 2.0f * src[c] - 1.0f; out[c] = comp; } }