[gimp] Bug 736232 - Strange result using transparent layer, blending modes...
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] Bug 736232 - Strange result using transparent layer, blending modes...
- Date: Thu, 2 Oct 2014 22:18:59 +0000 (UTC)
commit dbfbc221a5bdbab1530ec6ab018b6e57301f6c7c
Author: Thomas Manni <thomas manni free fr>
Date: Thu Oct 2 19:04:05 2014 +0200
Bug 736232 - Strange result using transparent layer, blending modes...
...and layer opacity
Use a temporary variable to store intermediate result instead of
writting 2 times to the output buffer, because input and output
buffer might be the same.
app/operations/gimpoperationcolormode.c | 9 +++++----
app/operations/gimpoperationhuemode.c | 9 +++++----
app/operations/gimpoperationsaturationmode.c | 9 +++++----
app/operations/gimpoperationvaluemode.c | 9 +++++----
4 files changed, 20 insertions(+), 16 deletions(-)
---
diff --git a/app/operations/gimpoperationcolormode.c b/app/operations/gimpoperationcolormode.c
index 4d4dc20..5f5a7ef 100644
--- a/app/operations/gimpoperationcolormode.c
+++ b/app/operations/gimpoperationcolormode.c
@@ -111,6 +111,7 @@ gimp_operation_color_mode_process_pixels (gfloat *in,
if (comp_alpha && new_alpha)
{
gint b;
+ gfloat out_tmp[3];
gfloat ratio = comp_alpha / new_alpha;
gimp_rgb_to_hsl (&layer_rgb, &layer_hsl);
@@ -120,13 +121,13 @@ gimp_operation_color_mode_process_pixels (gfloat *in,
out_hsl.s = layer_hsl.s;
gimp_hsl_to_rgb (&out_hsl, &out_rgb);
- out[0] = out_rgb.r;
- out[1] = out_rgb.g;
- out[2] = out_rgb.b;
+ out_tmp[0] = out_rgb.r;
+ out_tmp[1] = out_rgb.g;
+ out_tmp[2] = out_rgb.b;
for (b = RED; b < ALPHA; b++)
{
- out[b] = out[b] * ratio + in[b] * (1.0 - ratio);
+ out[b] = out_tmp[b] * ratio + in[b] * (1.0 - ratio);
}
}
else
diff --git a/app/operations/gimpoperationhuemode.c b/app/operations/gimpoperationhuemode.c
index 985a80c..a43e519 100644
--- a/app/operations/gimpoperationhuemode.c
+++ b/app/operations/gimpoperationhuemode.c
@@ -111,6 +111,7 @@ gimp_operation_hue_mode_process_pixels (gfloat *in,
if (comp_alpha && new_alpha)
{
gint b;
+ gfloat out_tmp[3];
gfloat ratio = comp_alpha / new_alpha;
gimp_rgb_to_hsv (&layer_rgb, &layer_hsv);
@@ -125,13 +126,13 @@ gimp_operation_hue_mode_process_pixels (gfloat *in,
}
gimp_hsv_to_rgb (&out_hsv, &out_rgb);
- out[0] = out_rgb.r;
- out[1] = out_rgb.g;
- out[2] = out_rgb.b;
+ out_tmp[0] = out_rgb.r;
+ out_tmp[1] = out_rgb.g;
+ out_tmp[2] = out_rgb.b;
for (b = RED; b < ALPHA; b++)
{
- out[b] = out[b] * ratio + in[b] * (1.0 - ratio);
+ out[b] = out_tmp[b] * ratio + in[b] * (1.0 - ratio);
}
}
else
diff --git a/app/operations/gimpoperationsaturationmode.c b/app/operations/gimpoperationsaturationmode.c
index 688eaf9..9297df2 100644
--- a/app/operations/gimpoperationsaturationmode.c
+++ b/app/operations/gimpoperationsaturationmode.c
@@ -111,6 +111,7 @@ gimp_operation_saturation_mode_process_pixels (gfloat *in,
if (comp_alpha && new_alpha)
{
gint b;
+ gfloat out_tmp[3];
gfloat ratio = comp_alpha / new_alpha;
gimp_rgb_to_hsv (&layer_rgb, &layer_hsv);
@@ -119,13 +120,13 @@ gimp_operation_saturation_mode_process_pixels (gfloat *in,
out_hsv.s = layer_hsv.s;
gimp_hsv_to_rgb (&out_hsv, &out_rgb);
- out[0] = out_rgb.r;
- out[1] = out_rgb.g;
- out[2] = out_rgb.b;
+ out_tmp[0] = out_rgb.r;
+ out_tmp[1] = out_rgb.g;
+ out_tmp[2] = out_rgb.b;
for (b = RED; b < ALPHA; b++)
{
- out[b] = out[b] * ratio + in[b] * (1.0 - ratio);
+ out[b] = out_tmp[b] * ratio + in[b] * (1.0 - ratio);
}
}
else
diff --git a/app/operations/gimpoperationvaluemode.c b/app/operations/gimpoperationvaluemode.c
index 05416ab..21cca08 100644
--- a/app/operations/gimpoperationvaluemode.c
+++ b/app/operations/gimpoperationvaluemode.c
@@ -111,6 +111,7 @@ gimp_operation_value_mode_process_pixels (gfloat *in,
if (comp_alpha && new_alpha)
{
gint b;
+ gfloat out_tmp[3];
gfloat ratio = comp_alpha / new_alpha;
gimp_rgb_to_hsv (&layer_rgb, &layer_hsv);
@@ -119,13 +120,13 @@ gimp_operation_value_mode_process_pixels (gfloat *in,
out_hsv.v = layer_hsv.v;
gimp_hsv_to_rgb (&out_hsv, &out_rgb);
- out[0] = out_rgb.r;
- out[1] = out_rgb.g;
- out[2] = out_rgb.b;
+ out_tmp[0] = out_rgb.r;
+ out_tmp[1] = out_rgb.g;
+ out_tmp[2] = out_rgb.b;
for (b = RED; b < ALPHA; b++)
{
- out[b] = out[b] * ratio + in[b] * (1.0 - ratio);
+ out[b] = out_tmp[b] * ratio + in[b] * (1.0 - ratio);
}
}
else
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]