[gimp] app: composite_blend, fix src_over
- From: Øyvind Kolås <ok src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: composite_blend, fix src_over
- Date: Thu, 19 Jan 2017 03:57:58 +0000 (UTC)
commit 72cbda11ae9e40d77969dab49429fe5bff0ea690
Author: Øyvind Kolås <pippin gimp org>
Date: Thu Jan 19 04:56:30 2017 +0100
app: composite_blend, fix src_over
app/operations/layer-modes/gimpblendcomposite.h | 11 +++++++----
1 files changed, 7 insertions(+), 4 deletions(-)
---
diff --git a/app/operations/layer-modes/gimpblendcomposite.h b/app/operations/layer-modes/gimpblendcomposite.h
index 8ae3b10..7483e21 100644
--- a/app/operations/layer-modes/gimpblendcomposite.h
+++ b/app/operations/layer-modes/gimpblendcomposite.h
@@ -75,9 +75,10 @@ compfun_src_atop (gfloat *in,
static inline void
compfun_src_over (gfloat *in,
gfloat *layer,
+ gfloat *comp,
gfloat *mask,
- gfloat *out,
gfloat opacity,
+ gfloat *out,
gint samples)
{
while (samples--)
@@ -100,13 +101,14 @@ compfun_src_over (gfloat *in,
gint b;
gfloat ratio = comp_alpha / new_alpha;
for (b = RED; b < ALPHA; b++)
- out[b] = layer[b] * ratio + in[b] * (1.0f - ratio);
+ out[b] = ratio * (in[ALPHA] * (comp[b] - layer[b]) + layer[b] - in[b]) + in[b];
}
out[ALPHA] = new_alpha;
in += 4;
layer += 4;
+ comp += 4;
out += 4;
if (mask)
@@ -260,8 +262,9 @@ gimp_composite_blend (gfloat *in,
compfun_src_atop (blend_in, blend_out, mask, opacity, out, samples);
break;
case GIMP_LAYER_COMPOSITE_SRC_OVER:
- //compfun_src_over (blend_in, blend_out, mask, opacity, out, samples);
- gimp_operation_normal_process_pixels (blend_in, blend_out, mask, out, opacity, samples, NULL, 0, 0, 0,
0);
+ if (fish_to_composite)
+ babl_process (fish_to_composite, blend_layer, blend_layer, samples);
+ compfun_src_over (blend_in, blend_layer, blend_out, mask, opacity, out, samples);
break;
case GIMP_LAYER_COMPOSITE_DST_ATOP:
if (fish_to_composite)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]