summaryrefslogtreecommitdiffstats
path: root/src/gui/painting/qrasterizer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/painting/qrasterizer.cpp')
-rw-r--r--src/gui/painting/qrasterizer.cpp22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/gui/painting/qrasterizer.cpp b/src/gui/painting/qrasterizer.cpp
index 2b73f9b..0b33369 100644
--- a/src/gui/painting/qrasterizer.cpp
+++ b/src/gui/painting/qrasterizer.cpp
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -20,10 +21,9 @@
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Nokia gives you certain
-** additional rights. These rights are described in the Nokia Qt LGPL
-** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
@@ -692,14 +692,14 @@ static inline bool q16Dot16Compare(qreal p1, qreal p2)
return FloatToQ16Dot16(p2 - p1) == 0;
}
-static inline qreal qRoundF(qreal v)
+static inline qreal qFloorF(qreal v)
{
#ifdef QT_USE_MATH_H_FLOATS
if (sizeof(qreal) == sizeof(float))
- return floorf(v + 0.5);
+ return floorf(v);
else
#endif
- return floor(v + 0.5);
+ return floor(v);
}
void QRasterizer::rasterizeLine(const QPointF &a, const QPointF &b, qreal width, bool squareCap)
@@ -759,10 +759,10 @@ void QRasterizer::rasterizeLine(const QPointF &a, const QPointF &b, qreal width,
const qreal reciprocal = 1 / gridResolution;
// snap to grid to prevent large slopes
- pa.rx() = qRoundF(pa.rx() * gridResolution) * reciprocal;
- pa.ry() = qRoundF(pa.ry() * gridResolution) * reciprocal;
- pb.rx() = qRoundF(pb.rx() * gridResolution) * reciprocal;
- pb.ry() = qRoundF(pb.ry() * gridResolution) * reciprocal;
+ pa.rx() = qFloorF(pa.rx() * gridResolution) * reciprocal;
+ pa.ry() = qFloorF(pa.ry() * gridResolution) * reciprocal;
+ pb.rx() = qFloorF(pb.rx() * gridResolution) * reciprocal;
+ pb.ry() = qFloorF(pb.ry() * gridResolution) * reciprocal;
// old delta
const QPointF d0 = a - b;