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.cpp32
1 files changed, 13 insertions, 19 deletions
diff --git a/src/gui/painting/qrasterizer.cpp b/src/gui/painting/qrasterizer.cpp
index ba5eda6..b602690 100644
--- a/src/gui/painting/qrasterizer.cpp
+++ b/src/gui/painting/qrasterizer.cpp
@@ -44,7 +44,6 @@
#include <QPoint>
#include <QRect>
-#include <qmath.h>
#include <private/qmath_p.h>
#include <private/qdatabuffer_p.h>
#include <private/qdrawhelper_p.h>
@@ -52,8 +51,8 @@
QT_BEGIN_NAMESPACE
typedef int Q16Dot16;
-#define Q16Dot16ToFloat(i) ((i)/qreal(65536.))
-#define FloatToQ16Dot16(i) (int)((i) * qreal(65536.))
+#define Q16Dot16ToFloat(i) ((i)/65536.)
+#define FloatToQ16Dot16(i) (int)((i) * 65536.)
#define IntToQ16Dot16(i) ((i) << 16)
#define Q16Dot16ToInt(i) ((i) >> 16)
#define Q16Dot16Factor 65536
@@ -708,12 +707,12 @@ void QRasterizer::rasterizeLine(const QPointF &a, const QPointF &b, qreal width,
if (a == b || width == 0 || d->clipRect.isEmpty())
return;
- Q_ASSERT(width > qreal(0.0));
+ Q_ASSERT(width > 0.0);
QPointF pa = a;
QPointF pb = b;
- QPointF offs = QPointF(qAbs(b.y() - a.y()), qAbs(b.x() - a.x())) * width * qreal(0.5);
+ QPointF offs = QPointF(qAbs(b.y() - a.y()), qAbs(b.x() - a.x())) * width * 0.5;
if (squareCap)
offs += QPointF(offs.y(), offs.x());
const QRectF clip(d->clipRect.topLeft() - offs, d->clipRect.bottomRight() + QPoint(1, 1) + offs);
@@ -751,12 +750,10 @@ void QRasterizer::rasterizeLine(const QPointF &a, const QPointF &b, qreal width,
}
if (!d->antialiased) {
- const qreal inv_64 = 1 / qreal(64.);
- const qreal delta = (COORD_OFFSET - COORD_ROUNDING) * inv_64;
- pa.rx() += delta;
- pa.ry() += delta;
- pb.rx() += delta;
- pb.ry() += delta;
+ pa.rx() += (COORD_OFFSET - COORD_ROUNDING)/64.;
+ pa.ry() += (COORD_OFFSET - COORD_ROUNDING)/64.;
+ pb.rx() += (COORD_OFFSET - COORD_ROUNDING)/64.;
+ pb.ry() += (COORD_OFFSET - COORD_ROUNDING)/64.;
}
{
@@ -781,7 +778,7 @@ void QRasterizer::rasterizeLine(const QPointF &a, const QPointF &b, qreal width,
return;
// adjust width which is given relative to |b - a|
- width *= qSqrt(w0 / w);
+ width *= sqrt(w0 / w);
}
QSpanBuffer buffer(d->blend, d->data, d->clipRect);
@@ -796,11 +793,10 @@ void QRasterizer::rasterizeLine(const QPointF &a, const QPointF &b, qreal width,
pa = QPointF(x, y - dy);
pb = QPointF(x, y + dy);
- const qreal inv_width = 1 / width;
if (squareCap)
- width = inv_width + 1.0f;
+ width = 1 / width + 1.0f;
else
- width = inv_width;
+ width = 1 / width;
squareCap = false;
}
@@ -1196,10 +1192,8 @@ void QRasterizer::rasterize(const QPainterPath &path, Qt::FillRule fillRule)
QRectF bounds = path.controlPointRect();
- const qreal inv_64 = 1 / qreal(64.);
- const qreal delta = (COORD_OFFSET - COORD_ROUNDING) * inv_64 ;
- int iTopBound = qMax(d->clipRect.top(), int(bounds.top() + qreal(0.5) + delta));
- int iBottomBound = qMin(d->clipRect.bottom(), int(bounds.bottom() - qreal(0.5) + delta));
+ int iTopBound = qMax(d->clipRect.top(), int(bounds.top() + 0.5 + (COORD_OFFSET - COORD_ROUNDING)/64.));
+ int iBottomBound = qMin(d->clipRect.bottom(), int(bounds.bottom() - 0.5 + (COORD_OFFSET - COORD_ROUNDING)/64.));
if (iTopBound > iBottomBound)
return;