Commit 23121ffb authored by Mukund Sivaraman's avatar Mukund Sivaraman

color-to-alpha: Indent code to our style (contd.)

parent 7e420a45
...@@ -91,16 +91,17 @@ color_to_alpha (gfloat *color, ...@@ -91,16 +91,17 @@ color_to_alpha (gfloat *color,
temp[3] = src[offset + 3]; temp[3] = src[offset + 3];
src[offset+3] = temp[3]; src[offset+3] = temp[3];
for (i=0; i<3; i++) for (i=0; i<3; i++)
if (color[i] < 0.0001) {
temp[i] = src[offset+i]; if (color[i] < 1.e-4f)
else if (src[offset+i] > color[i]) temp[i] = src[offset+i];
temp[i] = (src[offset+i] - color[i]) / (1.0 - color[i]); else if (src[offset+i] > color[i])
else if (src[offset+i] < color[i]) temp[i] = (src[offset+i] - color[i]) / (1.0 - color[i]);
temp[i] = (color[i] - src[offset+i]) / color[i]; else if (src[offset+i] < color[i])
else temp[i] = (color[i] - src[offset+i]) / color[i];
temp[i] = 0.0; else
temp[i] = 0.0;
}
if (temp[0] > temp[1]) if (temp[0] > temp[1])
{ {
...@@ -114,13 +115,13 @@ color_to_alpha (gfloat *color, ...@@ -114,13 +115,13 @@ color_to_alpha (gfloat *color,
else else
src[offset+3] = temp[2]; src[offset+3] = temp[2];
if (src[offset+3] < 0.0001) if (src[offset+3] < 1.e-4f)
return; return;
for (i=0; i<3; i++) for (i=0; i<3; i++)
src[offset+i] = (src[offset+i] - color[i]) / src[offset+3] + color[i]; src[offset+i] = (src[offset+i] - color[i]) / src[offset+3] + color[i];
src[offset+3] *=temp[3]; src[offset+3] *= temp[3];
} }
...@@ -131,11 +132,10 @@ process (GeglOperation *operation, ...@@ -131,11 +132,10 @@ process (GeglOperation *operation,
GeglBuffer *output, GeglBuffer *output,
const GeglRectangle *result) const GeglRectangle *result)
{ {
GeglChantO *o = GEGL_CHANT_PROPERTIES (operation); GeglChantO *o = GEGL_CHANT_PROPERTIES (operation);
Babl *format = babl_format ("RGBA float"); Babl *format = babl_format ("RGBA float");
gfloat *src_buf, color[4];
gfloat *src_buf, color[4]; gint x;
gint x;
src_buf = g_new0 (gfloat, result->width * result->height * 4); src_buf = g_new0 (gfloat, result->width * result->height * 4);
...@@ -150,7 +150,7 @@ process (GeglOperation *operation, ...@@ -150,7 +150,7 @@ process (GeglOperation *operation,
g_free (src_buf); g_free (src_buf);
return TRUE; return TRUE;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment