diff --git a/src/plugins/platforms/direct2d/qwindowsdirect2dpaintengine.cpp b/src/plugins/platforms/direct2d/qwindowsdirect2dpaintengine.cpp index a1c405067c..4c39560cbe 100644 --- a/src/plugins/platforms/direct2d/qwindowsdirect2dpaintengine.cpp +++ b/src/plugins/platforms/direct2d/qwindowsdirect2dpaintengine.cpp @@ -1160,6 +1160,25 @@ void QWindowsDirect2DPaintEngine::drawRects(const QRectF *rects, int rectCount) } } +static bool isLinePositivelySloped(const QPointF &p1, const QPointF &p2) +{ + if (p2.x() > p1.x()) + return p2.y() < p1.y(); + + if (p1.x() > p2.x()) + return p1.y() < p2.y(); + + return false; +} + +static void adjustLine(QPointF *p1, QPointF *p2) +{ + if (isLinePositivelySloped(*p1, *p2)) { + p1->ry() -= qreal(1.0); + p2->ry() -= qreal(1.0); + } +} + void QWindowsDirect2DPaintEngine::drawLines(const QLine *lines, int lineCount) { Q_D(QWindowsDirect2DPaintEngine); @@ -1181,6 +1200,10 @@ void QWindowsDirect2DPaintEngine::drawLines(const QLine *lines, int lineCount) continue; } + // Match raster engine output + if (!antiAliasingEnabled()) + adjustLine(&p1, &p2); + adjustForAliasing(&p1); adjustForAliasing(&p2); @@ -1213,6 +1236,10 @@ void QWindowsDirect2DPaintEngine::drawLines(const QLineF *lines, int lineCount) continue; } + // Match raster engine output + if (!antiAliasingEnabled()) + adjustLine(&p1, &p2); + adjustForAliasing(&p1); adjustForAliasing(&p2);