diff options
author | Allan Sandfeld Jensen <allan.jensen@theqtcompany.com> | 2015-01-14 11:17:47 +0100 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@theqtcompany.com> | 2015-02-16 16:21:15 +0000 |
commit | 515e802ae20c045e5c47b400ee6ef6e92349c978 (patch) | |
tree | f9f4be4c9e360611b5823ef28c2cb293733aee42 /src/gui/text/qdistancefield.cpp | |
parent | 3d835eb62e70435fe32318441dc7c10aba3a6fba (diff) |
Use C++ <cmath> instead of <math.h>
Including math.h can pollute the default namespace, and break
some compilers if cmath versions of the method are declared as using.
Switching to C++ math functions also greatly simplifies handling of
float qreal as C++ automatically chooses the right method.
[ChangeLog][QtCore][QtMath] qmath.h no longer includes math.h, so any
sources depending on that indirect inclusion may fail to build.
Change-Id: I4d0e331dafba354ec05dc5052e61ef4ff8d387fe
Reviewed-by: Rafael Roquetto <rafael.roquetto@kdab.com>
Diffstat (limited to 'src/gui/text/qdistancefield.cpp')
-rw-r--r-- | src/gui/text/qdistancefield.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/gui/text/qdistancefield.cpp b/src/gui/text/qdistancefield.cpp index 49ec31fc19..471a39a6e1 100644 --- a/src/gui/text/qdistancefield.cpp +++ b/src/gui/text/qdistancefield.cpp @@ -509,8 +509,8 @@ static void makeDistanceField(QDistanceFieldData *data, const QPainterPath &path bits[i] = exteriorColor; const qreal angleStep = qreal(15 * 3.141592653589793238 / 180); - const QPoint rotation(qRound(cos(angleStep) * 0x4000), - qRound(sin(angleStep) * 0x4000)); // 2:14 signed + const QPoint rotation(qRound(qCos(angleStep) * 0x4000), + qRound(qSin(angleStep) * 0x4000)); // 2:14 signed const quint32 *indices = pathIndices.data(); QVarLengthArray<QPoint> normals; @@ -544,7 +544,7 @@ static void makeDistanceField(QDistanceFieldData *data, const QPainterPath &path QPoint n(to.y() - from.y(), from.x() - to.x()); if (n.x() == 0 && n.y() == 0) continue; - int scale = qRound((offs << 16) / sqrt(qreal(n.x() * n.x() + n.y() * n.y()))); // 8:16 + int scale = qRound((offs << 16) / qSqrt(qreal(n.x() * n.x() + n.y() * n.y()))); // 8:16 n.rx() = n.x() * scale >> 8; n.ry() = n.y() * scale >> 8; normals.append(n); |