From 59e356ac1340c930bd8a2f2ffc79ac36cd3d837d Mon Sep 17 00:00:00 2001 From: Povilas Kanapickas Date: Sun, 13 Oct 2019 06:18:49 +0300 Subject: [PATCH] genesys: Don't use variants of M_PI that aren't guaranteed to be present --- backend/genesys/conv.cpp | 2 +- backend/genesys/low.cpp | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/backend/genesys/conv.cpp b/backend/genesys/conv.cpp index 7594787cb..a87c46324 100644 --- a/backend/genesys/conv.cpp +++ b/backend/genesys/conv.cpp @@ -203,7 +203,7 @@ void genesys_deskew(Genesys_Scanner *s, const Genesys_Sensor& sensor) sensor.optical_res, sensor.optical_res, &x, &y, &slope)); - DBG(DBG_info, "%s: slope=%f => %f\n",__func__,slope, (slope/M_PI_2)*90); + DBG(DBG_info, "%s: slope=%f => %f\n", __func__, slope, slope * 180 / M_PI); // rotate image slope is in [-PI/2,PI/2]. Positive values rotate trigonometric direction wise TIE(sanei_magic_rotate(&s->params, dev->img_buffer.data(), diff --git a/backend/genesys/low.cpp b/backend/genesys/low.cpp index d757141ab..18e5b7048 100644 --- a/backend/genesys/low.cpp +++ b/backend/genesys/low.cpp @@ -2421,7 +2421,8 @@ void sanei_genesys_load_lut(unsigned char* lut, * then take the tangent (T.O.A) * then multiply by the normal linear slope * because the table may not be square, i.e. 1024x256*/ - rise = std::tan(static_cast(slope) / 128 * M_PI_4 + M_PI_4) * max_out_val / max_in_val; + auto pi_4 = M_PI / 4.0; + rise = std::tan(static_cast(slope) / 128 * pi_4 + pi_4) * max_out_val / max_in_val; /* line must stay vertically centered, so figure * out vertical offset at central input value */