summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAleksandar Sasha Babic <aleksandar.babic@nokia.com>2009-12-11 14:03:19 (GMT)
committerAleksandar Sasha Babic <aleksandar.babic@nokia.com>2009-12-11 14:10:17 (GMT)
commit8f28b68bcd1e18529ebece8c94133443b925ebab (patch)
tree986c65bface1540f6c9f8eaffcd1381ca9b1a946
parentbf8e5ae8b05d8e6efeaa36c1c556a4b2f52ffed1 (diff)
downloadQt-8f28b68bcd1e18529ebece8c94133443b925ebab.zip
Qt-8f28b68bcd1e18529ebece8c94133443b925ebab.tar.gz
Qt-8f28b68bcd1e18529ebece8c94133443b925ebab.tar.bz2
qreal-ization
In some places we do have direct math related calls. Almost all are calling the double precision functions even if the args and results are float. This leads to unnecessary float->double and double->float transitions. By using wrapper functions we can control which functrion variants are effectively called. Task-number: QTBUG-4894 Reviewed-by: Shane Kearns
-rw-r--r--src/corelib/tools/qline.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/corelib/tools/qline.cpp b/src/corelib/tools/qline.cpp
index d0afb7a..8112757 100644
--- a/src/corelib/tools/qline.cpp
+++ b/src/corelib/tools/qline.cpp
@@ -574,7 +574,7 @@ qreal QLineF::angle() const
const qreal dx = pt2.x() - pt1.x();
const qreal dy = pt2.y() - pt1.y();
- const qreal theta = atan2(-dy, dx) * 360.0 / M_2PI;
+ const qreal theta = qAtan2(-dy, dx) * 360.0 / M_2PI;
const qreal theta_normalized = theta < 0 ? theta + 360 : theta;
@@ -814,7 +814,7 @@ qreal QLineF::angle(const QLineF &l) const
qreal cos_line = (dx()*l.dx() + dy()*l.dy()) / (length()*l.length());
qreal rad = 0;
// 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 >= -1.0 && cos_line <= 1.0) rad = acos( cos_line );
+ if (cos_line >= -1.0 && cos_line <= 1.0) rad = qAcos( cos_line );
return rad * 360 / M_2PI;
}