[gegl] operations: fix abyss handling of svg blend ops
- From: Daniel Sabo <daniels src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gegl] operations: fix abyss handling of svg blend ops
- Date: Mon, 7 Oct 2013 11:00:39 +0000 (UTC)
commit 75930e53e434e79b7f7460877ab4e549862f7c07
Author: Daniel Sabo <DanielSabo gmail com>
Date: Mon Oct 7 01:41:37 2013 -0700
operations: fix abyss handling of svg blend ops
Always process abyss pixels of svg:dst, svg:dst-over,
svg:dst-out, and svg:src-atop.
operations/generated/clear.c | 42 ++++++-----
operations/generated/dst-atop.c | 42 ++++++-----
operations/generated/dst-in.c | 42 ++++++-----
operations/generated/dst-out.c | 66 +++++++++++-----
operations/generated/dst-over.c | 66 +++++++++++-----
operations/generated/dst.c | 66 +++++++++++-----
operations/generated/src-atop.c | 66 +++++++++++-----
operations/generated/src-in.c | 2 +-
operations/generated/src-out.c | 42 ++++++-----
operations/generated/src.c | 42 ++++++-----
operations/generated/svg-12-porter-duff.rb | 112 ++++++++++++++++++++--------
operations/generated/xor.c | 66 +++++++++++-----
12 files changed, 416 insertions(+), 238 deletions(-)
---
diff --git a/operations/generated/clear.c b/operations/generated/clear.c
index be84688..e0daae3 100644
--- a/operations/generated/clear.c
+++ b/operations/generated/clear.c
@@ -66,30 +66,32 @@ process (GeglOperation *op,
gfloat * GEGL_ALIGNED aux = aux_buf;
gfloat * GEGL_ALIGNED out = out_buf;
- if (aux==NULL)
+ if (!aux)
return TRUE;
-
- for (i = 0; i < n_pixels; i++)
+ else
{
- gint j;
- gfloat aA G_GNUC_UNUSED, aB G_GNUC_UNUSED, aD G_GNUC_UNUSED;
-
- aB = in[3];
- aA = aux[3];
- aD = 0.0f;
-
- for (j = 0; j < 3; j++)
+ for (i = 0; i < n_pixels; i++)
{
- gfloat cA G_GNUC_UNUSED, cB G_GNUC_UNUSED;
-
- cB = in[j];
- cA = aux[j];
- out[j] = 0.0f;
+ gint j;
+ gfloat aA G_GNUC_UNUSED, aB G_GNUC_UNUSED, aD G_GNUC_UNUSED;
+
+ aB = in[3];
+ aA = aux[3];
+ aD = 0.0f;
+
+ for (j = 0; j < 3; j++)
+ {
+ gfloat cA G_GNUC_UNUSED, cB G_GNUC_UNUSED;
+
+ cB = in[j];
+ cA = aux[j];
+ out[j] = 0.0f;
+ }
+ out[3] = aD;
+ in += 4;
+ aux += 4;
+ out += 4;
}
- out[3] = aD;
- in += 4;
- aux += 4;
- out += 4;
}
return TRUE;
}
diff --git a/operations/generated/dst-atop.c b/operations/generated/dst-atop.c
index 145d41c..99fd762 100644
--- a/operations/generated/dst-atop.c
+++ b/operations/generated/dst-atop.c
@@ -66,30 +66,32 @@ process (GeglOperation *op,
gfloat * GEGL_ALIGNED aux = aux_buf;
gfloat * GEGL_ALIGNED out = out_buf;
- if (aux==NULL)
+ if (!aux)
return TRUE;
-
- for (i = 0; i < n_pixels; i++)
+ else
{
- gint j;
- gfloat aA G_GNUC_UNUSED, aB G_GNUC_UNUSED, aD G_GNUC_UNUSED;
-
- aB = in[3];
- aA = aux[3];
- aD = aA;
-
- for (j = 0; j < 3; j++)
+ for (i = 0; i < n_pixels; i++)
{
- gfloat cA G_GNUC_UNUSED, cB G_GNUC_UNUSED;
-
- cB = in[j];
- cA = aux[j];
- out[j] = cB * aA + cA * (1.0f - aB);
+ gint j;
+ gfloat aA G_GNUC_UNUSED, aB G_GNUC_UNUSED, aD G_GNUC_UNUSED;
+
+ aB = in[3];
+ aA = aux[3];
+ aD = aA;
+
+ for (j = 0; j < 3; j++)
+ {
+ gfloat cA G_GNUC_UNUSED, cB G_GNUC_UNUSED;
+
+ cB = in[j];
+ cA = aux[j];
+ out[j] = cB * aA + cA * (1.0f - aB);
+ }
+ out[3] = aD;
+ in += 4;
+ aux += 4;
+ out += 4;
}
- out[3] = aD;
- in += 4;
- aux += 4;
- out += 4;
}
return TRUE;
}
diff --git a/operations/generated/dst-in.c b/operations/generated/dst-in.c
index 22508d9..98135bc 100644
--- a/operations/generated/dst-in.c
+++ b/operations/generated/dst-in.c
@@ -66,30 +66,32 @@ process (GeglOperation *op,
gfloat * GEGL_ALIGNED aux = aux_buf;
gfloat * GEGL_ALIGNED out = out_buf;
- if (aux==NULL)
+ if (!aux)
return TRUE;
-
- for (i = 0; i < n_pixels; i++)
+ else
{
- gint j;
- gfloat aA G_GNUC_UNUSED, aB G_GNUC_UNUSED, aD G_GNUC_UNUSED;
-
- aB = in[3];
- aA = aux[3];
- aD = aA * aB;
-
- for (j = 0; j < 3; j++)
+ for (i = 0; i < n_pixels; i++)
{
- gfloat cA G_GNUC_UNUSED, cB G_GNUC_UNUSED;
-
- cB = in[j];
- cA = aux[j];
- out[j] = cB * aA;
+ gint j;
+ gfloat aA G_GNUC_UNUSED, aB G_GNUC_UNUSED, aD G_GNUC_UNUSED;
+
+ aB = in[3];
+ aA = aux[3];
+ aD = aA * aB;
+
+ for (j = 0; j < 3; j++)
+ {
+ gfloat cA G_GNUC_UNUSED, cB G_GNUC_UNUSED;
+
+ cB = in[j];
+ cA = aux[j];
+ out[j] = cB * aA;
+ }
+ out[3] = aD;
+ in += 4;
+ aux += 4;
+ out += 4;
}
- out[3] = aD;
- in += 4;
- aux += 4;
- out += 4;
}
return TRUE;
}
diff --git a/operations/generated/dst-out.c b/operations/generated/dst-out.c
index 76ce7a1..94e9c22 100644
--- a/operations/generated/dst-out.c
+++ b/operations/generated/dst-out.c
@@ -66,30 +66,54 @@ process (GeglOperation *op,
gfloat * GEGL_ALIGNED aux = aux_buf;
gfloat * GEGL_ALIGNED out = out_buf;
- if (aux==NULL)
- return TRUE;
-
- for (i = 0; i < n_pixels; i++)
+ if (!aux)
{
- gint j;
- gfloat aA G_GNUC_UNUSED, aB G_GNUC_UNUSED, aD G_GNUC_UNUSED;
-
- aB = in[3];
- aA = aux[3];
- aD = aB * (1.0f - aA);
-
- for (j = 0; j < 3; j++)
+ for (i = 0; i < n_pixels; i++)
{
- gfloat cA G_GNUC_UNUSED, cB G_GNUC_UNUSED;
-
- cB = in[j];
- cA = aux[j];
- out[j] = cB * (1.0f - aA);
+ gint j;
+ gfloat aA G_GNUC_UNUSED, aB G_GNUC_UNUSED, aD G_GNUC_UNUSED;
+
+ aB = in[3];
+ aA = 0.0f;
+ aD = aB * (1.0f - aA);
+
+ for (j = 0; j < 3; j++)
+ {
+ gfloat cA G_GNUC_UNUSED, cB G_GNUC_UNUSED;
+
+ cB = in[j];
+ cA = 0.0f;
+ out[j] = cB * (1.0f - aA);
+ }
+ out[3] = aD;
+ in += 4;
+ out += 4;
+ }
+ }
+ else
+ {
+ for (i = 0; i < n_pixels; i++)
+ {
+ gint j;
+ gfloat aA G_GNUC_UNUSED, aB G_GNUC_UNUSED, aD G_GNUC_UNUSED;
+
+ aB = in[3];
+ aA = aux[3];
+ aD = aB * (1.0f - aA);
+
+ for (j = 0; j < 3; j++)
+ {
+ gfloat cA G_GNUC_UNUSED, cB G_GNUC_UNUSED;
+
+ cB = in[j];
+ cA = aux[j];
+ out[j] = cB * (1.0f - aA);
+ }
+ out[3] = aD;
+ in += 4;
+ aux += 4;
+ out += 4;
}
- out[3] = aD;
- in += 4;
- aux += 4;
- out += 4;
}
return TRUE;
}
diff --git a/operations/generated/dst-over.c b/operations/generated/dst-over.c
index 9f12711..37399a1 100644
--- a/operations/generated/dst-over.c
+++ b/operations/generated/dst-over.c
@@ -66,30 +66,54 @@ process (GeglOperation *op,
gfloat * GEGL_ALIGNED aux = aux_buf;
gfloat * GEGL_ALIGNED out = out_buf;
- if (aux==NULL)
- return TRUE;
-
- for (i = 0; i < n_pixels; i++)
+ if (!aux)
{
- gint j;
- gfloat aA G_GNUC_UNUSED, aB G_GNUC_UNUSED, aD G_GNUC_UNUSED;
-
- aB = in[3];
- aA = aux[3];
- aD = aA + aB - aA * aB;
-
- for (j = 0; j < 3; j++)
+ for (i = 0; i < n_pixels; i++)
{
- gfloat cA G_GNUC_UNUSED, cB G_GNUC_UNUSED;
-
- cB = in[j];
- cA = aux[j];
- out[j] = cB + cA * (1.0f - aB);
+ gint j;
+ gfloat aA G_GNUC_UNUSED, aB G_GNUC_UNUSED, aD G_GNUC_UNUSED;
+
+ aB = in[3];
+ aA = 0.0f;
+ aD = aA + aB - aA * aB;
+
+ for (j = 0; j < 3; j++)
+ {
+ gfloat cA G_GNUC_UNUSED, cB G_GNUC_UNUSED;
+
+ cB = in[j];
+ cA = 0.0f;
+ out[j] = cB + cA * (1.0f - aB);
+ }
+ out[3] = aD;
+ in += 4;
+ out += 4;
+ }
+ }
+ else
+ {
+ for (i = 0; i < n_pixels; i++)
+ {
+ gint j;
+ gfloat aA G_GNUC_UNUSED, aB G_GNUC_UNUSED, aD G_GNUC_UNUSED;
+
+ aB = in[3];
+ aA = aux[3];
+ aD = aA + aB - aA * aB;
+
+ for (j = 0; j < 3; j++)
+ {
+ gfloat cA G_GNUC_UNUSED, cB G_GNUC_UNUSED;
+
+ cB = in[j];
+ cA = aux[j];
+ out[j] = cB + cA * (1.0f - aB);
+ }
+ out[3] = aD;
+ in += 4;
+ aux += 4;
+ out += 4;
}
- out[3] = aD;
- in += 4;
- aux += 4;
- out += 4;
}
return TRUE;
}
diff --git a/operations/generated/dst.c b/operations/generated/dst.c
index c858ccf..8ec7d5d 100644
--- a/operations/generated/dst.c
+++ b/operations/generated/dst.c
@@ -66,30 +66,54 @@ process (GeglOperation *op,
gfloat * GEGL_ALIGNED aux = aux_buf;
gfloat * GEGL_ALIGNED out = out_buf;
- if (aux==NULL)
- return TRUE;
-
- for (i = 0; i < n_pixels; i++)
+ if (!aux)
{
- gint j;
- gfloat aA G_GNUC_UNUSED, aB G_GNUC_UNUSED, aD G_GNUC_UNUSED;
-
- aB = in[3];
- aA = aux[3];
- aD = aB;
-
- for (j = 0; j < 3; j++)
+ for (i = 0; i < n_pixels; i++)
{
- gfloat cA G_GNUC_UNUSED, cB G_GNUC_UNUSED;
-
- cB = in[j];
- cA = aux[j];
- out[j] = cB;
+ gint j;
+ gfloat aA G_GNUC_UNUSED, aB G_GNUC_UNUSED, aD G_GNUC_UNUSED;
+
+ aB = in[3];
+ aA = 0.0f;
+ aD = aB;
+
+ for (j = 0; j < 3; j++)
+ {
+ gfloat cA G_GNUC_UNUSED, cB G_GNUC_UNUSED;
+
+ cB = in[j];
+ cA = 0.0f;
+ out[j] = cB;
+ }
+ out[3] = aD;
+ in += 4;
+ out += 4;
+ }
+ }
+ else
+ {
+ for (i = 0; i < n_pixels; i++)
+ {
+ gint j;
+ gfloat aA G_GNUC_UNUSED, aB G_GNUC_UNUSED, aD G_GNUC_UNUSED;
+
+ aB = in[3];
+ aA = aux[3];
+ aD = aB;
+
+ for (j = 0; j < 3; j++)
+ {
+ gfloat cA G_GNUC_UNUSED, cB G_GNUC_UNUSED;
+
+ cB = in[j];
+ cA = aux[j];
+ out[j] = cB;
+ }
+ out[3] = aD;
+ in += 4;
+ aux += 4;
+ out += 4;
}
- out[3] = aD;
- in += 4;
- aux += 4;
- out += 4;
}
return TRUE;
}
diff --git a/operations/generated/src-atop.c b/operations/generated/src-atop.c
index ff625fa..87b9f55 100644
--- a/operations/generated/src-atop.c
+++ b/operations/generated/src-atop.c
@@ -66,30 +66,54 @@ process (GeglOperation *op,
gfloat * GEGL_ALIGNED aux = aux_buf;
gfloat * GEGL_ALIGNED out = out_buf;
- if (aux==NULL)
- return TRUE;
-
- for (i = 0; i < n_pixels; i++)
+ if (!aux)
{
- gint j;
- gfloat aA G_GNUC_UNUSED, aB G_GNUC_UNUSED, aD G_GNUC_UNUSED;
-
- aB = in[3];
- aA = aux[3];
- aD = aB;
-
- for (j = 0; j < 3; j++)
+ for (i = 0; i < n_pixels; i++)
{
- gfloat cA G_GNUC_UNUSED, cB G_GNUC_UNUSED;
-
- cB = in[j];
- cA = aux[j];
- out[j] = cA * aB + cB * (1.0f - aA);
+ gint j;
+ gfloat aA G_GNUC_UNUSED, aB G_GNUC_UNUSED, aD G_GNUC_UNUSED;
+
+ aB = in[3];
+ aA = 0.0f;
+ aD = aB;
+
+ for (j = 0; j < 3; j++)
+ {
+ gfloat cA G_GNUC_UNUSED, cB G_GNUC_UNUSED;
+
+ cB = in[j];
+ cA = 0.0f;
+ out[j] = cA * aB + cB * (1.0f - aA);
+ }
+ out[3] = aD;
+ in += 4;
+ out += 4;
+ }
+ }
+ else
+ {
+ for (i = 0; i < n_pixels; i++)
+ {
+ gint j;
+ gfloat aA G_GNUC_UNUSED, aB G_GNUC_UNUSED, aD G_GNUC_UNUSED;
+
+ aB = in[3];
+ aA = aux[3];
+ aD = aB;
+
+ for (j = 0; j < 3; j++)
+ {
+ gfloat cA G_GNUC_UNUSED, cB G_GNUC_UNUSED;
+
+ cB = in[j];
+ cA = aux[j];
+ out[j] = cA * aB + cB * (1.0f - aA);
+ }
+ out[3] = aD;
+ in += 4;
+ aux += 4;
+ out += 4;
}
- out[3] = aD;
- in += 4;
- aux += 4;
- out += 4;
}
return TRUE;
}
diff --git a/operations/generated/src-in.c b/operations/generated/src-in.c
index 7fff470..f082820 100644
--- a/operations/generated/src-in.c
+++ b/operations/generated/src-in.c
@@ -66,7 +66,7 @@ process (GeglOperation *op,
gfloat * GEGL_ALIGNED aux = aux_buf;
gfloat * GEGL_ALIGNED out = out_buf;
- if (aux==NULL)
+ if (!aux)
return TRUE;
for (i = 0; i < n_pixels; i++)
diff --git a/operations/generated/src-out.c b/operations/generated/src-out.c
index bb2359e..c188d17 100644
--- a/operations/generated/src-out.c
+++ b/operations/generated/src-out.c
@@ -66,30 +66,32 @@ process (GeglOperation *op,
gfloat * GEGL_ALIGNED aux = aux_buf;
gfloat * GEGL_ALIGNED out = out_buf;
- if (aux==NULL)
+ if (!aux)
return TRUE;
-
- for (i = 0; i < n_pixels; i++)
+ else
{
- gint j;
- gfloat aA G_GNUC_UNUSED, aB G_GNUC_UNUSED, aD G_GNUC_UNUSED;
-
- aB = in[3];
- aA = aux[3];
- aD = aA * (1.0f - aB);
-
- for (j = 0; j < 3; j++)
+ for (i = 0; i < n_pixels; i++)
{
- gfloat cA G_GNUC_UNUSED, cB G_GNUC_UNUSED;
-
- cB = in[j];
- cA = aux[j];
- out[j] = cA * (1.0f - aB);
+ gint j;
+ gfloat aA G_GNUC_UNUSED, aB G_GNUC_UNUSED, aD G_GNUC_UNUSED;
+
+ aB = in[3];
+ aA = aux[3];
+ aD = aA * (1.0f - aB);
+
+ for (j = 0; j < 3; j++)
+ {
+ gfloat cA G_GNUC_UNUSED, cB G_GNUC_UNUSED;
+
+ cB = in[j];
+ cA = aux[j];
+ out[j] = cA * (1.0f - aB);
+ }
+ out[3] = aD;
+ in += 4;
+ aux += 4;
+ out += 4;
}
- out[3] = aD;
- in += 4;
- aux += 4;
- out += 4;
}
return TRUE;
}
diff --git a/operations/generated/src.c b/operations/generated/src.c
index d8c8179..c23946b 100644
--- a/operations/generated/src.c
+++ b/operations/generated/src.c
@@ -66,30 +66,32 @@ process (GeglOperation *op,
gfloat * GEGL_ALIGNED aux = aux_buf;
gfloat * GEGL_ALIGNED out = out_buf;
- if (aux==NULL)
+ if (!aux)
return TRUE;
-
- for (i = 0; i < n_pixels; i++)
+ else
{
- gint j;
- gfloat aA G_GNUC_UNUSED, aB G_GNUC_UNUSED, aD G_GNUC_UNUSED;
-
- aB = in[3];
- aA = aux[3];
- aD = aA;
-
- for (j = 0; j < 3; j++)
+ for (i = 0; i < n_pixels; i++)
{
- gfloat cA G_GNUC_UNUSED, cB G_GNUC_UNUSED;
-
- cB = in[j];
- cA = aux[j];
- out[j] = cA;
+ gint j;
+ gfloat aA G_GNUC_UNUSED, aB G_GNUC_UNUSED, aD G_GNUC_UNUSED;
+
+ aB = in[3];
+ aA = aux[3];
+ aD = aA;
+
+ for (j = 0; j < 3; j++)
+ {
+ gfloat cA G_GNUC_UNUSED, cB G_GNUC_UNUSED;
+
+ cB = in[j];
+ cA = aux[j];
+ out[j] = cA;
+ }
+ out[3] = aD;
+ in += 4;
+ aux += 4;
+ out += 4;
}
- out[3] = aD;
- in += 4;
- aux += 4;
- out += 4;
}
return TRUE;
}
diff --git a/operations/generated/svg-12-porter-duff.rb b/operations/generated/svg-12-porter-duff.rb
index 762c937..22de28b 100755
--- a/operations/generated/svg-12-porter-duff.rb
+++ b/operations/generated/svg-12-porter-duff.rb
@@ -34,28 +34,39 @@ copyright = '
a = [
['clear', '0.0f',
- '0.0f'],
+ '0.0f',
+ false],
['src', 'cA',
- 'aA'],
+ 'aA',
+ false],
['dst', 'cB',
- 'aB'],
+ 'aB',
+ true],
# ['src_over', 'cA + cB * (1.0f - aA)',
-# 'aA + aB - aA * aB'],
+# 'aA + aB - aA * aB',
+# false],
['dst_over', 'cB + cA * (1.0f - aB)',
- 'aA + aB - aA * aB'],
+ 'aA + aB - aA * aB',
+ true],
['dst_in', 'cB * aA', # <- XXX: typo?
- 'aA * aB'],
+ 'aA * aB',
+ false],
['src_out', 'cA * (1.0f - aB)',
- 'aA * (1.0f - aB)'],
+ 'aA * (1.0f - aB)',
+ false],
['dst_out', 'cB * (1.0f - aA)',
- 'aB * (1.0f - aA)'],
+ 'aB * (1.0f - aA)',
+ true],
['src_atop', 'cA * aB + cB * (1.0f - aA)',
- 'aB'],
+ 'aB',
+ true],
['dst_atop', 'cB * aA + cA * (1.0f - aB)',
- 'aA'],
+ 'aA',
+ false],
['xor', 'cA * (1.0f - aB)+ cB * (1.0f - aA)',
- 'aA + aB - 2.0f * aA * aB'],
+ 'aA + aB - 2.0f * aA * aB',
+ true],
]
b = [ ['src_in', 'cA * aB', # the bounding box of this mode is the
@@ -96,9 +107,6 @@ process (GeglOperation *op,
gfloat * GEGL_ALIGNED in = in_buf;
gfloat * GEGL_ALIGNED aux = aux_buf;
gfloat * GEGL_ALIGNED out = out_buf;
-
- if (aux==NULL)
- return TRUE;
'
file_tail1 = '
@@ -148,28 +156,65 @@ a.each do
#include \"gegl-chant.h\"
"
file.write file_head2
- file.write "
- for (i = 0; i < n_pixels; i++)
- {
- gint j;
- gfloat aA G_GNUC_UNUSED, aB G_GNUC_UNUSED, aD G_GNUC_UNUSED;
- aB = in[3];
- aA = aux[3];
- aD = #{a_formula};
-
- for (j = 0; j < 3; j++)
+ if item[3]
+ file.write "
+ if (!aux)
+ {
+ for (i = 0; i < n_pixels; i++)
{
- gfloat cA G_GNUC_UNUSED, cB G_GNUC_UNUSED;
+ gint j;
+ gfloat aA G_GNUC_UNUSED, aB G_GNUC_UNUSED, aD G_GNUC_UNUSED;
+
+ aB = in[3];
+ aA = 0.0f;
+ aD = #{a_formula};
+
+ for (j = 0; j < 3; j++)
+ {
+ gfloat cA G_GNUC_UNUSED, cB G_GNUC_UNUSED;
+
+ cB = in[j];
+ cA = 0.0f;
+ out[j] = #{c_formula};
+ }
+ out[3] = aD;
+ in += 4;
+ out += 4;
+ }
+ }
+ else"
+ else
+ file.write "
+ if (!aux)
+ return TRUE;
+ else"
+ end
- cB = in[j];
- cA = aux[j];
- out[j] = #{c_formula};
+ file.write "
+ {
+ for (i = 0; i < n_pixels; i++)
+ {
+ gint j;
+ gfloat aA G_GNUC_UNUSED, aB G_GNUC_UNUSED, aD G_GNUC_UNUSED;
+
+ aB = in[3];
+ aA = aux[3];
+ aD = #{a_formula};
+
+ for (j = 0; j < 3; j++)
+ {
+ gfloat cA G_GNUC_UNUSED, cB G_GNUC_UNUSED;
+
+ cB = in[j];
+ cA = aux[j];
+ out[j] = #{c_formula};
+ }
+ out[3] = aD;
+ in += 4;
+ aux += 4;
+ out += 4;
}
- out[3] = aD;
- in += 4;
- aux += 4;
- out += 4;
}
return TRUE;
}
@@ -217,6 +262,9 @@ b.each do
"
file.write file_head2
file.write "
+ if (!aux)
+ return TRUE;
+
for (i = 0; i < n_pixels; i++)
{
gint j;
diff --git a/operations/generated/xor.c b/operations/generated/xor.c
index 6c93d1d..c079de5 100644
--- a/operations/generated/xor.c
+++ b/operations/generated/xor.c
@@ -66,30 +66,54 @@ process (GeglOperation *op,
gfloat * GEGL_ALIGNED aux = aux_buf;
gfloat * GEGL_ALIGNED out = out_buf;
- if (aux==NULL)
- return TRUE;
-
- for (i = 0; i < n_pixels; i++)
+ if (!aux)
{
- gint j;
- gfloat aA G_GNUC_UNUSED, aB G_GNUC_UNUSED, aD G_GNUC_UNUSED;
-
- aB = in[3];
- aA = aux[3];
- aD = aA + aB - 2.0f * aA * aB;
-
- for (j = 0; j < 3; j++)
+ for (i = 0; i < n_pixels; i++)
{
- gfloat cA G_GNUC_UNUSED, cB G_GNUC_UNUSED;
-
- cB = in[j];
- cA = aux[j];
- out[j] = cA * (1.0f - aB)+ cB * (1.0f - aA);
+ gint j;
+ gfloat aA G_GNUC_UNUSED, aB G_GNUC_UNUSED, aD G_GNUC_UNUSED;
+
+ aB = in[3];
+ aA = 0.0f;
+ aD = aA + aB - 2.0f * aA * aB;
+
+ for (j = 0; j < 3; j++)
+ {
+ gfloat cA G_GNUC_UNUSED, cB G_GNUC_UNUSED;
+
+ cB = in[j];
+ cA = 0.0f;
+ out[j] = cA * (1.0f - aB)+ cB * (1.0f - aA);
+ }
+ out[3] = aD;
+ in += 4;
+ out += 4;
+ }
+ }
+ else
+ {
+ for (i = 0; i < n_pixels; i++)
+ {
+ gint j;
+ gfloat aA G_GNUC_UNUSED, aB G_GNUC_UNUSED, aD G_GNUC_UNUSED;
+
+ aB = in[3];
+ aA = aux[3];
+ aD = aA + aB - 2.0f * aA * aB;
+
+ for (j = 0; j < 3; j++)
+ {
+ gfloat cA G_GNUC_UNUSED, cB G_GNUC_UNUSED;
+
+ cB = in[j];
+ cA = aux[j];
+ out[j] = cA * (1.0f - aB)+ cB * (1.0f - aA);
+ }
+ out[3] = aD;
+ in += 4;
+ aux += 4;
+ out += 4;
}
- out[3] = aD;
- in += 4;
- aux += 4;
- out += 4;
}
return TRUE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]