summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorSamuel Rødal <samuel.rodal@digia.com>2012-10-10 12:38:07 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2012-10-19 02:43:05 +0200
commit7b8e10ddd02693b3d6b7a7e74d2103787f6e76ac (patch)
tree4147954620057575e543eb0b6f09385b265cefb3 /tests/auto
parentae3ad0ad211e6b9d745193fc049ad6ee07d731f0 (diff)
Fixed inconsistent QPainter fill rules for aliased painting.
Qt 5 is the time to get rid of all the old inconsistencies in the raster paint engine caused by trying to preserve the old X11 based coordinate system where (0, 0) is in the center of the top-left pixel instead of the upper left corner of said pixel. However, this was only adhered for line drawing and path / rect filling, and not for image or pixmap drawing and not at all when doing antialiased painting. By defining the antialiased coordinate system as being the right one and letting the aliased fill rules follow from that we finally end up with some consistent behavior that doesn't lead to surprises and workarounds in application code. It is still possible for applications to get the old behavior by setting the QPainter::Qt4CompatiblePainting render hint. This should make porting easier for the few cases where an application relies on the aliased fill rules we used to have in Qt 4. Task-number: QTBUG-27500 Change-Id: If86b95e77d838ec83033d64af86632b9a73c74a9 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/gui/painting/qpainter/tst_qpainter.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/tests/auto/gui/painting/qpainter/tst_qpainter.cpp b/tests/auto/gui/painting/qpainter/tst_qpainter.cpp
index 13716940b1..24be319173 100644
--- a/tests/auto/gui/painting/qpainter/tst_qpainter.cpp
+++ b/tests/auto/gui/painting/qpainter/tst_qpainter.cpp
@@ -830,6 +830,7 @@ void tst_QPainter::drawLine()
{ // unclipped
pixmapUnclipped.fill(Qt::white);
QPainter p(&pixmapUnclipped);
+ p.setRenderHint(QPainter::Qt4CompatiblePainting);
p.translate(offset, offset);
p.setPen(QPen(Qt::black));
p.drawLine(line);
@@ -856,6 +857,7 @@ void tst_QPainter::drawLine()
pixmapClipped.fill(Qt::white);
QPainter p(&pixmapClipped);
+ p.setRenderHint(QPainter::Qt4CompatiblePainting);
p.translate(offset, offset);
p.setClipRect(clip);
p.setPen(QPen(Qt::black));
@@ -892,6 +894,7 @@ void tst_QPainter::drawLine_task121143()
image.fill(0xffffffff);
QPainter p(&image);
p.setPen(pen);
+ p.setRenderHint(QPainter::Qt4CompatiblePainting);
p.drawLine(QLine(0, 0+4, 0+4, 0));
p.end();
@@ -1028,6 +1031,7 @@ void tst_QPainter::drawRect2()
QTransform transform(0.368567, 0, 0, 0, 0.368567, 0, 0.0289, 0.0289, 1);
QPainter p(&image);
+ p.setRenderHint(QPainter::Qt4CompatiblePainting);
p.setTransform(transform);
p.setBrush(Qt::red);
p.setPen(Qt::NoPen);
@@ -1038,6 +1042,7 @@ void tst_QPainter::drawRect2()
image.fill(0xffffffff);
p.begin(&image);
+ p.setRenderHint(QPainter::Qt4CompatiblePainting);
p.setTransform(transform);
p.drawRect(QRect(14, 14, 39, 39));
p.end();
@@ -1184,6 +1189,7 @@ void tst_QPainter::drawPath()
image.fill(QColor(Qt::white).rgb());
QPainter p(&image);
+ p.setRenderHint(QPainter::Qt4CompatiblePainting);
p.setPen(Qt::NoPen);
p.setBrush(Qt::black);
p.translate(offset - expectedBounds.left(), offset - expectedBounds.top());
@@ -1246,11 +1252,7 @@ void tst_QPainter::drawPath2()
void tst_QPainter::drawPath3()
{
-#if !defined(Q_OS_WINCE)
- QImage imgA(400, 400, QImage::Format_RGB32);
-#else
QImage imgA(100, 100, QImage::Format_RGB32);
-#endif
imgA.fill(0xffffff);
QImage imgB = imgA;
@@ -1413,6 +1415,7 @@ void tst_QPainter::drawRoundRect()
{
pixmap.fill(Qt::white);
QPainter p(&pixmap);
+ p.setRenderHint(QPainter::Qt4CompatiblePainting);
p.setPen(usePen ? QPen(Qt::black) : QPen(Qt::NoPen));
p.setBrush(Qt::black);
p.drawRoundRect(rect);
@@ -4185,6 +4188,7 @@ void tst_QPainter::drawText_subPixelPositionsInRaster_qtbug5053()
baseLine.fill(Qt::white);
{
QPainter p(&baseLine);
+ p.setRenderHint(QPainter::Qt4CompatiblePainting);
p.drawText(0, fm.ascent(), QString::fromLatin1("e"));
}
@@ -4195,6 +4199,7 @@ void tst_QPainter::drawText_subPixelPositionsInRaster_qtbug5053()
{
QPainter p(&comparison);
+ p.setRenderHint(QPainter::Qt4CompatiblePainting);
p.drawText(QPointF(i / 12.0, fm.ascent()), QString::fromLatin1("e"));
}