summaryrefslogtreecommitdiffstats
path: root/examples/painting
diff options
context:
space:
mode:
authorKim Motoyoshi Kalland <kim.kalland@nokia.com>2009-10-05 14:55:50 +0200
committerKim Motoyoshi Kalland <kim.kalland@nokia.com>2009-10-05 15:30:13 +0200
commit30f413b74f883f7e3984dfe39d825aa6c5f16132 (patch)
treef278b6f628068b43d7b8c1cc38254d873eda626b /examples/painting
parent6ce698050bbe9a4ec5198f1e08b94d51b8a6c9bd (diff)
Fixed noisy looking textures in Basic Drawing example with GL2 engine.
When running the Basic Drawing example with the GL2 paint engine and antialiasing enabled, textures looked noisy. When antialiasing was enabled, the example translated the painter half a pixel to get sharp lines. This caused the textures to be sampled at texel corners. Without linear interpolation, sampling textures at texel corners is unpredictable. The fix is to not translate the painter. Reviewed-by: Gunnar
Diffstat (limited to 'examples/painting')
-rw-r--r--examples/painting/basicdrawing/renderarea.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/examples/painting/basicdrawing/renderarea.cpp b/examples/painting/basicdrawing/renderarea.cpp
index e8222af6d9..4f07a2d1be 100644
--- a/examples/painting/basicdrawing/renderarea.cpp
+++ b/examples/painting/basicdrawing/renderarea.cpp
@@ -136,11 +136,9 @@ void RenderArea::paintEvent(QPaintEvent * /* event */)
QPainter painter(this);
painter.setPen(pen);
painter.setBrush(brush);
- if (antialiased) {
+ if (antialiased)
painter.setRenderHint(QPainter::Antialiasing, true);
//! [9]
- painter.translate(+0.5, +0.5);
- }
//! [10]
for (int x = 0; x < width(); x += 100) {
@@ -202,6 +200,7 @@ void RenderArea::paintEvent(QPaintEvent * /* event */)
}
}
+ painter.setRenderHint(QPainter::Antialiasing, false);
painter.setPen(palette().dark().color());
painter.setBrush(Qt::NoBrush);
painter.drawRect(QRect(0, 0, width() - 1, height() - 1));