diff options
Diffstat (limited to 'src/gui/painting/qrasterizer.cpp')
-rw-r--r-- | src/gui/painting/qrasterizer.cpp | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/src/gui/painting/qrasterizer.cpp b/src/gui/painting/qrasterizer.cpp index 8a3e46e58b..cd9d3ba4d0 100644 --- a/src/gui/painting/qrasterizer.cpp +++ b/src/gui/painting/qrasterizer.cpp @@ -1064,28 +1064,26 @@ void QRasterizer::rasterizeLine(const QPointF &a, const QPointF &b, qreal width, while (x <= leftMax) { QScFixed excluded = 0; - if (yFP <= iLeftFP) + if (yFP <= iLeftFP && rowBottomLeft > rowTop) excluded += intersectPixelFP(x, rowTop, rowBottomLeft, bottomLeftIntersectAf, topLeftIntersectAf, topLeftSlopeFP, invTopLeftSlopeFP); - if (yFP >= iLeftFP) + if (yFP >= iLeftFP && rowBottom > rowTopLeft) excluded += intersectPixelFP(x, rowTopLeft, rowBottom, topLeftIntersectBf, bottomLeftIntersectBf, bottomLeftSlopeFP, invBottomLeftSlopeFP); - if (x >= rightMin) { - if (yFP <= iRightFP) + if (yFP <= iRightFP && rowBottomRight > rowTop) excluded += (rowBottomRight - rowTop) - intersectPixelFP(x, rowTop, rowBottomRight, topRightIntersectAf, bottomRightIntersectAf, topRightSlopeFP, invTopRightSlopeFP); - if (yFP >= iRightFP) + if (yFP >= iRightFP && rowBottom > rowTopRight) excluded += (rowBottom - rowTopRight) - intersectPixelFP(x, rowTopRight, rowBottom, bottomRightIntersectBf, topRightIntersectBf, bottomRightSlopeFP, invBottomRightSlopeFP); } - if (excluded > QScFixedFactor) - excluded = excluded % QScFixedFactor; + Q_ASSERT(excluded >= 0 && excluded <= rowHeight); QScFixed coverage = rowHeight - excluded; buffer.addSpan(x, 1, QScFixedToInt(yFP), QScFixedToInt(255 * coverage)); @@ -1098,17 +1096,16 @@ void QRasterizer::rasterizeLine(const QPointF &a, const QPointF &b, qreal width, } while (x <= rightMax) { QScFixed excluded = 0; - if (yFP <= iRightFP) + if (yFP <= iRightFP && rowBottomRight > rowTop) excluded += (rowBottomRight - rowTop) - intersectPixelFP(x, rowTop, rowBottomRight, topRightIntersectAf, bottomRightIntersectAf, topRightSlopeFP, invTopRightSlopeFP); - if (yFP >= iRightFP) + if (yFP >= iRightFP && rowBottom > rowTopRight) excluded += (rowBottom - rowTopRight) - intersectPixelFP(x, rowTopRight, rowBottom, bottomRightIntersectBf, topRightIntersectBf, bottomRightSlopeFP, invBottomRightSlopeFP); - if (excluded > QScFixedFactor) - excluded = excluded % QScFixedFactor; + Q_ASSERT(excluded >= 0 && excluded <= rowHeight); QScFixed coverage = rowHeight - excluded; buffer.addSpan(x, 1, QScFixedToInt(yFP), QScFixedToInt(255 * coverage)); |