summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorKim Motoyoshi Kalland <kim.kalland@nokia.com>2009-10-05 12:55:50 (GMT)
committerJason McDonald <jason.mcdonald@nokia.com>2009-10-06 02:58:04 (GMT)
commit7e89d6d5b98fddd62572f87d61f7137c9fca21f6 (patch)
tree4f2c166982c648b93aeb67dd5917a1ca65a9632e /examples
parentb8b407a1f19d0521db93e7e5a7fbd03db7f6825c (diff)
downloadQt-7e89d6d5b98fddd62572f87d61f7137c9fca21f6.zip
Qt-7e89d6d5b98fddd62572f87d61f7137c9fca21f6.tar.gz
Qt-7e89d6d5b98fddd62572f87d61f7137c9fca21f6.tar.bz2
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 (cherry picked from commit 30f413b74f883f7e3984dfe39d825aa6c5f16132)
Diffstat (limited to 'examples')
-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 e8222af..4f07a2d 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));