[gegl] fix some floating point issues in color-to-alpha
- From: Simon Budig <simon src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gegl] fix some floating point issues in color-to-alpha
- Date: Tue, 16 Apr 2013 13:46:51 +0000 (UTC)
commit c5350f934ff5262e74e2df2dc79822184a6bb428
Author: Simon Budig <simon budig de>
Date: Tue Apr 16 15:45:48 2013 +0200
fix some floating point issues in color-to-alpha
operations/common/color-to-alpha.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/operations/common/color-to-alpha.c b/operations/common/color-to-alpha.c
index d0dcd67..01406c8 100644
--- a/operations/common/color-to-alpha.c
+++ b/operations/common/color-to-alpha.c
@@ -93,11 +93,11 @@ color_to_alpha (const gdouble *color,
for (i=0; i<3; i++)
{
- if (color[i] < 0.0001)
+ if (color[i] < 0.00001)
alpha[i] = dst[i];
- else if (dst[i] > color[i])
+ else if (dst[i] > color[i] + 0.00001)
alpha[i] = (dst[i] - color[i]) / (1.0f - color[i]);
- else if (dst[i] < color[i])
+ else if (dst[i] < color[i] - 0.00001)
alpha[i] = (color[i] - dst[i]) / (color[i]);
else
alpha[i] = 0.0f;
@@ -119,7 +119,7 @@ color_to_alpha (const gdouble *color,
dst[3] = alpha[2];
}
- if (dst[3] < 0.0001)
+ if (dst[3] < 0.00001)
return;
for (i=0; i<3; i++)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]