From f200e303829106db6e3ff32e0c492d2677531c33 Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Wed, 22 Feb 2017 20:01:32 +0100 Subject: Use qRadiansToDegrees() instead of hand-coding an equivalent The homegrown approximation to pi's value caught my attention. Task-number: QTBUG-58083 Change-Id: I2bf0432f4c71c20131ef48cdd8341cdb9bc098bc Reviewed-by: Frederik Gladhorn --- examples/script/context2d/context2d.cpp | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/examples/script/context2d/context2d.cpp b/examples/script/context2d/context2d.cpp index 70ef104..ddb40b7 100644 --- a/examples/script/context2d/context2d.cpp +++ b/examples/script/context2d/context2d.cpp @@ -41,11 +41,7 @@ #include "context2d.h" #include - -#include -static const double Q_PI = 3.14159265358979323846; // pi - -#define DEGREES(t) ((t) * 180.0 / Q_PI) +#include #define qClamp(val, min, max) qMin(qMax(val, min), max) static QList parseNumbersList(QString::const_iterator &itr) @@ -224,7 +220,7 @@ void Context2D::scale(qreal x, qreal y) void Context2D::rotate(qreal angle) { - m_state.matrix.rotate(DEGREES(angle)); + m_state.matrix.rotate(qRadiansToDegrees(angle)); m_state.flags |= DirtyTransformationMatrix; } @@ -573,8 +569,8 @@ void Context2D::arc(qreal xc, qreal yc, qreal radius, anticlockwise = !anticlockwise; //end hack - float sa = DEGREES(sar); - float ea = DEGREES(ear); + float sa = qRadiansToDegrees(sar); + float ea = qRadiansToDegrees(ear); double span = 0; -- cgit v1.2.1