arraytype arrayname[arraysize]; \
::memset(arrayname, 0, arraysize * sizeof(arraytype));
+static const qreal q_deg2rad = qreal(0.01745329251994329576923690768489); /* pi/180 */
+static const qreal q_rad2deg = qreal(57.295779513082320876798154814105); /* 180/pi */
+
static inline uint foldCase(const ushort *ch, const ushort *start)
{
uint c = *ch;
#include "qdatastream.h"
#include "qmath.h"
#include "qnumeric.h"
+#include "qcorecommon_p.h"
QT_BEGIN_NAMESPACE
#endif // QT_NO_DATASTREAM
-inline static qreal q_deg2rad(qreal x)
-{
- return x * qreal(0.01745329251994329576923690768489); /* pi/180 */
-}
-
-inline static qreal q_rad2deg(qreal x)
-{
- return x * qreal(57.295779513082320876798154814105); /* 180/pi */
-}
-
/*!
\class QLineF
\ingroup painting
const qreal dx = pt2.x() - pt1.x();
const qreal dy = pt2.y() - pt1.y();
- const qreal theta = q_rad2deg(qAtan2(-dy, dx));
+ const qreal theta = (qAtan2(-dy, dx) * q_rad2deg);
const qreal theta_normalized = theta < 0 ? theta + 360 : theta;
*/
void QLineF::setAngle(qreal angle)
{
- const qreal angleR = q_deg2rad(angle);
+ const qreal angleR = (angle * q_deg2rad);
const qreal l = length();
const qreal dx = qCos(angleR) * l;
*/
QLineF QLineF::fromPolar(qreal length, qreal angle)
{
- const qreal angleR = q_deg2rad(angle);
+ const qreal angleR = (angle * q_deg2rad);
return QLineF(0, 0, qCos(angleR) * length, -qSin(angleR) * length);
}
qreal cos_line = (dx()*l.dx() + dy()*l.dy()) / (length()*l.length());
// only accept cos_line in the range [-1,1], if it is outside, use 0 (we return 0 rather than PI for those cases)
if (cos_line >= qreal(-1.0) && cos_line <= qreal(1.0))
- return q_rad2deg(qAcos(cos_line));
+ return (qAcos(cos_line) * q_rad2deg);
return 0;
}
#include "qpainterpath.h"
#include "qvariant.h"
#include "qmath.h"
-#include "qguicommon_p.h"
+#include "qcorecommon_p.h"
#include <limits.h>
else if (a == 180.)
cosa = -1.;
else{
- qreal b = deg2rad*a; // convert to radians
+ qreal b = q_deg2rad*a; // convert to radians
sina = qSin(b); // fast and convenient
cosa = qCos(b);
}
#include "qnumeric.h"
#include "qbezier_p.h"
#include "qguicommon_p.h"
+#include "qcorecommon_p.h"
QT_BEGIN_NAMESPACE
else if (a == 180.)
cosa = -1.;
else{
- qreal b = deg2rad*a; // convert to radians
+ qreal b = q_deg2rad*a; // convert to radians
sina = qSin(b); // fast and convenient
cosa = qCos(b);
}
return i==32 ? -1 : i;
}
-static const qreal deg2rad = qreal(0.017453292519943295769); // pi/180
static const qreal inv_dist_to_plane = 1. / 1024.;
#ifndef QT_NO_IMAGEFORMAT_XPM
} else if (state == SkewX) {
if (points.count() != 1)
goto error;
- const qreal deg2rad = qreal(0.017453292519943295769);
- matrix.shear(qTan(points[0]*deg2rad), 0);
+ matrix.shear(qTan(points[0]*q_deg2rad), 0);
} else if (state == SkewY) {
if (points.count() != 1)
goto error;
- const qreal deg2rad = qreal(0.017453292519943295769);
- matrix.shear(0, qTan(points[0]*deg2rad));
+ matrix.shear(0, qTan(points[0]*q_deg2rad));
}
}
error:
#include "qsvggraphics_p.h"
#include "qsvgnode_p.h"
#include "qsvgtinydocument_p.h"
-
#include "qpainter.h"
#include "qpair.h"
#include "qcolor.h"
#include "qdebug.h"
#include "qmath.h"
#include "qnumeric.h"
+#include "qcorecommon_p.h"
QT_BEGIN_NAMESPACE
void QSvgAnimateTransform::resolveMatrix(const QSvgNode *node)
{
- static const qreal deg2rad = qreal(0.017453292519943295769);
qreal totalTimeElapsed = node->document()->currentElapsed();
if (totalTimeElapsed < m_from || m_finished)
return;
qreal transXDiff = (to1-from1) * percentOfAnimation;
qreal transX = from1 + transXDiff;
m_transform = QTransform();
- m_transform.shear(qTan(transX * deg2rad), 0);
+ m_transform.shear(qTan(transX * q_deg2rad), 0);
break;
}
case SkewY: {
qreal transYDiff = (to1 - from1) * percentOfAnimation;
qreal transY = from1 + transYDiff;
m_transform = QTransform();
- m_transform.shear(0, qTan(transY * deg2rad));
+ m_transform.shear(0, qTan(transY * q_deg2rad));
break;
}
default: