summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDennis Oberst <[email protected]>2025-03-13 13:56:51 +0100
committerMarc Mutz <[email protected]>2025-03-18 17:25:51 +0000
commit6a64722fb391560d17f3065cfdc122ecb0b39ff1 (patch)
tree49fdbd4611125c74f83d86737f25985e41608d6b
parent3c919b6d0df486b7319faf8e4f366ab457e9f852 (diff)
Fix mixed-type usage for modf
When building Qt with a non-double qreal type, i.e. QT_COORD_TYPE=float, the C function modf rejects the float type since it is declared as: float modff(float, float*) double modf(double, double*) Fix this by porting to std::modf, which provides overloads for both FP types. Amends 91f502a7d65d76f4a376903c4058385a62dad277. Change-Id: Ic1de2f3d8e75a9594dbbd0fa92e63505dae6f1b4 Reviewed-by: Marc Mutz <[email protected]>
-rw-r--r--src/gui/painting/qpainterpath.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/gui/painting/qpainterpath.cpp b/src/gui/painting/qpainterpath.cpp
index 4e1726c3832..b13b1bcad34 100644
--- a/src/gui/painting/qpainterpath.cpp
+++ b/src/gui/painting/qpainterpath.cpp
@@ -22,6 +22,8 @@
#include <private/qstroker_p.h>
#include <private/qtextengine_p.h>
+#include <cmath>
+
#include <limits.h>
#if 0
@@ -3228,7 +3230,7 @@ QPainterPath QPainterPath::trimmed(qreal f1, qreal f2, qreal offset) const
if (offset) {
qreal dummy;
- offset = modf(offset, &dummy); // Use only the fractional part of offset, range <-1, 1>
+ offset = std::modf(offset, &dummy); // Use only the fractional part of offset, range <-1, 1>
qreal of1 = f1 + offset;
qreal of2 = f2 + offset;