[gegl] operations/generatd: porter duff operations need alpha
- From: Øyvind "pippin" Kolås <ok src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gegl] operations/generatd: porter duff operations need alpha
- Date: Sun, 28 Oct 2018 15:35:02 +0000 (UTC)
commit 98fbcea1d213e832eeb9949b0ba88c4778fbb20b
Author: Øyvind Kolås <pippin gimp org>
Date: Sun Oct 28 16:28:28 2018 +0100
operations/generatd: porter duff operations need alpha
As opposed to the generated math ops, the porter duff operations - just like
over - only make proper sense with alpha channels, not having the alpha at all
removes conditionals and thus speeds them up.
operations/generated/clear.c | 44 +++++++------------
operations/generated/color-burn.c | 4 +-
operations/generated/color-dodge.c | 4 +-
operations/generated/darken.c | 4 +-
operations/generated/difference.c | 4 +-
operations/generated/dst-atop.c | 44 +++++++------------
operations/generated/dst-in.c | 44 +++++++------------
operations/generated/dst-out.c | 51 ++++++++--------------
operations/generated/dst-over.c | 51 ++++++++--------------
operations/generated/dst.c | 51 ++++++++--------------
operations/generated/exclusion.c | 4 +-
operations/generated/hard-light.c | 4 +-
operations/generated/lighten.c | 4 +-
operations/generated/overlay.c | 4 +-
operations/generated/plus.c | 4 +-
operations/generated/screen.c | 4 +-
operations/generated/soft-light.c | 4 +-
operations/generated/src-atop.c | 51 ++++++++--------------
operations/generated/src-in.c | 45 +++++++-------------
operations/generated/src-out.c | 44 +++++++------------
operations/generated/src.c | 44 +++++++------------
operations/generated/svg-12-blend.rb | 4 +-
operations/generated/svg-12-porter-duff.rb | 68 ++++++++++--------------------
operations/generated/xor.c | 51 ++++++++--------------
24 files changed, 228 insertions(+), 408 deletions(-)
---
diff --git a/operations/generated/clear.c b/operations/generated/clear.c
index 37f6b7a81..48687db4a 100644
--- a/operations/generated/clear.c
+++ b/operations/generated/clear.c
@@ -61,25 +61,19 @@ static void prepare (GeglOperation *operation)
if (babl_model_is (model, "Y") ||
babl_model_is (model, "Y'") ||
- babl_model_is (model, "Y~"))
- {
- format = babl_format_with_space (use_srgb?"Y~ float":"Y float", space);
- }
- else if (babl_model_is (model, "YA") ||
- babl_model_is (model, "Y'A") ||
- babl_model_is (model, "Y~A") ||
- babl_model_is (model, "YaA") ||
- babl_model_is (model, "Y'aA"))
+ babl_model_is (model, "Y~") ||
+ babl_model_is (model, "YA") ||
+ babl_model_is (model, "Y'A") ||
+ babl_model_is (model, "Y~A") ||
+ babl_model_is (model, "YaA") ||
+ babl_model_is (model, "Y'aA"))
{
format = babl_format_with_space (use_srgb?"Y~aA float":"YaA float", space);
}
else if (babl_model_is (model, "RGB") ||
babl_model_is (model, "R'G'B'") ||
- babl_model_is (model, "R~G~B~"))
- {
- format = babl_format_with_space (use_srgb?"R~G~B~ float":"RGB float", space);
- }
- else if (babl_model_is (model, "RGBA") ||
+ babl_model_is (model, "R~G~B~") ||
+ babl_model_is (model, "RGBA") ||
babl_model_is (model, "RGB") ||
babl_model_is (model, "R'G'B'A") ||
babl_model_is (model, "R'G'B'") ||
@@ -88,11 +82,11 @@ static void prepare (GeglOperation *operation)
babl_model_is (model, "RaGaBaA") ||
babl_model_is (model, "R'aG'aB'aA"))
{
- format = babl_format_with_space (use_srgb?"R~aG~aB~a float":"RaGaBaA float", space);
+ format = babl_format_with_space (use_srgb?"R~aG~aB~aA float":"RaGaBaA float", space);
}
else
{
- format = babl_format_with_space (use_srgb?"R~aG~aB~a float":"RaGaBaA float", space);
+ format = babl_format_with_space (use_srgb?"R~aG~aB~aA float":"RaGaBaA float", space);
}
gegl_operation_set_format (operation, "input", format);
@@ -115,7 +109,7 @@ process (GeglOperation *op,
gfloat * GEGL_ALIGNED out = out_buf;
const Babl *format = gegl_operation_get_format (op, "output");
gint components = babl_format_get_n_components (format);
- gint alpha = babl_format_has_alpha (format);
+ gint alpha = components-1;
if (!aux)
return TRUE;
@@ -126,18 +120,11 @@ process (GeglOperation *op,
gint j;
gfloat aA G_GNUC_UNUSED, aB G_GNUC_UNUSED, aD G_GNUC_UNUSED;
- if (alpha)
- {
- aB = in[components-1];
- aA = aux[components-1];
- }
- else
- {
- aB = aA = 1.0f;
- }
+ aB = in[alpha];
+ aA = aux[alpha];
aD = 0.0f;
- for (j = 0; j < components-alpha; j++)
+ for (j = 0; j < alpha; j++)
{
gfloat cA G_GNUC_UNUSED, cB G_GNUC_UNUSED;
@@ -145,8 +132,7 @@ process (GeglOperation *op,
cA = aux[j];
out[j] = 0.0f;
}
- if (alpha)
- out[components-alpha] = aD;
+ out[alpha] = aD;
in += components;
aux += components;
out += components;
diff --git a/operations/generated/color-burn.c b/operations/generated/color-burn.c
index fc06f3a1b..b4e2f2a4e 100644
--- a/operations/generated/color-burn.c
+++ b/operations/generated/color-burn.c
@@ -88,11 +88,11 @@ static void prepare (GeglOperation *operation)
babl_model_is (model, "RaGaBaA") ||
babl_model_is (model, "R'aG'aB'aA"))
{
- format = babl_format_with_space (use_srgb?"R~aG~aB~a float":"RaGaBaA float", space);
+ format = babl_format_with_space (use_srgb?"R~aG~aB~aA float":"RaGaBaA float", space);
}
else
{
- format = babl_format_with_space (use_srgb?"R~aG~aB~a float":"RaGaBaA float", space);
+ format = babl_format_with_space (use_srgb?"R~aG~aB~aA float":"RaGaBaA float", space);
}
gegl_operation_set_format (operation, "input", format);
diff --git a/operations/generated/color-dodge.c b/operations/generated/color-dodge.c
index dd5c4d6b9..ceb7b9443 100644
--- a/operations/generated/color-dodge.c
+++ b/operations/generated/color-dodge.c
@@ -88,11 +88,11 @@ static void prepare (GeglOperation *operation)
babl_model_is (model, "RaGaBaA") ||
babl_model_is (model, "R'aG'aB'aA"))
{
- format = babl_format_with_space (use_srgb?"R~aG~aB~a float":"RaGaBaA float", space);
+ format = babl_format_with_space (use_srgb?"R~aG~aB~aA float":"RaGaBaA float", space);
}
else
{
- format = babl_format_with_space (use_srgb?"R~aG~aB~a float":"RaGaBaA float", space);
+ format = babl_format_with_space (use_srgb?"R~aG~aB~aA float":"RaGaBaA float", space);
}
gegl_operation_set_format (operation, "input", format);
diff --git a/operations/generated/darken.c b/operations/generated/darken.c
index 22dffa6dd..55d181bc3 100644
--- a/operations/generated/darken.c
+++ b/operations/generated/darken.c
@@ -88,11 +88,11 @@ static void prepare (GeglOperation *operation)
babl_model_is (model, "RaGaBaA") ||
babl_model_is (model, "R'aG'aB'aA"))
{
- format = babl_format_with_space (use_srgb?"R~aG~aB~a float":"RaGaBaA float", space);
+ format = babl_format_with_space (use_srgb?"R~aG~aB~aA float":"RaGaBaA float", space);
}
else
{
- format = babl_format_with_space (use_srgb?"R~aG~aB~a float":"RaGaBaA float", space);
+ format = babl_format_with_space (use_srgb?"R~aG~aB~aA float":"RaGaBaA float", space);
}
gegl_operation_set_format (operation, "input", format);
diff --git a/operations/generated/difference.c b/operations/generated/difference.c
index 10158ca1e..3abfde3a0 100644
--- a/operations/generated/difference.c
+++ b/operations/generated/difference.c
@@ -88,11 +88,11 @@ static void prepare (GeglOperation *operation)
babl_model_is (model, "RaGaBaA") ||
babl_model_is (model, "R'aG'aB'aA"))
{
- format = babl_format_with_space (use_srgb?"R~aG~aB~a float":"RaGaBaA float", space);
+ format = babl_format_with_space (use_srgb?"R~aG~aB~aA float":"RaGaBaA float", space);
}
else
{
- format = babl_format_with_space (use_srgb?"R~aG~aB~a float":"RaGaBaA float", space);
+ format = babl_format_with_space (use_srgb?"R~aG~aB~aA float":"RaGaBaA float", space);
}
gegl_operation_set_format (operation, "input", format);
diff --git a/operations/generated/dst-atop.c b/operations/generated/dst-atop.c
index 15f8e2437..19028a13b 100644
--- a/operations/generated/dst-atop.c
+++ b/operations/generated/dst-atop.c
@@ -61,25 +61,19 @@ static void prepare (GeglOperation *operation)
if (babl_model_is (model, "Y") ||
babl_model_is (model, "Y'") ||
- babl_model_is (model, "Y~"))
- {
- format = babl_format_with_space (use_srgb?"Y~ float":"Y float", space);
- }
- else if (babl_model_is (model, "YA") ||
- babl_model_is (model, "Y'A") ||
- babl_model_is (model, "Y~A") ||
- babl_model_is (model, "YaA") ||
- babl_model_is (model, "Y'aA"))
+ babl_model_is (model, "Y~") ||
+ babl_model_is (model, "YA") ||
+ babl_model_is (model, "Y'A") ||
+ babl_model_is (model, "Y~A") ||
+ babl_model_is (model, "YaA") ||
+ babl_model_is (model, "Y'aA"))
{
format = babl_format_with_space (use_srgb?"Y~aA float":"YaA float", space);
}
else if (babl_model_is (model, "RGB") ||
babl_model_is (model, "R'G'B'") ||
- babl_model_is (model, "R~G~B~"))
- {
- format = babl_format_with_space (use_srgb?"R~G~B~ float":"RGB float", space);
- }
- else if (babl_model_is (model, "RGBA") ||
+ babl_model_is (model, "R~G~B~") ||
+ babl_model_is (model, "RGBA") ||
babl_model_is (model, "RGB") ||
babl_model_is (model, "R'G'B'A") ||
babl_model_is (model, "R'G'B'") ||
@@ -88,11 +82,11 @@ static void prepare (GeglOperation *operation)
babl_model_is (model, "RaGaBaA") ||
babl_model_is (model, "R'aG'aB'aA"))
{
- format = babl_format_with_space (use_srgb?"R~aG~aB~a float":"RaGaBaA float", space);
+ format = babl_format_with_space (use_srgb?"R~aG~aB~aA float":"RaGaBaA float", space);
}
else
{
- format = babl_format_with_space (use_srgb?"R~aG~aB~a float":"RaGaBaA float", space);
+ format = babl_format_with_space (use_srgb?"R~aG~aB~aA float":"RaGaBaA float", space);
}
gegl_operation_set_format (operation, "input", format);
@@ -115,7 +109,7 @@ process (GeglOperation *op,
gfloat * GEGL_ALIGNED out = out_buf;
const Babl *format = gegl_operation_get_format (op, "output");
gint components = babl_format_get_n_components (format);
- gint alpha = babl_format_has_alpha (format);
+ gint alpha = components-1;
if (!aux)
return TRUE;
@@ -126,18 +120,11 @@ process (GeglOperation *op,
gint j;
gfloat aA G_GNUC_UNUSED, aB G_GNUC_UNUSED, aD G_GNUC_UNUSED;
- if (alpha)
- {
- aB = in[components-1];
- aA = aux[components-1];
- }
- else
- {
- aB = aA = 1.0f;
- }
+ aB = in[alpha];
+ aA = aux[alpha];
aD = aA;
- for (j = 0; j < components-alpha; j++)
+ for (j = 0; j < alpha; j++)
{
gfloat cA G_GNUC_UNUSED, cB G_GNUC_UNUSED;
@@ -145,8 +132,7 @@ process (GeglOperation *op,
cA = aux[j];
out[j] = cB * aA + cA * (1.0f - aB);
}
- if (alpha)
- out[components-alpha] = aD;
+ out[alpha] = aD;
in += components;
aux += components;
out += components;
diff --git a/operations/generated/dst-in.c b/operations/generated/dst-in.c
index 6a7ec145c..c760b6d12 100644
--- a/operations/generated/dst-in.c
+++ b/operations/generated/dst-in.c
@@ -61,25 +61,19 @@ static void prepare (GeglOperation *operation)
if (babl_model_is (model, "Y") ||
babl_model_is (model, "Y'") ||
- babl_model_is (model, "Y~"))
- {
- format = babl_format_with_space (use_srgb?"Y~ float":"Y float", space);
- }
- else if (babl_model_is (model, "YA") ||
- babl_model_is (model, "Y'A") ||
- babl_model_is (model, "Y~A") ||
- babl_model_is (model, "YaA") ||
- babl_model_is (model, "Y'aA"))
+ babl_model_is (model, "Y~") ||
+ babl_model_is (model, "YA") ||
+ babl_model_is (model, "Y'A") ||
+ babl_model_is (model, "Y~A") ||
+ babl_model_is (model, "YaA") ||
+ babl_model_is (model, "Y'aA"))
{
format = babl_format_with_space (use_srgb?"Y~aA float":"YaA float", space);
}
else if (babl_model_is (model, "RGB") ||
babl_model_is (model, "R'G'B'") ||
- babl_model_is (model, "R~G~B~"))
- {
- format = babl_format_with_space (use_srgb?"R~G~B~ float":"RGB float", space);
- }
- else if (babl_model_is (model, "RGBA") ||
+ babl_model_is (model, "R~G~B~") ||
+ babl_model_is (model, "RGBA") ||
babl_model_is (model, "RGB") ||
babl_model_is (model, "R'G'B'A") ||
babl_model_is (model, "R'G'B'") ||
@@ -88,11 +82,11 @@ static void prepare (GeglOperation *operation)
babl_model_is (model, "RaGaBaA") ||
babl_model_is (model, "R'aG'aB'aA"))
{
- format = babl_format_with_space (use_srgb?"R~aG~aB~a float":"RaGaBaA float", space);
+ format = babl_format_with_space (use_srgb?"R~aG~aB~aA float":"RaGaBaA float", space);
}
else
{
- format = babl_format_with_space (use_srgb?"R~aG~aB~a float":"RaGaBaA float", space);
+ format = babl_format_with_space (use_srgb?"R~aG~aB~aA float":"RaGaBaA float", space);
}
gegl_operation_set_format (operation, "input", format);
@@ -115,7 +109,7 @@ process (GeglOperation *op,
gfloat * GEGL_ALIGNED out = out_buf;
const Babl *format = gegl_operation_get_format (op, "output");
gint components = babl_format_get_n_components (format);
- gint alpha = babl_format_has_alpha (format);
+ gint alpha = components-1;
if (!aux)
return TRUE;
@@ -126,18 +120,11 @@ process (GeglOperation *op,
gint j;
gfloat aA G_GNUC_UNUSED, aB G_GNUC_UNUSED, aD G_GNUC_UNUSED;
- if (alpha)
- {
- aB = in[components-1];
- aA = aux[components-1];
- }
- else
- {
- aB = aA = 1.0f;
- }
+ aB = in[alpha];
+ aA = aux[alpha];
aD = aA * aB;
- for (j = 0; j < components-alpha; j++)
+ for (j = 0; j < alpha; j++)
{
gfloat cA G_GNUC_UNUSED, cB G_GNUC_UNUSED;
@@ -145,8 +132,7 @@ process (GeglOperation *op,
cA = aux[j];
out[j] = cB * aA;
}
- if (alpha)
- out[components-alpha] = aD;
+ out[alpha] = aD;
in += components;
aux += components;
out += components;
diff --git a/operations/generated/dst-out.c b/operations/generated/dst-out.c
index 7cc90033f..ffd09e11f 100644
--- a/operations/generated/dst-out.c
+++ b/operations/generated/dst-out.c
@@ -61,25 +61,19 @@ static void prepare (GeglOperation *operation)
if (babl_model_is (model, "Y") ||
babl_model_is (model, "Y'") ||
- babl_model_is (model, "Y~"))
- {
- format = babl_format_with_space (use_srgb?"Y~ float":"Y float", space);
- }
- else if (babl_model_is (model, "YA") ||
- babl_model_is (model, "Y'A") ||
- babl_model_is (model, "Y~A") ||
- babl_model_is (model, "YaA") ||
- babl_model_is (model, "Y'aA"))
+ babl_model_is (model, "Y~") ||
+ babl_model_is (model, "YA") ||
+ babl_model_is (model, "Y'A") ||
+ babl_model_is (model, "Y~A") ||
+ babl_model_is (model, "YaA") ||
+ babl_model_is (model, "Y'aA"))
{
format = babl_format_with_space (use_srgb?"Y~aA float":"YaA float", space);
}
else if (babl_model_is (model, "RGB") ||
babl_model_is (model, "R'G'B'") ||
- babl_model_is (model, "R~G~B~"))
- {
- format = babl_format_with_space (use_srgb?"R~G~B~ float":"RGB float", space);
- }
- else if (babl_model_is (model, "RGBA") ||
+ babl_model_is (model, "R~G~B~") ||
+ babl_model_is (model, "RGBA") ||
babl_model_is (model, "RGB") ||
babl_model_is (model, "R'G'B'A") ||
babl_model_is (model, "R'G'B'") ||
@@ -88,11 +82,11 @@ static void prepare (GeglOperation *operation)
babl_model_is (model, "RaGaBaA") ||
babl_model_is (model, "R'aG'aB'aA"))
{
- format = babl_format_with_space (use_srgb?"R~aG~aB~a float":"RaGaBaA float", space);
+ format = babl_format_with_space (use_srgb?"R~aG~aB~aA float":"RaGaBaA float", space);
}
else
{
- format = babl_format_with_space (use_srgb?"R~aG~aB~a float":"RaGaBaA float", space);
+ format = babl_format_with_space (use_srgb?"R~aG~aB~aA float":"RaGaBaA float", space);
}
gegl_operation_set_format (operation, "input", format);
@@ -115,7 +109,7 @@ process (GeglOperation *op,
gfloat * GEGL_ALIGNED out = out_buf;
const Babl *format = gegl_operation_get_format (op, "output");
gint components = babl_format_get_n_components (format);
- gint alpha = babl_format_has_alpha (format);
+ gint alpha = components-1;
if (!aux)
{
@@ -124,11 +118,11 @@ process (GeglOperation *op,
gint j;
gfloat aA G_GNUC_UNUSED, aB G_GNUC_UNUSED, aD G_GNUC_UNUSED;
- aB = alpha?in[components-alpha]:1.0f;
+ aB = alpha?in[alpha]:1.0f;
aA = 0.0f;
aD = aB * (1.0f - aA);
- for (j = 0; j < components-alpha; j++)
+ for (j = 0; j < alpha; j++)
{
gfloat cA G_GNUC_UNUSED, cB G_GNUC_UNUSED;
@@ -136,8 +130,7 @@ process (GeglOperation *op,
cA = 0.0f;
out[j] = cB * (1.0f - aA);
}
- if (alpha)
- out[components-1] = aD;
+ out[alpha] = aD;
in += components;
out += components;
}
@@ -149,18 +142,11 @@ process (GeglOperation *op,
gint j;
gfloat aA G_GNUC_UNUSED, aB G_GNUC_UNUSED, aD G_GNUC_UNUSED;
- if (alpha)
- {
- aB = in[components-1];
- aA = aux[components-1];
- }
- else
- {
- aB = aA = 1.0f;
- }
+ aB = in[alpha];
+ aA = aux[alpha];
aD = aB * (1.0f - aA);
- for (j = 0; j < components-alpha; j++)
+ for (j = 0; j < alpha; j++)
{
gfloat cA G_GNUC_UNUSED, cB G_GNUC_UNUSED;
@@ -168,8 +154,7 @@ process (GeglOperation *op,
cA = aux[j];
out[j] = cB * (1.0f - aA);
}
- if (alpha)
- out[components-alpha] = aD;
+ out[alpha] = aD;
in += components;
aux += components;
out += components;
diff --git a/operations/generated/dst-over.c b/operations/generated/dst-over.c
index 22a3c0b71..75602371d 100644
--- a/operations/generated/dst-over.c
+++ b/operations/generated/dst-over.c
@@ -61,25 +61,19 @@ static void prepare (GeglOperation *operation)
if (babl_model_is (model, "Y") ||
babl_model_is (model, "Y'") ||
- babl_model_is (model, "Y~"))
- {
- format = babl_format_with_space (use_srgb?"Y~ float":"Y float", space);
- }
- else if (babl_model_is (model, "YA") ||
- babl_model_is (model, "Y'A") ||
- babl_model_is (model, "Y~A") ||
- babl_model_is (model, "YaA") ||
- babl_model_is (model, "Y'aA"))
+ babl_model_is (model, "Y~") ||
+ babl_model_is (model, "YA") ||
+ babl_model_is (model, "Y'A") ||
+ babl_model_is (model, "Y~A") ||
+ babl_model_is (model, "YaA") ||
+ babl_model_is (model, "Y'aA"))
{
format = babl_format_with_space (use_srgb?"Y~aA float":"YaA float", space);
}
else if (babl_model_is (model, "RGB") ||
babl_model_is (model, "R'G'B'") ||
- babl_model_is (model, "R~G~B~"))
- {
- format = babl_format_with_space (use_srgb?"R~G~B~ float":"RGB float", space);
- }
- else if (babl_model_is (model, "RGBA") ||
+ babl_model_is (model, "R~G~B~") ||
+ babl_model_is (model, "RGBA") ||
babl_model_is (model, "RGB") ||
babl_model_is (model, "R'G'B'A") ||
babl_model_is (model, "R'G'B'") ||
@@ -88,11 +82,11 @@ static void prepare (GeglOperation *operation)
babl_model_is (model, "RaGaBaA") ||
babl_model_is (model, "R'aG'aB'aA"))
{
- format = babl_format_with_space (use_srgb?"R~aG~aB~a float":"RaGaBaA float", space);
+ format = babl_format_with_space (use_srgb?"R~aG~aB~aA float":"RaGaBaA float", space);
}
else
{
- format = babl_format_with_space (use_srgb?"R~aG~aB~a float":"RaGaBaA float", space);
+ format = babl_format_with_space (use_srgb?"R~aG~aB~aA float":"RaGaBaA float", space);
}
gegl_operation_set_format (operation, "input", format);
@@ -115,7 +109,7 @@ process (GeglOperation *op,
gfloat * GEGL_ALIGNED out = out_buf;
const Babl *format = gegl_operation_get_format (op, "output");
gint components = babl_format_get_n_components (format);
- gint alpha = babl_format_has_alpha (format);
+ gint alpha = components-1;
if (!aux)
{
@@ -124,11 +118,11 @@ process (GeglOperation *op,
gint j;
gfloat aA G_GNUC_UNUSED, aB G_GNUC_UNUSED, aD G_GNUC_UNUSED;
- aB = alpha?in[components-alpha]:1.0f;
+ aB = alpha?in[alpha]:1.0f;
aA = 0.0f;
aD = aA + aB - aA * aB;
- for (j = 0; j < components-alpha; j++)
+ for (j = 0; j < alpha; j++)
{
gfloat cA G_GNUC_UNUSED, cB G_GNUC_UNUSED;
@@ -136,8 +130,7 @@ process (GeglOperation *op,
cA = 0.0f;
out[j] = cB + cA * (1.0f - aB);
}
- if (alpha)
- out[components-1] = aD;
+ out[alpha] = aD;
in += components;
out += components;
}
@@ -149,18 +142,11 @@ process (GeglOperation *op,
gint j;
gfloat aA G_GNUC_UNUSED, aB G_GNUC_UNUSED, aD G_GNUC_UNUSED;
- if (alpha)
- {
- aB = in[components-1];
- aA = aux[components-1];
- }
- else
- {
- aB = aA = 1.0f;
- }
+ aB = in[alpha];
+ aA = aux[alpha];
aD = aA + aB - aA * aB;
- for (j = 0; j < components-alpha; j++)
+ for (j = 0; j < alpha; j++)
{
gfloat cA G_GNUC_UNUSED, cB G_GNUC_UNUSED;
@@ -168,8 +154,7 @@ process (GeglOperation *op,
cA = aux[j];
out[j] = cB + cA * (1.0f - aB);
}
- if (alpha)
- out[components-alpha] = aD;
+ out[alpha] = aD;
in += components;
aux += components;
out += components;
diff --git a/operations/generated/dst.c b/operations/generated/dst.c
index 56d33759f..165288a54 100644
--- a/operations/generated/dst.c
+++ b/operations/generated/dst.c
@@ -61,25 +61,19 @@ static void prepare (GeglOperation *operation)
if (babl_model_is (model, "Y") ||
babl_model_is (model, "Y'") ||
- babl_model_is (model, "Y~"))
- {
- format = babl_format_with_space (use_srgb?"Y~ float":"Y float", space);
- }
- else if (babl_model_is (model, "YA") ||
- babl_model_is (model, "Y'A") ||
- babl_model_is (model, "Y~A") ||
- babl_model_is (model, "YaA") ||
- babl_model_is (model, "Y'aA"))
+ babl_model_is (model, "Y~") ||
+ babl_model_is (model, "YA") ||
+ babl_model_is (model, "Y'A") ||
+ babl_model_is (model, "Y~A") ||
+ babl_model_is (model, "YaA") ||
+ babl_model_is (model, "Y'aA"))
{
format = babl_format_with_space (use_srgb?"Y~aA float":"YaA float", space);
}
else if (babl_model_is (model, "RGB") ||
babl_model_is (model, "R'G'B'") ||
- babl_model_is (model, "R~G~B~"))
- {
- format = babl_format_with_space (use_srgb?"R~G~B~ float":"RGB float", space);
- }
- else if (babl_model_is (model, "RGBA") ||
+ babl_model_is (model, "R~G~B~") ||
+ babl_model_is (model, "RGBA") ||
babl_model_is (model, "RGB") ||
babl_model_is (model, "R'G'B'A") ||
babl_model_is (model, "R'G'B'") ||
@@ -88,11 +82,11 @@ static void prepare (GeglOperation *operation)
babl_model_is (model, "RaGaBaA") ||
babl_model_is (model, "R'aG'aB'aA"))
{
- format = babl_format_with_space (use_srgb?"R~aG~aB~a float":"RaGaBaA float", space);
+ format = babl_format_with_space (use_srgb?"R~aG~aB~aA float":"RaGaBaA float", space);
}
else
{
- format = babl_format_with_space (use_srgb?"R~aG~aB~a float":"RaGaBaA float", space);
+ format = babl_format_with_space (use_srgb?"R~aG~aB~aA float":"RaGaBaA float", space);
}
gegl_operation_set_format (operation, "input", format);
@@ -115,7 +109,7 @@ process (GeglOperation *op,
gfloat * GEGL_ALIGNED out = out_buf;
const Babl *format = gegl_operation_get_format (op, "output");
gint components = babl_format_get_n_components (format);
- gint alpha = babl_format_has_alpha (format);
+ gint alpha = components-1;
if (!aux)
{
@@ -124,11 +118,11 @@ process (GeglOperation *op,
gint j;
gfloat aA G_GNUC_UNUSED, aB G_GNUC_UNUSED, aD G_GNUC_UNUSED;
- aB = alpha?in[components-alpha]:1.0f;
+ aB = alpha?in[alpha]:1.0f;
aA = 0.0f;
aD = aB;
- for (j = 0; j < components-alpha; j++)
+ for (j = 0; j < alpha; j++)
{
gfloat cA G_GNUC_UNUSED, cB G_GNUC_UNUSED;
@@ -136,8 +130,7 @@ process (GeglOperation *op,
cA = 0.0f;
out[j] = cB;
}
- if (alpha)
- out[components-1] = aD;
+ out[alpha] = aD;
in += components;
out += components;
}
@@ -149,18 +142,11 @@ process (GeglOperation *op,
gint j;
gfloat aA G_GNUC_UNUSED, aB G_GNUC_UNUSED, aD G_GNUC_UNUSED;
- if (alpha)
- {
- aB = in[components-1];
- aA = aux[components-1];
- }
- else
- {
- aB = aA = 1.0f;
- }
+ aB = in[alpha];
+ aA = aux[alpha];
aD = aB;
- for (j = 0; j < components-alpha; j++)
+ for (j = 0; j < alpha; j++)
{
gfloat cA G_GNUC_UNUSED, cB G_GNUC_UNUSED;
@@ -168,8 +154,7 @@ process (GeglOperation *op,
cA = aux[j];
out[j] = cB;
}
- if (alpha)
- out[components-alpha] = aD;
+ out[alpha] = aD;
in += components;
aux += components;
out += components;
diff --git a/operations/generated/exclusion.c b/operations/generated/exclusion.c
index c8022991e..dd085ccc9 100644
--- a/operations/generated/exclusion.c
+++ b/operations/generated/exclusion.c
@@ -88,11 +88,11 @@ static void prepare (GeglOperation *operation)
babl_model_is (model, "RaGaBaA") ||
babl_model_is (model, "R'aG'aB'aA"))
{
- format = babl_format_with_space (use_srgb?"R~aG~aB~a float":"RaGaBaA float", space);
+ format = babl_format_with_space (use_srgb?"R~aG~aB~aA float":"RaGaBaA float", space);
}
else
{
- format = babl_format_with_space (use_srgb?"R~aG~aB~a float":"RaGaBaA float", space);
+ format = babl_format_with_space (use_srgb?"R~aG~aB~aA float":"RaGaBaA float", space);
}
gegl_operation_set_format (operation, "input", format);
diff --git a/operations/generated/hard-light.c b/operations/generated/hard-light.c
index 1f2c078f7..eff83d937 100644
--- a/operations/generated/hard-light.c
+++ b/operations/generated/hard-light.c
@@ -88,11 +88,11 @@ static void prepare (GeglOperation *operation)
babl_model_is (model, "RaGaBaA") ||
babl_model_is (model, "R'aG'aB'aA"))
{
- format = babl_format_with_space (use_srgb?"R~aG~aB~a float":"RaGaBaA float", space);
+ format = babl_format_with_space (use_srgb?"R~aG~aB~aA float":"RaGaBaA float", space);
}
else
{
- format = babl_format_with_space (use_srgb?"R~aG~aB~a float":"RaGaBaA float", space);
+ format = babl_format_with_space (use_srgb?"R~aG~aB~aA float":"RaGaBaA float", space);
}
gegl_operation_set_format (operation, "input", format);
diff --git a/operations/generated/lighten.c b/operations/generated/lighten.c
index 6c37389f7..21c98a0db 100644
--- a/operations/generated/lighten.c
+++ b/operations/generated/lighten.c
@@ -88,11 +88,11 @@ static void prepare (GeglOperation *operation)
babl_model_is (model, "RaGaBaA") ||
babl_model_is (model, "R'aG'aB'aA"))
{
- format = babl_format_with_space (use_srgb?"R~aG~aB~a float":"RaGaBaA float", space);
+ format = babl_format_with_space (use_srgb?"R~aG~aB~aA float":"RaGaBaA float", space);
}
else
{
- format = babl_format_with_space (use_srgb?"R~aG~aB~a float":"RaGaBaA float", space);
+ format = babl_format_with_space (use_srgb?"R~aG~aB~aA float":"RaGaBaA float", space);
}
gegl_operation_set_format (operation, "input", format);
diff --git a/operations/generated/overlay.c b/operations/generated/overlay.c
index 12aab208d..4d83845f5 100644
--- a/operations/generated/overlay.c
+++ b/operations/generated/overlay.c
@@ -88,11 +88,11 @@ static void prepare (GeglOperation *operation)
babl_model_is (model, "RaGaBaA") ||
babl_model_is (model, "R'aG'aB'aA"))
{
- format = babl_format_with_space (use_srgb?"R~aG~aB~a float":"RaGaBaA float", space);
+ format = babl_format_with_space (use_srgb?"R~aG~aB~aA float":"RaGaBaA float", space);
}
else
{
- format = babl_format_with_space (use_srgb?"R~aG~aB~a float":"RaGaBaA float", space);
+ format = babl_format_with_space (use_srgb?"R~aG~aB~aA float":"RaGaBaA float", space);
}
gegl_operation_set_format (operation, "input", format);
diff --git a/operations/generated/plus.c b/operations/generated/plus.c
index 6e8ece5a7..1162c59b9 100644
--- a/operations/generated/plus.c
+++ b/operations/generated/plus.c
@@ -88,11 +88,11 @@ static void prepare (GeglOperation *operation)
babl_model_is (model, "RaGaBaA") ||
babl_model_is (model, "R'aG'aB'aA"))
{
- format = babl_format_with_space (use_srgb?"R~aG~aB~a float":"RaGaBaA float", space);
+ format = babl_format_with_space (use_srgb?"R~aG~aB~aA float":"RaGaBaA float", space);
}
else
{
- format = babl_format_with_space (use_srgb?"R~aG~aB~a float":"RaGaBaA float", space);
+ format = babl_format_with_space (use_srgb?"R~aG~aB~aA float":"RaGaBaA float", space);
}
gegl_operation_set_format (operation, "input", format);
diff --git a/operations/generated/screen.c b/operations/generated/screen.c
index 0cee8cf8c..3122a255b 100644
--- a/operations/generated/screen.c
+++ b/operations/generated/screen.c
@@ -88,11 +88,11 @@ static void prepare (GeglOperation *operation)
babl_model_is (model, "RaGaBaA") ||
babl_model_is (model, "R'aG'aB'aA"))
{
- format = babl_format_with_space (use_srgb?"R~aG~aB~a float":"RaGaBaA float", space);
+ format = babl_format_with_space (use_srgb?"R~aG~aB~aA float":"RaGaBaA float", space);
}
else
{
- format = babl_format_with_space (use_srgb?"R~aG~aB~a float":"RaGaBaA float", space);
+ format = babl_format_with_space (use_srgb?"R~aG~aB~aA float":"RaGaBaA float", space);
}
gegl_operation_set_format (operation, "input", format);
diff --git a/operations/generated/soft-light.c b/operations/generated/soft-light.c
index 5822468dd..430a17ebb 100644
--- a/operations/generated/soft-light.c
+++ b/operations/generated/soft-light.c
@@ -89,11 +89,11 @@ static void prepare (GeglOperation *operation)
babl_model_is (model, "RaGaBaA") ||
babl_model_is (model, "R'aG'aB'aA"))
{
- format = babl_format_with_space (use_srgb?"R~aG~aB~a float":"RaGaBaA float", space);
+ format = babl_format_with_space (use_srgb?"R~aG~aB~aA float":"RaGaBaA float", space);
}
else
{
- format = babl_format_with_space (use_srgb?"R~aG~aB~a float":"RaGaBaA float", space);
+ format = babl_format_with_space (use_srgb?"R~aG~aB~aA float":"RaGaBaA float", space);
}
gegl_operation_set_format (operation, "input", format);
diff --git a/operations/generated/src-atop.c b/operations/generated/src-atop.c
index 376d9d520..78679c5b3 100644
--- a/operations/generated/src-atop.c
+++ b/operations/generated/src-atop.c
@@ -61,25 +61,19 @@ static void prepare (GeglOperation *operation)
if (babl_model_is (model, "Y") ||
babl_model_is (model, "Y'") ||
- babl_model_is (model, "Y~"))
- {
- format = babl_format_with_space (use_srgb?"Y~ float":"Y float", space);
- }
- else if (babl_model_is (model, "YA") ||
- babl_model_is (model, "Y'A") ||
- babl_model_is (model, "Y~A") ||
- babl_model_is (model, "YaA") ||
- babl_model_is (model, "Y'aA"))
+ babl_model_is (model, "Y~") ||
+ babl_model_is (model, "YA") ||
+ babl_model_is (model, "Y'A") ||
+ babl_model_is (model, "Y~A") ||
+ babl_model_is (model, "YaA") ||
+ babl_model_is (model, "Y'aA"))
{
format = babl_format_with_space (use_srgb?"Y~aA float":"YaA float", space);
}
else if (babl_model_is (model, "RGB") ||
babl_model_is (model, "R'G'B'") ||
- babl_model_is (model, "R~G~B~"))
- {
- format = babl_format_with_space (use_srgb?"R~G~B~ float":"RGB float", space);
- }
- else if (babl_model_is (model, "RGBA") ||
+ babl_model_is (model, "R~G~B~") ||
+ babl_model_is (model, "RGBA") ||
babl_model_is (model, "RGB") ||
babl_model_is (model, "R'G'B'A") ||
babl_model_is (model, "R'G'B'") ||
@@ -88,11 +82,11 @@ static void prepare (GeglOperation *operation)
babl_model_is (model, "RaGaBaA") ||
babl_model_is (model, "R'aG'aB'aA"))
{
- format = babl_format_with_space (use_srgb?"R~aG~aB~a float":"RaGaBaA float", space);
+ format = babl_format_with_space (use_srgb?"R~aG~aB~aA float":"RaGaBaA float", space);
}
else
{
- format = babl_format_with_space (use_srgb?"R~aG~aB~a float":"RaGaBaA float", space);
+ format = babl_format_with_space (use_srgb?"R~aG~aB~aA float":"RaGaBaA float", space);
}
gegl_operation_set_format (operation, "input", format);
@@ -115,7 +109,7 @@ process (GeglOperation *op,
gfloat * GEGL_ALIGNED out = out_buf;
const Babl *format = gegl_operation_get_format (op, "output");
gint components = babl_format_get_n_components (format);
- gint alpha = babl_format_has_alpha (format);
+ gint alpha = components-1;
if (!aux)
{
@@ -124,11 +118,11 @@ process (GeglOperation *op,
gint j;
gfloat aA G_GNUC_UNUSED, aB G_GNUC_UNUSED, aD G_GNUC_UNUSED;
- aB = alpha?in[components-alpha]:1.0f;
+ aB = alpha?in[alpha]:1.0f;
aA = 0.0f;
aD = aB;
- for (j = 0; j < components-alpha; j++)
+ for (j = 0; j < alpha; j++)
{
gfloat cA G_GNUC_UNUSED, cB G_GNUC_UNUSED;
@@ -136,8 +130,7 @@ process (GeglOperation *op,
cA = 0.0f;
out[j] = cA * aB + cB * (1.0f - aA);
}
- if (alpha)
- out[components-1] = aD;
+ out[alpha] = aD;
in += components;
out += components;
}
@@ -149,18 +142,11 @@ process (GeglOperation *op,
gint j;
gfloat aA G_GNUC_UNUSED, aB G_GNUC_UNUSED, aD G_GNUC_UNUSED;
- if (alpha)
- {
- aB = in[components-1];
- aA = aux[components-1];
- }
- else
- {
- aB = aA = 1.0f;
- }
+ aB = in[alpha];
+ aA = aux[alpha];
aD = aB;
- for (j = 0; j < components-alpha; j++)
+ for (j = 0; j < alpha; j++)
{
gfloat cA G_GNUC_UNUSED, cB G_GNUC_UNUSED;
@@ -168,8 +154,7 @@ process (GeglOperation *op,
cA = aux[j];
out[j] = cA * aB + cB * (1.0f - aA);
}
- if (alpha)
- out[components-alpha] = aD;
+ out[alpha] = aD;
in += components;
aux += components;
out += components;
diff --git a/operations/generated/src-in.c b/operations/generated/src-in.c
index fc0d0c031..71f1b0114 100644
--- a/operations/generated/src-in.c
+++ b/operations/generated/src-in.c
@@ -61,25 +61,19 @@ static void prepare (GeglOperation *operation)
if (babl_model_is (model, "Y") ||
babl_model_is (model, "Y'") ||
- babl_model_is (model, "Y~"))
- {
- format = babl_format_with_space (use_srgb?"Y~ float":"Y float", space);
- }
- else if (babl_model_is (model, "YA") ||
- babl_model_is (model, "Y'A") ||
- babl_model_is (model, "Y~A") ||
- babl_model_is (model, "YaA") ||
- babl_model_is (model, "Y'aA"))
+ babl_model_is (model, "Y~") ||
+ babl_model_is (model, "YA") ||
+ babl_model_is (model, "Y'A") ||
+ babl_model_is (model, "Y~A") ||
+ babl_model_is (model, "YaA") ||
+ babl_model_is (model, "Y'aA"))
{
format = babl_format_with_space (use_srgb?"Y~aA float":"YaA float", space);
}
else if (babl_model_is (model, "RGB") ||
babl_model_is (model, "R'G'B'") ||
- babl_model_is (model, "R~G~B~"))
- {
- format = babl_format_with_space (use_srgb?"R~G~B~ float":"RGB float", space);
- }
- else if (babl_model_is (model, "RGBA") ||
+ babl_model_is (model, "R~G~B~") ||
+ babl_model_is (model, "RGBA") ||
babl_model_is (model, "RGB") ||
babl_model_is (model, "R'G'B'A") ||
babl_model_is (model, "R'G'B'") ||
@@ -88,11 +82,11 @@ static void prepare (GeglOperation *operation)
babl_model_is (model, "RaGaBaA") ||
babl_model_is (model, "R'aG'aB'aA"))
{
- format = babl_format_with_space (use_srgb?"R~aG~aB~a float":"RaGaBaA float", space);
+ format = babl_format_with_space (use_srgb?"R~aG~aB~aA float":"RaGaBaA float", space);
}
else
{
- format = babl_format_with_space (use_srgb?"R~aG~aB~a float":"RaGaBaA float", space);
+ format = babl_format_with_space (use_srgb?"R~aG~aB~aA float":"RaGaBaA float", space);
}
gegl_operation_set_format (operation, "input", format);
@@ -115,7 +109,7 @@ process (GeglOperation *op,
gfloat * GEGL_ALIGNED out = out_buf;
const Babl *format = gegl_operation_get_format (op, "output");
gint components = babl_format_get_n_components (format);
- gint alpha = babl_format_has_alpha (format);
+ gint alpha = components-1;
if (!aux)
return TRUE;
@@ -125,18 +119,12 @@ process (GeglOperation *op,
gint j;
gfloat aA G_GNUC_UNUSED, aB G_GNUC_UNUSED, aD G_GNUC_UNUSED;
- if (alpha)
- {
- aB = in[components-1];
- aA = aux[components-1];
- }
- else
- {
- aB = aA = 1.0f;
- }
+ aB = in[alpha];
+ aA = aux[alpha];
+
aD = aA * aB;
- for (j = 0; j < components-alpha; j++)
+ for (j = 0; j < alpha; j++)
{
gfloat cA G_GNUC_UNUSED, cB G_GNUC_UNUSED;
@@ -144,8 +132,7 @@ process (GeglOperation *op,
cA = aux[j];
out[j] = cA * aB;
}
- if (alpha)
- out[components-alpha] = aD;
+ out[alpha] = aD;
in += components;
aux += components;
out += components;
diff --git a/operations/generated/src-out.c b/operations/generated/src-out.c
index 452bfafe1..b0c6a0ad4 100644
--- a/operations/generated/src-out.c
+++ b/operations/generated/src-out.c
@@ -61,25 +61,19 @@ static void prepare (GeglOperation *operation)
if (babl_model_is (model, "Y") ||
babl_model_is (model, "Y'") ||
- babl_model_is (model, "Y~"))
- {
- format = babl_format_with_space (use_srgb?"Y~ float":"Y float", space);
- }
- else if (babl_model_is (model, "YA") ||
- babl_model_is (model, "Y'A") ||
- babl_model_is (model, "Y~A") ||
- babl_model_is (model, "YaA") ||
- babl_model_is (model, "Y'aA"))
+ babl_model_is (model, "Y~") ||
+ babl_model_is (model, "YA") ||
+ babl_model_is (model, "Y'A") ||
+ babl_model_is (model, "Y~A") ||
+ babl_model_is (model, "YaA") ||
+ babl_model_is (model, "Y'aA"))
{
format = babl_format_with_space (use_srgb?"Y~aA float":"YaA float", space);
}
else if (babl_model_is (model, "RGB") ||
babl_model_is (model, "R'G'B'") ||
- babl_model_is (model, "R~G~B~"))
- {
- format = babl_format_with_space (use_srgb?"R~G~B~ float":"RGB float", space);
- }
- else if (babl_model_is (model, "RGBA") ||
+ babl_model_is (model, "R~G~B~") ||
+ babl_model_is (model, "RGBA") ||
babl_model_is (model, "RGB") ||
babl_model_is (model, "R'G'B'A") ||
babl_model_is (model, "R'G'B'") ||
@@ -88,11 +82,11 @@ static void prepare (GeglOperation *operation)
babl_model_is (model, "RaGaBaA") ||
babl_model_is (model, "R'aG'aB'aA"))
{
- format = babl_format_with_space (use_srgb?"R~aG~aB~a float":"RaGaBaA float", space);
+ format = babl_format_with_space (use_srgb?"R~aG~aB~aA float":"RaGaBaA float", space);
}
else
{
- format = babl_format_with_space (use_srgb?"R~aG~aB~a float":"RaGaBaA float", space);
+ format = babl_format_with_space (use_srgb?"R~aG~aB~aA float":"RaGaBaA float", space);
}
gegl_operation_set_format (operation, "input", format);
@@ -115,7 +109,7 @@ process (GeglOperation *op,
gfloat * GEGL_ALIGNED out = out_buf;
const Babl *format = gegl_operation_get_format (op, "output");
gint components = babl_format_get_n_components (format);
- gint alpha = babl_format_has_alpha (format);
+ gint alpha = components-1;
if (!aux)
return TRUE;
@@ -126,18 +120,11 @@ process (GeglOperation *op,
gint j;
gfloat aA G_GNUC_UNUSED, aB G_GNUC_UNUSED, aD G_GNUC_UNUSED;
- if (alpha)
- {
- aB = in[components-1];
- aA = aux[components-1];
- }
- else
- {
- aB = aA = 1.0f;
- }
+ aB = in[alpha];
+ aA = aux[alpha];
aD = aA * (1.0f - aB);
- for (j = 0; j < components-alpha; j++)
+ for (j = 0; j < alpha; j++)
{
gfloat cA G_GNUC_UNUSED, cB G_GNUC_UNUSED;
@@ -145,8 +132,7 @@ process (GeglOperation *op,
cA = aux[j];
out[j] = cA * (1.0f - aB);
}
- if (alpha)
- out[components-alpha] = aD;
+ out[alpha] = aD;
in += components;
aux += components;
out += components;
diff --git a/operations/generated/src.c b/operations/generated/src.c
index c03cc0b93..9fb7dc4a5 100644
--- a/operations/generated/src.c
+++ b/operations/generated/src.c
@@ -61,25 +61,19 @@ static void prepare (GeglOperation *operation)
if (babl_model_is (model, "Y") ||
babl_model_is (model, "Y'") ||
- babl_model_is (model, "Y~"))
- {
- format = babl_format_with_space (use_srgb?"Y~ float":"Y float", space);
- }
- else if (babl_model_is (model, "YA") ||
- babl_model_is (model, "Y'A") ||
- babl_model_is (model, "Y~A") ||
- babl_model_is (model, "YaA") ||
- babl_model_is (model, "Y'aA"))
+ babl_model_is (model, "Y~") ||
+ babl_model_is (model, "YA") ||
+ babl_model_is (model, "Y'A") ||
+ babl_model_is (model, "Y~A") ||
+ babl_model_is (model, "YaA") ||
+ babl_model_is (model, "Y'aA"))
{
format = babl_format_with_space (use_srgb?"Y~aA float":"YaA float", space);
}
else if (babl_model_is (model, "RGB") ||
babl_model_is (model, "R'G'B'") ||
- babl_model_is (model, "R~G~B~"))
- {
- format = babl_format_with_space (use_srgb?"R~G~B~ float":"RGB float", space);
- }
- else if (babl_model_is (model, "RGBA") ||
+ babl_model_is (model, "R~G~B~") ||
+ babl_model_is (model, "RGBA") ||
babl_model_is (model, "RGB") ||
babl_model_is (model, "R'G'B'A") ||
babl_model_is (model, "R'G'B'") ||
@@ -88,11 +82,11 @@ static void prepare (GeglOperation *operation)
babl_model_is (model, "RaGaBaA") ||
babl_model_is (model, "R'aG'aB'aA"))
{
- format = babl_format_with_space (use_srgb?"R~aG~aB~a float":"RaGaBaA float", space);
+ format = babl_format_with_space (use_srgb?"R~aG~aB~aA float":"RaGaBaA float", space);
}
else
{
- format = babl_format_with_space (use_srgb?"R~aG~aB~a float":"RaGaBaA float", space);
+ format = babl_format_with_space (use_srgb?"R~aG~aB~aA float":"RaGaBaA float", space);
}
gegl_operation_set_format (operation, "input", format);
@@ -115,7 +109,7 @@ process (GeglOperation *op,
gfloat * GEGL_ALIGNED out = out_buf;
const Babl *format = gegl_operation_get_format (op, "output");
gint components = babl_format_get_n_components (format);
- gint alpha = babl_format_has_alpha (format);
+ gint alpha = components-1;
if (!aux)
return TRUE;
@@ -126,18 +120,11 @@ process (GeglOperation *op,
gint j;
gfloat aA G_GNUC_UNUSED, aB G_GNUC_UNUSED, aD G_GNUC_UNUSED;
- if (alpha)
- {
- aB = in[components-1];
- aA = aux[components-1];
- }
- else
- {
- aB = aA = 1.0f;
- }
+ aB = in[alpha];
+ aA = aux[alpha];
aD = aA;
- for (j = 0; j < components-alpha; j++)
+ for (j = 0; j < alpha; j++)
{
gfloat cA G_GNUC_UNUSED, cB G_GNUC_UNUSED;
@@ -145,8 +132,7 @@ process (GeglOperation *op,
cA = aux[j];
out[j] = cA;
}
- if (alpha)
- out[components-alpha] = aD;
+ out[alpha] = aD;
in += components;
aux += components;
out += components;
diff --git a/operations/generated/svg-12-blend.rb b/operations/generated/svg-12-blend.rb
index 1600bb5e2..8221684d4 100755
--- a/operations/generated/svg-12-blend.rb
+++ b/operations/generated/svg-12-blend.rb
@@ -133,11 +133,11 @@ static void prepare (GeglOperation *operation)
babl_model_is (model, "RaGaBaA") ||
babl_model_is (model, "R\'aG\'aB\'aA"))
{
- format = babl_format_with_space (use_srgb?"R~aG~aB~a float":"RaGaBaA float", space);
+ format = babl_format_with_space (use_srgb?"R~aG~aB~aA float":"RaGaBaA float", space);
}
else
{
- format = babl_format_with_space (use_srgb?"R~aG~aB~a float":"RaGaBaA float", space);
+ format = babl_format_with_space (use_srgb?"R~aG~aB~aA float":"RaGaBaA float", space);
}
gegl_operation_set_format (operation, "input", format);
diff --git a/operations/generated/svg-12-porter-duff.rb b/operations/generated/svg-12-porter-duff.rb
index 97bd39bb4..9f1826c5d 100755
--- a/operations/generated/svg-12-porter-duff.rb
+++ b/operations/generated/svg-12-porter-duff.rb
@@ -103,25 +103,19 @@ static void prepare (GeglOperation *operation)
if (babl_model_is (model, "Y") ||
babl_model_is (model, "Y\'") ||
- babl_model_is (model, "Y~"))
- {
- format = babl_format_with_space (use_srgb?"Y~ float":"Y float", space);
- }
- else if (babl_model_is (model, "YA") ||
- babl_model_is (model, "Y\'A") ||
- babl_model_is (model, "Y~A") ||
- babl_model_is (model, "YaA") ||
- babl_model_is (model, "Y\'aA"))
+ babl_model_is (model, "Y~") ||
+ babl_model_is (model, "YA") ||
+ babl_model_is (model, "Y\'A") ||
+ babl_model_is (model, "Y~A") ||
+ babl_model_is (model, "YaA") ||
+ babl_model_is (model, "Y\'aA"))
{
format = babl_format_with_space (use_srgb?"Y~aA float":"YaA float", space);
}
else if (babl_model_is (model, "RGB") ||
babl_model_is (model, "R\'G\'B\'") ||
- babl_model_is (model, "R~G~B~"))
- {
- format = babl_format_with_space (use_srgb?"R~G~B~ float":"RGB float", space);
- }
- else if (babl_model_is (model, "RGBA") ||
+ babl_model_is (model, "R~G~B~") ||
+ babl_model_is (model, "RGBA") ||
babl_model_is (model, "RGB") ||
babl_model_is (model, "R\'G\'B\'A") ||
babl_model_is (model, "R\'G\'B\'") ||
@@ -130,11 +124,11 @@ static void prepare (GeglOperation *operation)
babl_model_is (model, "RaGaBaA") ||
babl_model_is (model, "R\'aG\'aB\'aA"))
{
- format = babl_format_with_space (use_srgb?"R~aG~aB~a float":"RaGaBaA float", space);
+ format = babl_format_with_space (use_srgb?"R~aG~aB~aA float":"RaGaBaA float", space);
}
else
{
- format = babl_format_with_space (use_srgb?"R~aG~aB~a float":"RaGaBaA float", space);
+ format = babl_format_with_space (use_srgb?"R~aG~aB~aA float":"RaGaBaA float", space);
}
gegl_operation_set_format (operation, "input", format);
@@ -157,7 +151,7 @@ process (GeglOperation *op,
gfloat * GEGL_ALIGNED out = out_buf;
const Babl *format = gegl_operation_get_format (op, "output");
gint components = babl_format_get_n_components (format);
- gint alpha = babl_format_has_alpha (format);
+ gint alpha = components-1;
'
file_tail1 = '
@@ -218,11 +212,11 @@ a.each do
gint j;
gfloat aA G_GNUC_UNUSED, aB G_GNUC_UNUSED, aD G_GNUC_UNUSED;
- aB = alpha?in[components-alpha]:1.0f;
+ aB = alpha?in[alpha]:1.0f;
aA = 0.0f;
aD = #{a_formula};
- for (j = 0; j < components-alpha; j++)
+ for (j = 0; j < alpha; j++)
{
gfloat cA G_GNUC_UNUSED, cB G_GNUC_UNUSED;
@@ -230,8 +224,7 @@ a.each do
cA = 0.0f;
out[j] = #{c_formula};
}
- if (alpha)
- out[components-1] = aD;
+ out[alpha] = aD;
in += components;
out += components;
}
@@ -251,18 +244,11 @@ a.each do
gint j;
gfloat aA G_GNUC_UNUSED, aB G_GNUC_UNUSED, aD G_GNUC_UNUSED;
- if (alpha)
- {
- aB = in[components-1];
- aA = aux[components-1];
- }
- else
- {
- aB = aA = 1.0f;
- }
+ aB = in[alpha];
+ aA = aux[alpha];
aD = #{a_formula};
- for (j = 0; j < components-alpha; j++)
+ for (j = 0; j < alpha; j++)
{
gfloat cA G_GNUC_UNUSED, cB G_GNUC_UNUSED;
@@ -270,8 +256,7 @@ a.each do
cA = aux[j];
out[j] = #{c_formula};
}
- if (alpha)
- out[components-alpha] = aD;
+ out[alpha] = aD;
in += components;
aux += components;
out += components;
@@ -334,18 +319,12 @@ b.each do
gint j;
gfloat aA G_GNUC_UNUSED, aB G_GNUC_UNUSED, aD G_GNUC_UNUSED;
- if (alpha)
- {
- aB = in[components-1];
- aA = aux[components-1];
- }
- else
- {
- aB = aA = 1.0f;
- }
+ aB = in[alpha];
+ aA = aux[alpha];
+
aD = #{a_formula};
- for (j = 0; j < components-alpha; j++)
+ for (j = 0; j < alpha; j++)
{
gfloat cA G_GNUC_UNUSED, cB G_GNUC_UNUSED;
@@ -353,8 +332,7 @@ b.each do
cA = aux[j];
out[j] = #{c_formula};
}
- if (alpha)
- out[components-alpha] = aD;
+ out[alpha] = aD;
in += components;
aux += components;
out += components;
diff --git a/operations/generated/xor.c b/operations/generated/xor.c
index fd983eb6b..4d216ffa9 100644
--- a/operations/generated/xor.c
+++ b/operations/generated/xor.c
@@ -61,25 +61,19 @@ static void prepare (GeglOperation *operation)
if (babl_model_is (model, "Y") ||
babl_model_is (model, "Y'") ||
- babl_model_is (model, "Y~"))
- {
- format = babl_format_with_space (use_srgb?"Y~ float":"Y float", space);
- }
- else if (babl_model_is (model, "YA") ||
- babl_model_is (model, "Y'A") ||
- babl_model_is (model, "Y~A") ||
- babl_model_is (model, "YaA") ||
- babl_model_is (model, "Y'aA"))
+ babl_model_is (model, "Y~") ||
+ babl_model_is (model, "YA") ||
+ babl_model_is (model, "Y'A") ||
+ babl_model_is (model, "Y~A") ||
+ babl_model_is (model, "YaA") ||
+ babl_model_is (model, "Y'aA"))
{
format = babl_format_with_space (use_srgb?"Y~aA float":"YaA float", space);
}
else if (babl_model_is (model, "RGB") ||
babl_model_is (model, "R'G'B'") ||
- babl_model_is (model, "R~G~B~"))
- {
- format = babl_format_with_space (use_srgb?"R~G~B~ float":"RGB float", space);
- }
- else if (babl_model_is (model, "RGBA") ||
+ babl_model_is (model, "R~G~B~") ||
+ babl_model_is (model, "RGBA") ||
babl_model_is (model, "RGB") ||
babl_model_is (model, "R'G'B'A") ||
babl_model_is (model, "R'G'B'") ||
@@ -88,11 +82,11 @@ static void prepare (GeglOperation *operation)
babl_model_is (model, "RaGaBaA") ||
babl_model_is (model, "R'aG'aB'aA"))
{
- format = babl_format_with_space (use_srgb?"R~aG~aB~a float":"RaGaBaA float", space);
+ format = babl_format_with_space (use_srgb?"R~aG~aB~aA float":"RaGaBaA float", space);
}
else
{
- format = babl_format_with_space (use_srgb?"R~aG~aB~a float":"RaGaBaA float", space);
+ format = babl_format_with_space (use_srgb?"R~aG~aB~aA float":"RaGaBaA float", space);
}
gegl_operation_set_format (operation, "input", format);
@@ -115,7 +109,7 @@ process (GeglOperation *op,
gfloat * GEGL_ALIGNED out = out_buf;
const Babl *format = gegl_operation_get_format (op, "output");
gint components = babl_format_get_n_components (format);
- gint alpha = babl_format_has_alpha (format);
+ gint alpha = components-1;
if (!aux)
{
@@ -124,11 +118,11 @@ process (GeglOperation *op,
gint j;
gfloat aA G_GNUC_UNUSED, aB G_GNUC_UNUSED, aD G_GNUC_UNUSED;
- aB = alpha?in[components-alpha]:1.0f;
+ aB = alpha?in[alpha]:1.0f;
aA = 0.0f;
aD = aA + aB - 2.0f * aA * aB;
- for (j = 0; j < components-alpha; j++)
+ for (j = 0; j < alpha; j++)
{
gfloat cA G_GNUC_UNUSED, cB G_GNUC_UNUSED;
@@ -136,8 +130,7 @@ process (GeglOperation *op,
cA = 0.0f;
out[j] = cA * (1.0f - aB)+ cB * (1.0f - aA);
}
- if (alpha)
- out[components-1] = aD;
+ out[alpha] = aD;
in += components;
out += components;
}
@@ -149,18 +142,11 @@ process (GeglOperation *op,
gint j;
gfloat aA G_GNUC_UNUSED, aB G_GNUC_UNUSED, aD G_GNUC_UNUSED;
- if (alpha)
- {
- aB = in[components-1];
- aA = aux[components-1];
- }
- else
- {
- aB = aA = 1.0f;
- }
+ aB = in[alpha];
+ aA = aux[alpha];
aD = aA + aB - 2.0f * aA * aB;
- for (j = 0; j < components-alpha; j++)
+ for (j = 0; j < alpha; j++)
{
gfloat cA G_GNUC_UNUSED, cB G_GNUC_UNUSED;
@@ -168,8 +154,7 @@ process (GeglOperation *op,
cA = aux[j];
out[j] = cA * (1.0f - aB)+ cB * (1.0f - aA);
}
- if (alpha)
- out[components-alpha] = aD;
+ out[alpha] = aD;
in += components;
aux += components;
out += components;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]