[gimp] app: make blendfunction of RGB luminance work again
- From: Øyvind Kolås <ok src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: make blendfunction of RGB luminance work again
- Date: Mon, 20 Feb 2017 12:55:04 +0000 (UTC)
commit ae03b155226e1297e2956f0d5bd7933a988afd60
Author: Øyvind Kolås <pippin gimp org>
Date: Mon Feb 20 13:53:33 2017 +0100
app: make blendfunction of RGB luminance work again
.../layer-modes/gimpoperationlayermode.c | 37 +++++++++----------
1 files changed, 18 insertions(+), 19 deletions(-)
---
diff --git a/app/operations/layer-modes/gimpoperationlayermode.c
b/app/operations/layer-modes/gimpoperationlayermode.c
index fa1581c..20b8e90 100644
--- a/app/operations/layer-modes/gimpoperationlayermode.c
+++ b/app/operations/layer-modes/gimpoperationlayermode.c
@@ -1640,33 +1640,32 @@ blendfun_luminance (const float *dest,//*in,
float *out,
int samples)
{
+ gfloat layer_Y[samples], *layer;
+ gfloat in_Y[samples], *in;
+
+ babl_process (babl_fish ("RGBA float", "Y float"), src, layer_Y, samples);
+ babl_process (babl_fish ("RGBA float", "Y float"), dest, in_Y, samples);
+
+ layer = &layer_Y[0];
+ in = &in_Y[0];
+
while (samples--)
{
if (src[ALPHA] != 0.0f && dest[ALPHA] != 0.0f)
{
- gfloat tmp1[2 * samples], *layer_Y = tmp1;
- gfloat tmp2[2 * samples], *in_Y = tmp2;
- gint i;
- babl_process (babl_fish ("RGBA float", "RGBA float"), dest, out, samples);
- babl_process (babl_fish ("RGBA float", "YA float"), src, layer_Y, samples);
- babl_process (babl_fish ("RGBA float", "YA float"), dest, in_Y, samples);
-
- for (i = 0; i < samples; ++i)
- {
- gfloat ratio = layer_Y[2 * i] / MAX(in_Y[2 * i], 0.0000000000000000001);
- out[4 * i] *= ratio;
- out[4 * i + 1] *= ratio;
- out[4 * i + 2] *= ratio;
- }
-
- babl_process (babl_fish ("RGBA float", "RGBA float"), out, out, samples);
+ gfloat ratio = layer[0] / MAX(in[0], 0.0000000000000000001);
+ int c;
+ for (c = 0; c < 3; c ++)
+ out[c] = dest[c] * ratio;
}
- out[ALPHA] = dest[ALPHA];
+ out[ALPHA] = src[ALPHA];
- out += 4;
+ out += 4;
dest += 4;
- src += 4;
+ src += 4;
+ in ++;
+ layer ++;
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]