summaryrefslogtreecommitdiffstats
path: root/src/gui/painting/qpaintengine_raster.cpp
diff options
context:
space:
mode:
authormread <qt-info@nokia.com>2011-10-10 11:58:12 (GMT)
committermread <qt-info@nokia.com>2011-10-10 12:23:08 (GMT)
commitae620eb773a5fd217de4766fc829e51417cb9e70 (patch)
tree8f1468cdc0f7fbb82a934b7370cc6a1b9aae5df2 /src/gui/painting/qpaintengine_raster.cpp
parent22d475e1ef32875c4933b2bb4c2830cb1bdd3266 (diff)
downloadQt-ae620eb773a5fd217de4766fc829e51417cb9e70.zip
Qt-ae620eb773a5fd217de4766fc829e51417cb9e70.tar.gz
Qt-ae620eb773a5fd217de4766fc829e51417cb9e70.tar.bz2
Converting from double to qreal in gui
There were a number of places in QtGui where doubles were used in expressions due to the use of floating point constants in the code. Many of these constants are now constructed as qreal, removing the use of double operations where unneeded. These changes have been limited to constants that have exactly the same value whether double or float, to ensure that precision errors are not introduced. This should not affect any of the desktop platforms where qreal is double. On Symbian, where qreal is float, appropriate autotests have been run. Task-number: QTBUG-4894 Reviewed-by: Sami Merila
Diffstat (limited to 'src/gui/painting/qpaintengine_raster.cpp')
-rw-r--r--src/gui/painting/qpaintengine_raster.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp
index bcc5f9d..0fea2da 100644
--- a/src/gui/painting/qpaintengine_raster.cpp
+++ b/src/gui/painting/qpaintengine_raster.cpp
@@ -1649,8 +1649,8 @@ void QRasterPaintEngine::stroke(const QVectorPath &path, const QPen &pen)
if (lines[i].p1() == lines[i].p2()) {
if (s->lastPen.capStyle() != Qt::FlatCap) {
QPointF p = lines[i].p1();
- QLineF line = s->matrix.map(QLineF(QPointF(p.x() - width*0.5, p.y()),
- QPointF(p.x() + width*0.5, p.y())));
+ QLineF line = s->matrix.map(QLineF(QPointF(p.x() - width*qreal(0.5), p.y()),
+ QPointF(p.x() + width*qreal(0.5), p.y())));
d->rasterizer->rasterizeLine(line.p1(), line.p2(), 1);
}
continue;
@@ -5117,7 +5117,7 @@ static void drawEllipse_midpoint_i(const QRect &rect, const QRect &clip,
{
const qreal a = qreal(rect.width()) / 2;
const qreal b = qreal(rect.height()) / 2;
- qreal d = b*b - (a*a*b) + 0.25*a*a;
+ qreal d = b*b - (a*a*b) + qreal(0.25)*a*a;
int x = 0;
int y = (rect.height() + 1) / 2;
@@ -5140,7 +5140,7 @@ static void drawEllipse_midpoint_i(const QRect &rect, const QRect &clip,
pen_func, brush_func, pen_data, brush_data);
// region 2
- d = b*b*(x + 0.5)*(x + 0.5) + a*a*((y - 1)*(y - 1) - b*b);
+ d = b*b*(x + qreal(0.5))*(x + qreal(0.5)) + a*a*((y - 1)*(y - 1) - b*b);
const int miny = rect.height() & 0x1;
while (y > miny) {
if (d < 0) { // select SE