summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTom Cooksey <thomas.cooksey@nokia.com>2009-11-06 12:58:58 +0100
committerTom Cooksey <thomas.cooksey@nokia.com>2009-11-06 13:03:21 +0100
commitcb2e03d3ea16edf341191e03a7138440d3a7ba22 (patch)
tree77a07f0ee228b2d7c8044c7ee00f8b497ed25890
parente9296e1ffa476e18e12dd526e2e80e9850db0e71 (diff)
Fix fuzzy aliased rendering on GLES2
The GL2 paint engine adds a (0.49,0.49) pixel offset when doing aliased rendering. But this assumed if it was doing aliased rendering then multisampling was disabled. On GLES, multisampling is always enabled if the surface has it enabled. So on GLES, we never add the offset if the surface is multisampled. Reviewed-By: Gunnar
-rw-r--r--src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp14
-rw-r--r--src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h1
2 files changed, 13 insertions, 2 deletions
diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
index 1527e7289e..8228c7edab 100644
--- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
+++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
@@ -1203,7 +1203,9 @@ void QGL2PaintEngineEx::fill(const QVectorPath &path, const QBrush &brush)
ensureActive();
QOpenGL2PaintEngineState *s = state();
- bool doOffset = !(s->renderHints & QPainter::Antialiasing) && style == Qt::SolidPattern;
+ bool doOffset = !(s->renderHints & QPainter::Antialiasing) &&
+ (style == Qt::SolidPattern) &&
+ !d->multisamplingAlwaysEnabled;
if (doOffset) {
d->temporaryTransform = s->matrix;
@@ -1242,7 +1244,7 @@ void QGL2PaintEngineEx::stroke(const QVectorPath &path, const QPen &pen)
ensureActive();
- bool doOffset = !(s->renderHints & QPainter::Antialiasing);
+ bool doOffset = !(s->renderHints & QPainter::Antialiasing) && !d->multisamplingAlwaysEnabled;
if (doOffset) {
d->temporaryTransform = s->matrix;
QTransform tx = QTransform::fromTranslate(0.49, .49);
@@ -1780,6 +1782,14 @@ bool QGL2PaintEngineEx::begin(QPaintDevice *pdev)
}
#endif
+#if defined(QT_OPENGL_ES_2)
+ // OpenGL ES can't switch MSAA off, so if the gl paint device is
+ // multisampled, it's always multisampled.
+ d->multisamplingAlwaysEnabled = d->device->format().sampleBuffers();
+#else
+ d->multisamplingAlwaysEnabled = false;
+#endif
+
return true;
}
diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h b/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h
index 4cf2a834c4..97207234d9 100644
--- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h
+++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h
@@ -277,6 +277,7 @@ public:
bool needsSync;
bool inRenderText;
+ bool multisamplingAlwaysEnabled;
GLfloat depthRange[2];