summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSøren Sandmann Pedersen <ssp@redhat.com>2012-09-17 08:43:57 -0400
committerSøren Sandmann Pedersen <ssp@redhat.com>2012-09-21 18:36:35 -0400
commit17de7958962f10c2e167dd0ea5ad0792c2593720 (patch)
treed80c6ef2a8dbf42bdfa85ed5e507d998a38b71f8
parent858fed3f97f6d039b08f947159b528a94083e2f1 (diff)
Fix some divisions by zero
-rw-r--r--pixman/pixman-combine-float.c6
-rw-r--r--pixman/pixman-general.c2
-rw-r--r--test/utils.c7
3 files changed, 10 insertions, 5 deletions
diff --git a/pixman/pixman-combine-float.c b/pixman/pixman-combine-float.c
index bd190901..c0fe6533 100644
--- a/pixman/pixman-combine-float.c
+++ b/pixman/pixman-combine-float.c
@@ -382,9 +382,9 @@ blend_lighten (float sa, float s, float da, float d)
static force_inline float
blend_color_dodge (float sa, float s, float da, float d)
{
- if (d == 0)
+ if (d <= 0)
return 0.0f;
- else if (d * sa >= sa * da - s * da)
+ else if ((d * sa >= sa * da - s * da) || IS_ZERO (sa - s))
return sa * da;
else
return sa * sa * d / (sa - s);
@@ -395,7 +395,7 @@ blend_color_burn (float sa, float s, float da, float d)
{
if (d >= da)
return sa * da;
- else if (sa * da - d * sa >= s * da)
+ else if ((sa * (da - d) >= s * da) || IS_ZERO (s))
return 0.0f;
else
return sa * (da - sa * (da - d) / s);
diff --git a/pixman/pixman-general.c b/pixman/pixman-general.c
index 2badbd36..78a77609 100644
--- a/pixman/pixman-general.c
+++ b/pixman/pixman-general.c
@@ -244,8 +244,10 @@ _pixman_implementation_create_general (void)
imp->src_iter_init = general_src_iter_init;
imp->dest_iter_init = general_dest_iter_init;
+#if 0
imp->enter_pixman = general_enter_pixman;
imp->exit_pixman = general_exit_pixman;
+#endif
return imp;
}
diff --git a/test/utils.c b/test/utils.c
index c922ae5d..0e7eaaf1 100644
--- a/test/utils.c
+++ b/test/utils.c
@@ -735,9 +735,12 @@ enable_fp_exceptions (void)
* occuring.
*/
feenableexcept (FE_DIVBYZERO |
- FE_INVALID |
+#if 0
FE_OVERFLOW |
- FE_UNDERFLOW);
+ FE_UNDERFLOW |
+#endif
+ 0
+ );
#endif
#endif
}