diff options
author | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com> | 2010-05-31 06:36:52 (GMT) |
---|---|---|
committer | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com> | 2010-05-31 06:40:38 (GMT) |
commit | 21f5bf3a3030a393ba17ce7726b70fe853b5b608 (patch) | |
tree | 7fe11ccccbd024b5fec105312fd513717b433d2a /src/opengl | |
parent | 035129c96d714ba6183057ff2b77658d993394db (diff) | |
download | Qt-21f5bf3a3030a393ba17ce7726b70fe853b5b608.zip Qt-21f5bf3a3030a393ba17ce7726b70fe853b5b608.tar.gz Qt-21f5bf3a3030a393ba17ce7726b70fe853b5b608.tar.bz2 |
Fix antialiasing with transformed text in OpenGL2 paint engine
Since the paint engine now transforms the prerendered glyphs instead of
rendering transformed glyphs as paths, we need to turn on texture
filtering to avoid antialiasing artifacts. In order to do this, we also
need to pad the glyphs in the glyph cache, otherwise you will get
artifacts when sampling the area around the glyph's bounding rect (where
there might be other glyphs.) This done by adding a glyphPadding()
function to the cache which returns the number of pixels to pad between
each glyph.
Updated: This also fixes a general issue where some combinations of font
sizes and transformations will cause the engine to sample neighbouring
glyphs, so this has been backported to Qt 4.6.x.
Task-number: QTBUG-9706, QTBUG-11028
Reviewed-by: Tom
Conflicts:
src/gui/painting/qtextureglyphcache.cpp
src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
Diffstat (limited to 'src/opengl')
-rw-r--r-- | src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp | 3 | ||||
-rw-r--r-- | src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp | 5 | ||||
-rw-r--r-- | src/opengl/gl2paintengineex/qtextureglyphcache_gl_p.h | 1 |
3 files changed, 8 insertions, 1 deletions
diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp index 828849d..237b3ab 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp @@ -1390,7 +1390,8 @@ void QGL2PaintEngineExPrivate::drawCachedGlyphs(const QPointF &p, QFontEngineGly glActiveTexture(GL_TEXTURE0 + QT_MASK_TEXTURE_UNIT); glBindTexture(GL_TEXTURE_2D, cache->texture()); - updateTextureFilter(GL_TEXTURE_2D, GL_REPEAT, false); + QOpenGL2PaintEngineState *s = q->state(); + updateTextureFilter(GL_TEXTURE_2D, GL_REPEAT, s->matrix.type() > QTransform::TxTranslate); shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::MaskTexture), QT_MASK_TEXTURE_UNIT); glDrawArrays(GL_TRIANGLES, 0, 6 * glyphs.size()); diff --git a/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp b/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp index 6cb76ee..994c1c9 100644 --- a/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp +++ b/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp @@ -246,4 +246,9 @@ int QGLTextureGlyphCache::glyphMargin() const #endif } +int QGLTextureGlyphCache::glyphPadding() const +{ + return 1; +} + QT_END_NAMESPACE diff --git a/src/opengl/gl2paintengineex/qtextureglyphcache_gl_p.h b/src/opengl/gl2paintengineex/qtextureglyphcache_gl_p.h index 2a8a782..04731b1 100644 --- a/src/opengl/gl2paintengineex/qtextureglyphcache_gl_p.h +++ b/src/opengl/gl2paintengineex/qtextureglyphcache_gl_p.h @@ -73,6 +73,7 @@ public: virtual void resizeTextureData(int width, int height); virtual void fillTexture(const Coord &c, glyph_t glyph); virtual int glyphMargin() const; + virtual int glyphPadding() const; inline GLuint texture() const { return m_texture; } |