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 <marc.mutz@qt.io>
This commit is contained in:
parent
3c919b6d0d
commit
6a64722fb3
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user