[gegl] gegl: include math.h in headers used by ops
- From: Øyvind "pippin" Kolås <ok src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gegl] gegl: include math.h in headers used by ops
- Date: Thu, 28 May 2020 19:17:07 +0000 (UTC)
commit a3c57eb512ceacc1934085ed751a4dd4801eefba
Author: Øyvind Kolås <pippin gimp org>
Date: Thu May 28 21:15:17 2020 +0200
gegl: include math.h in headers used by ops
It needs to be included before gegl-math.h on some platforms, since many
operations do use such functions for -lm including it is boilerplate
reduction.
gegl/gegl-plugin.h | 1 +
operations/common/color-overlay.c | 2 +-
operations/common/exp-combine.c | 2 +-
operations/common/little-planet.c | 4 ++--
operations/common/long-shadow.c | 2 +-
operations/common/mono-mixer.c | 8 ++++----
6 files changed, 10 insertions(+), 9 deletions(-)
---
diff --git a/gegl/gegl-plugin.h b/gegl/gegl-plugin.h
index bffb310f0..b33c2b127 100644
--- a/gegl/gegl-plugin.h
+++ b/gegl/gegl-plugin.h
@@ -24,6 +24,7 @@
#include "config.h"
#endif
+#include <math.h>
#include <string.h>
#include <glib-object.h>
#include <gmodule.h>
diff --git a/operations/common/color-overlay.c b/operations/common/color-overlay.c
index cd9489a1c..98ea64cb1 100644
--- a/operations/common/color-overlay.c
+++ b/operations/common/color-overlay.c
@@ -77,7 +77,7 @@ process (GeglOperation *operation,
alpha_c = 1.0f - color[3];
- if (fabs (alpha_c) <= EPSILON)
+ if (fabsf (alpha_c) <= EPSILON)
{
while (samples--)
{
diff --git a/operations/common/exp-combine.c b/operations/common/exp-combine.c
index 8f81124ab..3aecf2b54 100644
--- a/operations/common/exp-combine.c
+++ b/operations/common/exp-combine.c
@@ -1095,7 +1095,7 @@ gegl_expcombine_process (GeglOperation *operation,
*/
if (e->pixels[PIXELS_FULL][i] <= 0.0f)
{
- under += fabs (e->pixels[PIXELS_FULL][i]);
+ under += fabsf (e->pixels[PIXELS_FULL][i]);
e->pixels[PIXELS_FULL][i] = 0.0f;
}
else if (e->pixels[PIXELS_FULL][i] > 1.0f)
diff --git a/operations/common/little-planet.c b/operations/common/little-planet.c
index bb6efe478..5389a5ff7 100644
--- a/operations/common/little-planet.c
+++ b/operations/common/little-planet.c
@@ -211,8 +211,8 @@ static void prepare_transform (Transform *transform,
xoffset = ((orig_width - height)/height) / 2 + 0.5f;
}
- transform->do_spin = fabs (spin) > 0.000001 ? 1 : 0;
- transform->do_zoom = fabs (zoom-1.0) > 0.000001 ? 1 : 0;
+ transform->do_spin = fabsf (spin) > 0.000001 ? 1 : 0;
+ transform->do_zoom = fabsf (zoom-1.0f) > 0.000001 ? 1 : 0;
transform->pan = pan;
transform->tilt = tilt;
diff --git a/operations/common/long-shadow.c b/operations/common/long-shadow.c
index 51a3b1e94..997fbeefc 100644
--- a/operations/common/long-shadow.c
+++ b/operations/common/long-shadow.c
@@ -376,7 +376,7 @@ init_geometry (Context *ctx)
{
ctx->shadow_proj = cos (ctx->options.angle) * ctx->options.length;
- ctx->shadow_height = ceil (ctx->shadow_proj);
+ ctx->shadow_height = ceilf (ctx->shadow_proj);
ctx->shadow_remainder = 1.0 - (ctx->shadow_height - ctx->shadow_proj);
}
}
diff --git a/operations/common/mono-mixer.c b/operations/common/mono-mixer.c
index f78b45527..de31e7a33 100644
--- a/operations/common/mono-mixer.c
+++ b/operations/common/mono-mixer.c
@@ -66,7 +66,7 @@ process (GeglOperation *op,
gfloat green = o->green;
gfloat blue = o->blue;
gboolean normalize = o->preserve_luminosity;
- gfloat norm_factor = 1.0;
+ gfloat norm_factor = 1.0f;
gfloat * GEGL_ALIGNED in_pixel;
gfloat * GEGL_ALIGNED out_pixel;
glong i;
@@ -78,10 +78,10 @@ process (GeglOperation *op,
{
gdouble sum = red + green + blue;
- if (sum == 0.0)
- norm_factor = 1.0;
+ if (sum == 0.0f)
+ norm_factor = 1.0f;
else
- norm_factor = fabs (1 / sum);
+ norm_factor = fabsf (1.0 / sum);
}
for (i=0; i<n_pixels; i++)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]