[gegl] opacity: refactor RGBA path dispatch
- From: Ãyvind KolÃs <ok src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gegl] opacity: refactor RGBA path dispatch
- Date: Sun, 30 Dec 2012 00:21:22 +0000 (UTC)
commit 7c386e398e5900527b9fbed1a026e8a92cc10d13
Author: Ãyvind KolÃs <pippin gimp org>
Date: Sun Dec 30 11:20:50 2012 +1100
opacity: refactor RGBA path dispatch
operations/common/opacity.c | 115 ++++++++++++++++++++++++++-----------------
1 files changed, 70 insertions(+), 45 deletions(-)
---
diff --git a/operations/common/opacity.c b/operations/common/opacity.c
index 4df4867..8ac85cb 100644
--- a/operations/common/opacity.c
+++ b/operations/common/opacity.c
@@ -55,30 +55,26 @@ static void prepare (GeglOperation *self)
}
static gboolean
-process (GeglOperation *op,
- void *in_buf,
- void *aux_buf,
- void *out_buf,
- glong samples,
- const GeglRectangle *roi,
- gint level)
+process_RaGaBaAfloat (GeglOperation *op,
+ void *in_buf,
+ void *aux_buf,
+ void *out_buf,
+ glong samples,
+ const GeglRectangle *roi,
+ gint level)
{
gfloat *in = in_buf;
gfloat *out = out_buf;
gfloat *aux = aux_buf;
gfloat value = GEGL_CHANT_PROPERTIES (op)->value;
-
- if (GEGL_CHANT_PROPERTIES (op)->chant_data) /* RGBA version indicator */
- {
if (aux == NULL)
{
g_assert (value != 1.0); /* buffer should have been passed through */
while (samples--)
{
gint j;
- for (j=0; j<3; j++)
- out[j] = in[j];
- out[3] = in[3] * value;
+ for (j=0; j<4; j++)
+ out[j] = in[j] * value;
in += 4;
out += 4;
}
@@ -98,50 +94,79 @@ process (GeglOperation *op,
{
gfloat v = (*aux) * value;
gint j;
- for (j=0; j<3; j++)
- out[j] = in[j];
- out[3] = in[3] * v;
- in += 4;
- out += 4;
- aux += 1;
- }
- }
- else
- {
- if (aux == NULL)
- {
- g_assert (value != 1.0); /* buffer should have been passed through */
- while (samples--)
- {
- gint j;
- for (j=0; j<4; j++)
- out[j] = in[j] * value;
- in += 4;
- out += 4;
- }
- }
- else if (value == 1.0)
- while (samples--)
- {
- gint j;
for (j=0; j<4; j++)
- out[j] = in[j] * (*aux);
+ out[j] = in[j] * v;
in += 4;
out += 4;
aux += 1;
}
- else
+}
+
+
+static gboolean
+process_RGBAfloat (GeglOperation *op,
+ void *in_buf,
+ void *aux_buf,
+ void *out_buf,
+ glong samples,
+ const GeglRectangle *roi,
+ gint level)
+{
+ gfloat *in = in_buf;
+ gfloat *out = out_buf;
+ gfloat *aux = aux_buf;
+ gfloat value = GEGL_CHANT_PROPERTIES (op)->value;
+
+ if (aux == NULL)
+ {
+ g_assert (value != 1.0); /* buffer should have been passed through */
while (samples--)
{
- gfloat v = (*aux) * value;
gint j;
- for (j=0; j<4; j++)
- out[j] = in[j] * v;
+ for (j=0; j<3; j++)
+ out[j] = in[j];
+ out[3] = in[3] * value;
in += 4;
out += 4;
- aux += 1;
}
}
+ else if (value == 1.0)
+ while (samples--)
+ {
+ gint j;
+ for (j=0; j<4; j++)
+ out[j] = in[j] * (*aux);
+ in += 4;
+ out += 4;
+ aux += 1;
+ }
+ else
+ while (samples--)
+ {
+ gfloat v = (*aux) * value;
+ gint j;
+ for (j=0; j<3; j++)
+ out[j] = in[j];
+ out[3] = in[3] * v;
+ in += 4;
+ out += 4;
+ aux += 1;
+ }
+}
+
+static gboolean
+process (GeglOperation *op,
+ void *in_buf,
+ void *aux_buf,
+ void *out_buf,
+ glong samples,
+ const GeglRectangle *roi,
+ gint level)
+{
+ if (GEGL_CHANT_PROPERTIES (op)->chant_data != NULL)
+ process_RGBAfloat (op, in_buf, aux_buf, out_buf, samples, roi, level);
+ else
+ process_RaGaBaAfloat (op, in_buf, aux_buf, out_buf, samples, roi, level);
return TRUE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]