diff options
author | Tom Cooksey <thomas.cooksey@nokia.com> | 2009-11-06 11:58:58 (GMT) |
---|---|---|
committer | Tom Cooksey <thomas.cooksey@nokia.com> | 2009-11-06 12:03:21 (GMT) |
commit | cb2e03d3ea16edf341191e03a7138440d3a7ba22 (patch) | |
tree | 77a07f0ee228b2d7c8044c7ee00f8b497ed25890 | |
parent | e9296e1ffa476e18e12dd526e2e80e9850db0e71 (diff) | |
download | Qt-cb2e03d3ea16edf341191e03a7138440d3a7ba22.zip Qt-cb2e03d3ea16edf341191e03a7138440d3a7ba22.tar.gz Qt-cb2e03d3ea16edf341191e03a7138440d3a7ba22.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.cpp | 14 | ||||
-rw-r--r-- | src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h | 1 |
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]; |