diff options
-rw-r--r-- | src/gui/painting/qpaintengine_raster.cpp | 2 | ||||
-rw-r--r-- | src/gui/painting/qrasterizer.cpp | 2 | ||||
-rw-r--r-- | tests/auto/qpainter/tst_qpainter.cpp | 19 |
3 files changed, 21 insertions, 2 deletions
diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp index 743c4b8..84af880 100644 --- a/src/gui/painting/qpaintengine_raster.cpp +++ b/src/gui/painting/qpaintengine_raster.cpp @@ -3956,7 +3956,7 @@ void QRasterPaintEnginePrivate::initializeRasterizer(QSpanData *data) const QClipData *c = clip(); if (c) { const QRect r(QPoint(c->xmin, c->ymin), - QPoint(c->xmax, c->ymax)); + QSize(c->xmax - c->xmin, c->ymax - c->ymin)); clipRect = clipRect.intersected(r); blend = data->blend; } else { diff --git a/src/gui/painting/qrasterizer.cpp b/src/gui/painting/qrasterizer.cpp index 629b38e..58e4b4e 100644 --- a/src/gui/painting/qrasterizer.cpp +++ b/src/gui/painting/qrasterizer.cpp @@ -703,7 +703,7 @@ static inline qreal qRoundF(qreal v) void QRasterizer::rasterizeLine(const QPointF &a, const QPointF &b, qreal width, bool squareCap) { - if (a == b || width == 0) + if (a == b || width == 0 || d->clipRect.isEmpty()) return; QPointF pa = a; diff --git a/tests/auto/qpainter/tst_qpainter.cpp b/tests/auto/qpainter/tst_qpainter.cpp index dcf9a04..cb532ce 100644 --- a/tests/auto/qpainter/tst_qpainter.cpp +++ b/tests/auto/qpainter/tst_qpainter.cpp @@ -227,6 +227,7 @@ private slots: void extendedBlendModes(); void zeroOpacity(); + void emptyClip(); private: void fillData(); @@ -4194,5 +4195,23 @@ void tst_QPainter::zeroOpacity() QCOMPARE(target.pixel(0, 0), 0xff000000); } +void tst_QPainter::emptyClip() +{ + QImage img(64, 64, QImage::Format_ARGB32_Premultiplied); + QPainter p(&img); + p.setRenderHints(QPainter::Antialiasing); + p.setClipRect(0, 32, 64, 0); + p.fillRect(0, 0, 64, 64, Qt::white); + + QPainterPath path; + path.lineTo(64, 0); + path.lineTo(64, 64); + path.lineTo(40, 64); + path.lineTo(40, 80); + path.lineTo(0, 80); + + p.fillPath(path, Qt::green); +} + QTEST_MAIN(tst_QPainter) #include "tst_qpainter.moc" |