summaryrefslogtreecommitdiffstats
path: root/src/gui/painting/qdrawhelper.cpp
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@theqtcompany.com>2015-02-26 13:53:00 +0100
committerAllan Sandfeld Jensen <allan.jensen@theqtcompany.com>2015-02-26 20:31:20 +0000
commit3f858a07726666222372f793f1e1a5de3c8ec373 (patch)
tree99b8f41136575040587a6ebd3ff54211320cb214 /src/gui/painting/qdrawhelper.cpp
parent4ed795df247c5859089e3a6b6ca7c24e8c973a31 (diff)
Remove some uses of the private Q_PI constant
The patch removes several uses of the private Q_PI constant and removes the qmath_p.h from the includes. A few places are optimized to multiply with reciprocals instead of dividing by Q_PI. Change-Id: I097af6a929e0609d6935563064e81c856005f4bc Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Diffstat (limited to 'src/gui/painting/qdrawhelper.cpp')
-rw-r--r--src/gui/painting/qdrawhelper.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp
index 84063eb692..20fd41e0ae 100644
--- a/src/gui/painting/qdrawhelper.cpp
+++ b/src/gui/painting/qdrawhelper.cpp
@@ -50,7 +50,6 @@
#if defined(QT_COMPILER_SUPPORTS_MIPS_DSP) || defined(QT_COMPILER_SUPPORTS_MIPS_DSPR2)
#include <private/qdrawhelper_mips_dsp_p.h>
#endif
-#include <private/qmath_p.h>
#include <private/qguiapplication_p.h>
#include <qmath.h>
@@ -2689,6 +2688,8 @@ static const uint * QT_FASTCALL qt_fetch_conical_gradient(uint *buffer, const Op
+ data->dy + data->m12 * (x + qreal(0.5));
bool affine = !data->m13 && !data->m23;
+ const qreal inv2pi = M_1_PI / 2.0;
+
const uint *end = buffer + length;
if (affine) {
rx -= data->gradient.conical.center.x;
@@ -2696,7 +2697,7 @@ static const uint * QT_FASTCALL qt_fetch_conical_gradient(uint *buffer, const Op
while (buffer < end) {
qreal angle = qAtan2(ry, rx) + data->gradient.conical.angle;
- *buffer = qt_gradient_pixel(&data->gradient, 1 - angle / (2*Q_PI));
+ *buffer = qt_gradient_pixel(&data->gradient, 1 - angle * inv2pi);
rx += data->m11;
ry += data->m12;
@@ -2712,7 +2713,7 @@ static const uint * QT_FASTCALL qt_fetch_conical_gradient(uint *buffer, const Op
rx/rw - data->gradient.conical.center.y)
+ data->gradient.conical.angle;
- *buffer = qt_gradient_pixel(&data->gradient, 1. - angle / (2*Q_PI));
+ *buffer = qt_gradient_pixel(&data->gradient, 1 - angle * inv2pi);
rx += data->m11;
ry += data->m12;