diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2020-11-10 12:34:22 +0100 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2020-11-12 08:31:18 +0100 |
commit | 94dd2cebdcb9446626cd32a00086431eb11ab2a4 (patch) | |
tree | 00e549cc499e2b07dc7ec20139a4f9521822b386 /src/gui/painting/qrasterizer.cpp | |
parent | 85fe4c89835d862db30b43c775d8863fcf896f20 (diff) |
Remove Qt4Compatible painting
Change-Id: Ie54206ca9b509875568f2158e229fca9cb1860a2
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/gui/painting/qrasterizer.cpp')
-rw-r--r-- | src/gui/painting/qrasterizer.cpp | 51 |
1 files changed, 11 insertions, 40 deletions
diff --git a/src/gui/painting/qrasterizer.cpp b/src/gui/painting/qrasterizer.cpp index 3902b072c9..921d260320 100644 --- a/src/gui/painting/qrasterizer.cpp +++ b/src/gui/painting/qrasterizer.cpp @@ -137,7 +137,7 @@ public: ~QScanConverter(); void begin(int top, int bottom, int left, int right, - Qt::FillRule fillRule, bool legacyRounding, QSpanBuffer *spanBuffer); + Qt::FillRule fillRule, QSpanBuffer *spanBuffer); void end(); void mergeCurve(const QT_FT_Vector &a, const QT_FT_Vector &b, @@ -185,7 +185,6 @@ private: QScFixed m_rightFP; int m_fillRuleMask; - bool m_legacyRounding; int m_x; int m_y; @@ -205,7 +204,6 @@ class QRasterizerPrivate { public: bool antialiased; - bool legacyRounding; ProcessSpans blend; void *data; QRect clipRect; @@ -229,7 +227,7 @@ QScanConverter::~QScanConverter() } void QScanConverter::begin(int top, int bottom, int left, int right, - Qt::FillRule fillRule, bool legacyRounding, + Qt::FillRule fillRule, QSpanBuffer *spanBuffer) { m_top = top; @@ -240,7 +238,6 @@ void QScanConverter::begin(int top, int bottom, int left, int right, m_lines.reset(); m_fillRuleMask = fillRule == Qt::WindingFill ? ~0x0 : 0x1; - m_legacyRounding = legacyRounding; m_spanBuffer = spanBuffer; } @@ -596,20 +593,11 @@ void QScanConverter::mergeLine(QT_FT_Vector a, QT_FT_Vector b) winding = -1; } - if (m_legacyRounding) { - a.x += COORD_OFFSET; - a.y += COORD_OFFSET; - b.x += COORD_OFFSET; - b.y += COORD_OFFSET; - } - - int rounding = m_legacyRounding ? COORD_ROUNDING : 0; - - int iTop = qMax(m_top, int((a.y + 32 - rounding) >> 6)); - int iBottom = qMin(m_bottom, int((b.y - 32 - rounding) >> 6)); + int iTop = qMax(m_top, int((a.y + 32) >> 6)); + int iBottom = qMin(m_bottom, int((b.y - 32) >> 6)); if (iTop <= iBottom) { - QScFixed aFP = QScFixedFactor/2 + FTPosToQScFixed(a.x - rounding); + QScFixed aFP = QScFixedFactor/2 + FTPosToQScFixed(a.x); if (b.x == a.x) { Line line = { qBound(m_leftFP, aFP, m_rightFP), 0, iTop, iBottom, winding }; @@ -640,7 +628,6 @@ void QScanConverter::mergeLine(QT_FT_Vector a, QT_FT_Vector b) QRasterizer::QRasterizer() : d(new QRasterizerPrivate) { - d->legacyRounding = false; } QRasterizer::~QRasterizer() @@ -664,11 +651,6 @@ void QRasterizer::setClipRect(const QRect &clipRect) d->clipRect = clipRect; } -void QRasterizer::setLegacyRoundingEnabled(bool legacyRoundingEnabled) -{ - d->legacyRounding = legacyRoundingEnabled; -} - static QScFixed intersectPixelFP(int x, QScFixed top, QScFixed bottom, QScFixed leftIntersectX, QScFixed rightIntersectX, QScFixed slope, QScFixed invSlope) { QScFixed leftX = IntToQScFixed(x); @@ -803,13 +785,6 @@ void QRasterizer::rasterizeLine(const QPointF &a, const QPointF &b, qreal width, pb = npb; } - if (!d->antialiased && d->legacyRounding) { - 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.; - } - { // old delta const QPointF d0 = a - b; @@ -1207,15 +1182,13 @@ void QRasterizer::rasterize(const QT_FT_Outline *outline, Qt::FillRule fillRule) max_y = qMax(p.y, max_y); } - int rounding = d->legacyRounding ? COORD_OFFSET - COORD_ROUNDING : 0; - - int iTopBound = qMax(d->clipRect.top(), int((min_y + 32 + rounding) >> 6)); - int iBottomBound = qMin(d->clipRect.bottom(), int((max_y - 32 + rounding) >> 6)); + int iTopBound = qMax(d->clipRect.top(), int((min_y + 32) >> 6)); + int iBottomBound = qMin(d->clipRect.bottom(), int((max_y - 32) >> 6)); if (iTopBound > iBottomBound) return; - d->scanConverter.begin(iTopBound, iBottomBound, d->clipRect.left(), d->clipRect.right(), fillRule, d->legacyRounding, &buffer); + d->scanConverter.begin(iTopBound, iBottomBound, d->clipRect.left(), d->clipRect.right(), fillRule, &buffer); int first = 0; for (int i = 0; i < outline->n_contours; ++i) { @@ -1245,15 +1218,13 @@ void QRasterizer::rasterize(const QPainterPath &path, Qt::FillRule fillRule) QRectF bounds = path.controlPointRect(); - double rounding = d->legacyRounding ? (COORD_OFFSET - COORD_ROUNDING) / 64. : 0.0; - - int iTopBound = qMax(d->clipRect.top(), int(bounds.top() + 0.5 + rounding)); - int iBottomBound = qMin(d->clipRect.bottom(), int(bounds.bottom() - 0.5 + rounding)); + int iTopBound = qMax(d->clipRect.top(), int(bounds.top() + 0.5)); + int iBottomBound = qMin(d->clipRect.bottom(), int(bounds.bottom() - 0.5)); if (iTopBound > iBottomBound) return; - d->scanConverter.begin(iTopBound, iBottomBound, d->clipRect.left(), d->clipRect.right(), fillRule, d->legacyRounding, &buffer); + d->scanConverter.begin(iTopBound, iBottomBound, d->clipRect.left(), d->clipRect.right(), fillRule, &buffer); int subpathStart = 0; QT_FT_Vector last = { 0, 0 }; |