[gimp] app: more consistent layer/comp parameter usage in the compositing functions
- From: N/A <ell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: more consistent layer/comp parameter usage in the compositing functions
- Date: Wed, 8 Mar 2017 19:18:49 +0000 (UTC)
commit a2f3616a13f42ae64cdedeb13821e8e337bf3b89
Author: Ell <ell_se yahoo com>
Date: Wed Mar 8 06:58:03 2017 -0500
app: more consistent layer/comp parameter usage in the compositing functions
Also, don't depend on the layer buffer alignment for the SSE src-atop
function, since it's not used.
.../layer-modes/gimpoperationlayermode.c | 48 +++++++++----------
1 files changed, 23 insertions(+), 25 deletions(-)
---
diff --git a/app/operations/layer-modes/gimpoperationlayermode.c
b/app/operations/layer-modes/gimpoperationlayermode.c
index c44e96d..afcafae 100644
--- a/app/operations/layer-modes/gimpoperationlayermode.c
+++ b/app/operations/layer-modes/gimpoperationlayermode.c
@@ -509,7 +509,7 @@ composite_func_src_atop_core (gfloat *in,
{
while (samples--)
{
- gfloat layer_alpha = layer[ALPHA] * opacity;
+ gfloat layer_alpha = comp[ALPHA] * opacity;
if (mask)
layer_alpha *= *mask;
@@ -525,21 +525,20 @@ composite_func_src_atop_core (gfloat *in,
gint b;
for (b = RED; b < ALPHA; b++)
- out[b] = layer[b] * layer_alpha + in[b] * (1.0f - layer_alpha);
+ out[b] = comp[b] * layer_alpha + in[b] * (1.0f - layer_alpha);
}
out[ALPHA] = in[ALPHA];
- in += 4;
- out += 4;
- layer += 4;
+ in += 4;
+ comp += 4;
+ out += 4;
if (mask)
mask++;
}
}
-
static inline void
composite_func_src_over_core (gfloat *in,
gfloat *layer,
@@ -652,7 +651,7 @@ composite_func_src_in_core (gfloat *in,
{
while (samples--)
{
- gfloat new_alpha = in[ALPHA] * layer[ALPHA] * opacity;
+ gfloat new_alpha = in[ALPHA] * comp[ALPHA] * opacity;
if (mask)
new_alpha *= *mask;
@@ -665,16 +664,16 @@ composite_func_src_in_core (gfloat *in,
}
else
{
- out[RED] = layer[RED];
- out[GREEN] = layer[GREEN];
- out[BLUE] = layer[BLUE];
+ out[RED] = comp[RED];
+ out[GREEN] = comp[GREEN];
+ out[BLUE] = comp[BLUE];
}
out[ALPHA] = new_alpha;
- in += 4;
- out += 4;
- layer += 4;
+ in += 4;
+ comp += 4;
+ out += 4;
if (mask)
mask++;
@@ -694,10 +693,9 @@ composite_func_src_atop_sse2 (gfloat *in,
gfloat *out,
gint samples)
{
- if ((((uintptr_t)in) | /* alignment check */
- ((uintptr_t)comp) |
- ((uintptr_t)layer) |
- ((uintptr_t)out) ) & 0x0F)
+ if ((((uintptr_t)in) | /* alignment check */
+ ((uintptr_t)comp) |
+ ((uintptr_t)out) ) & 0x0F)
{
return composite_func_src_atop_core (in, layer, comp, mask, opacity,
out, samples);
@@ -705,19 +703,19 @@ composite_func_src_atop_sse2 (gfloat *in,
else
{
const __v4sf *v_in = (const __v4sf*) in;
- const __v4sf *v_layer = (const __v4sf*) layer;
+ const __v4sf *v_comp = (const __v4sf*) comp;
__v4sf *v_out = (__v4sf*) out;
const __v4sf v_one = _mm_set1_ps (1.0f);
const __v4sf v_opacity = _mm_set1_ps (opacity);
while (samples--)
{
- __v4sf alpha, rgba_in, rgba_layer;
+ __v4sf alpha, rgba_in, rgba_comp;
- rgba_in = *v_in ++;
- rgba_layer = *v_layer++;
+ rgba_in = *v_in ++;
+ rgba_cimp = *v_comp++;
- alpha = (__v4sf)_mm_shuffle_epi32((__m128i)rgba_layer,_MM_SHUFFLE(3,3,3,3)) * v_opacity;
+ alpha = (__v4sf)_mm_shuffle_epi32((__m128i)rgba_comp,_MM_SHUFFLE(3,3,3,3)) * v_opacity;
if (mask)
{
@@ -729,7 +727,7 @@ composite_func_src_atop_sse2 (gfloat *in,
__v4sf out_pixel, out_pixel_rbaa, out_alpha;
out_alpha = (__v4sf)_mm_shuffle_epi32((__m128i)rgba_in,_MM_SHUFFLE(3,3,3,3));
- out_pixel = rgba_layer * alpha + rgba_in * (v_one - alpha);
+ out_pixel = rgba_comp * alpha + rgba_in * (v_one - alpha);
out_pixel_rbaa = _mm_shuffle_ps (out_pixel, out_alpha, _MM_SHUFFLE (3, 3, 2, 0));
out_pixel = _mm_shuffle_ps (out_pixel, out_pixel_rbaa, _MM_SHUFFLE (2, 1, 1, 0));
@@ -817,7 +815,7 @@ gimp_composite_blend (GimpOperationLayerMode *layer_mode,
{
case GIMP_LAYER_COMPOSITE_SRC_ATOP:
default:
- composite_func_src_atop (in, blend_out, NULL,
+ composite_func_src_atop (in, layer, blend_out,
mask, opacity,
out, samples);
break;
@@ -835,7 +833,7 @@ gimp_composite_blend (GimpOperationLayerMode *layer_mode,
break;
case GIMP_LAYER_COMPOSITE_SRC_IN:
- composite_func_src_in (in, blend_out, NULL,
+ composite_func_src_in (in, layer, blend_out,
mask, opacity,
out, samples);
break;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]