summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTom Cooksey <thomas.cooksey@nokia.com>2009-11-06 11:58:58 (GMT)
committerBradley T. Hughes <bradley.hughes@nokia.com>2009-11-06 13:07:40 (GMT)
commit8df2c631632694328c84c667a4022b1bcaac3b32 (patch)
tree1d08a923cc94e814b967552fba96104918f899c8
parentbffa9cbb0e123f3dd1ffd0f084d068fa673cbed7 (diff)
downloadQt-8df2c631632694328c84c667a4022b1bcaac3b32.zip
Qt-8df2c631632694328c84c667a4022b1bcaac3b32.tar.gz
Qt-8df2c631632694328c84c667a4022b1bcaac3b32.tar.bz2
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 1527e72..8228c7e 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 4cf2a83..9720723 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];