From 036c13a0f48ea964da36c6ac01b379d9aa52fdc1 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Fri, 7 May 2021 16:45:41 +0200 Subject: Avoid coverage overflow We end up excluding more than 65536 from 65536 of rowHeight. Perhaps better fixed earlier, but I can't figure this logic out right now. Pick-to: 6.1 5.15 Change-Id: I5721c469441f15ac112180f971c857cd67edbf96 Reviewed-by: Eirik Aavitsland --- src/gui/painting/qrasterizer.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/gui/painting/qrasterizer.cpp') diff --git a/src/gui/painting/qrasterizer.cpp b/src/gui/painting/qrasterizer.cpp index e851a3876a..7b26b20db8 100644 --- a/src/gui/painting/qrasterizer.cpp +++ b/src/gui/painting/qrasterizer.cpp @@ -1096,6 +1096,8 @@ void QRasterizer::rasterizeLine(const QPointF &a, const QPointF &b, qreal width, bottomRightIntersectBf, topRightIntersectBf, bottomRightSlopeFP, invBottomRightSlopeFP); } + if (excluded > QScFixedFactor) + excluded = excluded % QScFixedFactor; QScFixed coverage = rowHeight - excluded; buffer.addSpan(x, 1, QScFixedToInt(yFP), @@ -1117,6 +1119,8 @@ void QRasterizer::rasterizeLine(const QPointF &a, const QPointF &b, qreal width, excluded += (rowBottom - rowTopRight) - intersectPixelFP(x, rowTopRight, rowBottom, bottomRightIntersectBf, topRightIntersectBf, bottomRightSlopeFP, invBottomRightSlopeFP); + if (excluded > QScFixedFactor) + excluded = excluded % QScFixedFactor; QScFixed coverage = rowHeight - excluded; buffer.addSpan(x, 1, QScFixedToInt(yFP), -- cgit v1.2.3