[gimp/pippin/linear-is-the-new-black] app: use gimp_blend_composites utility function in lch modes
- From: Øyvind Kolås <ok src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/pippin/linear-is-the-new-black] app: use gimp_blend_composites utility function in lch modes
- Date: Wed, 18 Jan 2017 21:55:59 +0000 (UTC)
commit 1f0e35037315c3c498520a8c62f44d770d551e31
Author: Øyvind Kolås <pippin gimp org>
Date: Wed Jan 18 22:55:37 2017 +0100
app: use gimp_blend_composites utility function in lch modes
.../layer-modes/gimpoperationlchchroma.c | 2 +-
app/operations/layer-modes/gimpoperationlchcolor.c | 2 +-
app/operations/layer-modes/gimpoperationlchhue.c | 2 +-
.../layer-modes/gimpoperationlchlightness.c | 2 +-
.../layer-modes/gimpoperationpointlayermode.h | 41 +-------------------
5 files changed, 6 insertions(+), 43 deletions(-)
---
diff --git a/app/operations/layer-modes/gimpoperationlchchroma.c
b/app/operations/layer-modes/gimpoperationlchchroma.c
index f446de5..3e5d5c8 100644
--- a/app/operations/layer-modes/gimpoperationlchchroma.c
+++ b/app/operations/layer-modes/gimpoperationlchchroma.c
@@ -145,7 +145,7 @@ gimp_operation_lch_chroma_process_pixels (gfloat *in,
to_fish = babl_fish ("CIE Lab alpha float", "R'G'B'A float");
chroma_pre_process (from_fish, to_fish, in, layer, out, samples);
- gimp_operation_layer_composite (in, layer, mask, out, opacity, samples);
+ compfun_src_atop (in, layer, mask, opacity, out, samples);
return TRUE;
}
diff --git a/app/operations/layer-modes/gimpoperationlchcolor.c
b/app/operations/layer-modes/gimpoperationlchcolor.c
index 43ecb8e..013f182 100644
--- a/app/operations/layer-modes/gimpoperationlchcolor.c
+++ b/app/operations/layer-modes/gimpoperationlchcolor.c
@@ -136,7 +136,7 @@ gimp_operation_lch_color_process_pixels (gfloat *in,
to_fish = babl_fish ("CIE Lab alpha float", "R'G'B'A float");
color_pre_process (from_fish_la, from_fish_laba, to_fish, in, layer, out, samples);
- gimp_operation_layer_composite (in, layer, mask, out, opacity, samples);
+ compfun_src_atop (in, layer, mask, opacity, out, samples);
return TRUE;
}
diff --git a/app/operations/layer-modes/gimpoperationlchhue.c
b/app/operations/layer-modes/gimpoperationlchhue.c
index 226dd6e..543f689 100644
--- a/app/operations/layer-modes/gimpoperationlchhue.c
+++ b/app/operations/layer-modes/gimpoperationlchhue.c
@@ -144,7 +144,7 @@ gimp_operation_lch_hue_process_pixels (gfloat *in,
to_fish = babl_fish ("CIE Lab alpha float", "R'G'B'A float");
hue_pre_process (from_fish, to_fish, in, layer, out, samples);
- gimp_operation_layer_composite (in, layer, mask, out, opacity, samples);
+ compfun_src_atop (in, layer, mask, opacity, out, samples);
return TRUE;
}
diff --git a/app/operations/layer-modes/gimpoperationlchlightness.c
b/app/operations/layer-modes/gimpoperationlchlightness.c
index 6cd1e7f..3ba5a18 100644
--- a/app/operations/layer-modes/gimpoperationlchlightness.c
+++ b/app/operations/layer-modes/gimpoperationlchlightness.c
@@ -131,7 +131,7 @@ gimp_operation_lch_lightness_process_pixels (gfloat *in,
lightness_pre_process (from_fish_la, from_fish_laba, to_fish, in, layer, out, samples);
- gimp_operation_layer_composite (in, layer, mask, out, opacity, samples);
+ compfun_src_atop (in, layer, mask, opacity, out, samples);
return TRUE;
}
diff --git a/app/operations/layer-modes/gimpoperationpointlayermode.h
b/app/operations/layer-modes/gimpoperationpointlayermode.h
index b9f2463..5274f9a 100644
--- a/app/operations/layer-modes/gimpoperationpointlayermode.h
+++ b/app/operations/layer-modes/gimpoperationpointlayermode.h
@@ -67,42 +67,6 @@ extern const Babl *_gimp_fish_laba_to_rgba;
extern const Babl *_gimp_fish_laba_to_perceptual;
static inline void
-gimp_operation_layer_composite (const gfloat *in,
- const gfloat *layer,
- const gfloat *mask,
- gfloat *out,
- gfloat opacity,
- glong samples)
-{
- while (samples--)
- {
- gfloat comp_alpha = layer[ALPHA] * opacity;
- if (mask)
- comp_alpha *= *mask++;
- if (comp_alpha != 0.0f)
- {
- out[RED] = out[RED] * comp_alpha + in[RED] * (1.0f - comp_alpha);
- out[GREEN] = out[GREEN] * comp_alpha + in[GREEN] * (1.0f - comp_alpha);
- out[BLUE] = out[BLUE] * comp_alpha + in[BLUE] * (1.0f - comp_alpha);
- }
- else
- {
- gint b;
- for (b = RED; b < ALPHA; b++)
- {
- out[b] = in[b];
- }
- }
-
- out[ALPHA] = in[ALPHA];
-
- in += 4;
- layer += 4;
- out += 4;
- }
-}
-
-static inline void
compfun_src_atop (gfloat *in,
gfloat *layer,
gfloat *mask,
@@ -165,10 +129,9 @@ compfun_src_over (gfloat *in,
else
{
gint b;
- //gfloat ratio = comp_alpha / new_alpha;
+ gfloat ratio = comp_alpha / new_alpha;
for (b = RED; b < ALPHA; b++)
- //out[b] = ratio * (in[ALPHA] * (layer[b] - layer[b]) + layer[b] - in[b]) + in[b];
- out[b] = layer[b] * comp_alpha + in[b] * (1.0f - comp_alpha);
+ out[b] = layer[b] * ratio + in[b] * (1.0f - ratio);
}
out[ALPHA] = new_alpha;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]