summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/gui/opengl/qopenglpaintengine.cpp7
-rw-r--r--src/gui/painting/qbezier.cpp3
-rw-r--r--src/gui/painting/qdrawhelper.cpp7
-rw-r--r--src/gui/painting/qdrawhelper_p.h2
-rw-r--r--src/gui/painting/qpaintengine_raster.cpp3
-rw-r--r--src/gui/painting/qstroker.cpp3
-rw-r--r--src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp7
7 files changed, 14 insertions, 18 deletions
diff --git a/src/gui/opengl/qopenglpaintengine.cpp b/src/gui/opengl/qopenglpaintengine.cpp
index 576558022e..e87f7bfcef 100644
--- a/src/gui/opengl/qopenglpaintengine.cpp
+++ b/src/gui/opengl/qopenglpaintengine.cpp
@@ -67,7 +67,6 @@
#include <private/qopengl_p.h>
#include <private/qopenglcontext_p.h>
#include <private/qopenglextensions_p.h>
-#include <private/qmath_p.h>
#include <private/qpaintengineex_p.h>
#include <QPaintEngine>
#include <private/qpainter_p.h>
@@ -350,7 +349,7 @@ void QOpenGL2PaintEngineExPrivate::updateBrushUniforms()
const QConicalGradient *g = static_cast<const QConicalGradient *>(currentBrush.gradient());
translationPoint = g->center();
- GLfloat angle = -(g->angle() * 2 * Q_PI) / 360.0;
+ GLfloat angle = -qDegreesToRadians(g->angle());
shaderManager->currentProgram()->setUniformValue(location(QOpenGLEngineShaderManager::Angle), angle);
@@ -2010,8 +2009,8 @@ void QOpenGL2PaintEngineExPrivate::drawPixmapFragments(const QPainter::PixmapFra
qreal s = 0;
qreal c = 1;
if (fragments[i].rotation != 0) {
- s = qFastSin(fragments[i].rotation * Q_PI / 180);
- c = qFastCos(fragments[i].rotation * Q_PI / 180);
+ s = qFastSin(qDegreesToRadians(fragments[i].rotation));
+ c = qFastCos(qDegreesToRadians(fragments[i].rotation));
}
qreal right = 0.5 * fragments[i].scaleX * fragments[i].width;
diff --git a/src/gui/painting/qbezier.cpp b/src/gui/painting/qbezier.cpp
index fac5f4de3c..e5c9e8d773 100644
--- a/src/gui/painting/qbezier.cpp
+++ b/src/gui/painting/qbezier.cpp
@@ -40,7 +40,6 @@
#include <qmath.h>
#include <private/qnumeric_p.h>
-#include <private/qmath_p.h>
QT_BEGIN_NAMESPACE
@@ -363,7 +362,7 @@ static bool addCircle(const QBezier *b, qreal offset, QBezier *o)
cos_a = 1.;
if (cos_a < -1.)
cos_a = -1;
- angles[i] = qAcos(cos_a)/Q_PI;
+ angles[i] = qAcos(cos_a) * qreal(M_1_PI);
}
if (angles[0] + angles[1] > 1.) {
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;
diff --git a/src/gui/painting/qdrawhelper_p.h b/src/gui/painting/qdrawhelper_p.h
index 0abee94016..08bc0776f7 100644
--- a/src/gui/painting/qdrawhelper_p.h
+++ b/src/gui/painting/qdrawhelper_p.h
@@ -46,6 +46,7 @@
//
#include "QtCore/qglobal.h"
+#include "QtCore/qmath.h"
#include "QtGui/qcolor.h"
#include "QtGui/qpainter.h"
#include "QtGui/qimage.h"
@@ -55,7 +56,6 @@
#endif
#include "private/qrasterdefs_p.h"
#include <private/qsimd_p.h>
-#include <private/qmath_p.h>
QT_BEGIN_NAMESPACE
diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp
index 5f4df7db62..1a1f63844c 100644
--- a/src/gui/painting/qpaintengine_raster.cpp
+++ b/src/gui/painting/qpaintengine_raster.cpp
@@ -48,7 +48,6 @@
// #include <private/qdatabuffer_p.h>
// #include <private/qpainter_p.h>
-#include <private/qmath_p.h>
#include <private/qtextengine_p.h>
#include <private/qfontengine_p.h>
#include <private/qpixmap_raster_p.h>
@@ -4466,7 +4465,7 @@ void QSpanData::setup(const QBrush &brush, int alpha, QPainter::CompositionMode
QPointF center = g->center();
conicalData.center.x = center.x();
conicalData.center.y = center.y();
- conicalData.angle = g->angle() * 2 * Q_PI / 360.0;
+ conicalData.angle = qDegreesToRadians(g->angle());
}
break;
diff --git a/src/gui/painting/qstroker.cpp b/src/gui/painting/qstroker.cpp
index 07e38bfa3b..fc344dc3ac 100644
--- a/src/gui/painting/qstroker.cpp
+++ b/src/gui/painting/qstroker.cpp
@@ -33,7 +33,6 @@
#include "private/qstroker_p.h"
#include "private/qbezier_p.h"
-#include "private/qmath_p.h"
#include "qline.h"
#include "qtransform.h"
#include <qmath.h>
@@ -793,7 +792,7 @@ qreal qt_t_for_arc_angle(qreal angle)
if (qFuzzyCompare(angle, qreal(90)))
return 1;
- qreal radians = Q_PI * angle / 180;
+ qreal radians = qDegreesToRadians(angle);
qreal cosAngle = qCos(radians);
qreal sinAngle = qSin(radians);
diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
index e461dd0fd4..e049f53fac 100644
--- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
+++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
@@ -63,7 +63,6 @@
#include <qmath.h>
#include <private/qgl_p.h>
-#include <private/qmath_p.h>
#include <private/qpaintengineex_p.h>
#include <QPaintEngine>
#include <private/qpainter_p.h>
@@ -288,7 +287,7 @@ void QGL2PaintEngineExPrivate::updateBrushUniforms()
const QConicalGradient *g = static_cast<const QConicalGradient *>(currentBrush.gradient());
translationPoint = g->center();
- GLfloat angle = -(g->angle() * 2 * Q_PI) / 360.0;
+ GLfloat angle = -qDegreesToRadians(g->angle());
shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::Angle), angle);
@@ -1945,8 +1944,8 @@ void QGL2PaintEngineExPrivate::drawPixmapFragments(const QPainter::PixmapFragmen
qreal s = 0;
qreal c = 1;
if (fragments[i].rotation != 0) {
- s = qFastSin(fragments[i].rotation * Q_PI / 180);
- c = qFastCos(fragments[i].rotation * Q_PI / 180);
+ s = qFastSin(qDegreesToRadians(fragments[i].rotation));
+ c = qFastCos(qDegreesToRadians(fragments[i].rotation));
}
qreal right = 0.5 * fragments[i].scaleX * fragments[i].width;