From 13cacbd801e3077ad87d21c9b2607a4d7854308d Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Wed, 23 Jun 2010 07:18:19 +0200 Subject: Fix painting of overlines in labels. If the size of the widget is an odd number, the layout rect will be positioned at a 0.5 offset. The clipping set further below will snap this to 1 and thus clip away the anything drawn on the first row of pixels. Fix this by aligning the rectangle we get by layout rect. Reviewed-by: Eskil Task: http://bugreports.qt.nokia.com/browse/QTBUG-9684 --- src/gui/widgets/qlabel.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/widgets/qlabel.cpp b/src/gui/widgets/qlabel.cpp index bdbd0b0..f5393a9 100644 --- a/src/gui/widgets/qlabel.cpp +++ b/src/gui/widgets/qlabel.cpp @@ -1071,7 +1071,7 @@ void QLabel::paintEvent(QPaintEvent *) else #endif if (d->isTextLabel) { - QRectF lr = d->layoutRect(); + QRectF lr = d->layoutRect().toAlignedRect(); QStyleOption opt; opt.initFrom(this); #ifndef QT_NO_STYLE_STYLESHEET -- cgit v0.12 From fea75b0a31fe62289f9732ee2fc07ee69c131eb2 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Wed, 23 Jun 2010 16:06:57 +0200 Subject: Enablers for external use of QGLTextureGlyphCache In order to enable use of QGLTextureGlyphCache outside of Qt, it can't depend on having an initialized paint engine. We use the simple image fallback for copying the cache texture when it's updated and we need to export the functions for resolving extensions, so that the gl context can be initialized properly without calling begin on a paint engine. Reviewed-by: Kim --- src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp | 11 ++++++----- src/opengl/qglextensions_p.h | 4 ++-- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp b/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp index e2ec8a1..faf4563 100644 --- a/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp +++ b/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp @@ -55,6 +55,7 @@ extern Q_GUI_EXPORT bool qt_cleartype_enabled; QGLTextureGlyphCache::QGLTextureGlyphCache(const QGLContext *context, QFontEngineGlyphCache::Type type, const QTransform &matrix) : QImageTextureGlyphCache(type, matrix) , ctx(0) + , pex(0) , m_width(0) , m_height(0) { @@ -72,7 +73,7 @@ void QGLTextureGlyphCache::cleanUpContext() if (ctx) { QGLShareContextScope scope(ctx); - if (!ctx->d_ptr->workaround_brokenFBOReadBack) + if (!ctx->d_ptr->workaround_brokenFBOReadBack && pex != 0) glDeleteFramebuffers(1, &m_fbo); if (m_width || m_height) { @@ -97,7 +98,7 @@ void QGLTextureGlyphCache::setContext(const QGLContext *context) // workaround is to use a system-memory copy of the glyph cache for this device. // Switching to NPOT and GL_RGBA would both cost a lot more graphics memory and // be slower, so that is not desireable. - if (!ctx->d_ptr->workaround_brokenFBOReadBack) + if (!ctx->d_ptr->workaround_brokenFBOReadBack && pex != 0) glGenFramebuffers(1, &m_fbo); connect(QGLSignalProxy::instance(), SIGNAL(aboutToDestroyContext(const QGLContext*)), @@ -114,7 +115,7 @@ void QGLTextureGlyphCache::createTextureData(int width, int height) // create in QImageTextureGlyphCache baseclass is meant to be called // only to create the initial image and does not preserve the content, // so we don't call when this function is called from resize. - if (ctx->d_ptr->workaround_brokenFBOReadBack && image().isNull()) + if ((pex == 0 || ctx->d_ptr->workaround_brokenFBOReadBack) && image().isNull()) QImageTextureGlyphCache::createTextureData(width, height); // Make the lower glyph texture size 16 x 16. @@ -161,7 +162,7 @@ void QGLTextureGlyphCache::resizeTextureData(int width, int height) GLuint oldTexture = m_texture; createTextureData(width, height); - if (ctx->d_ptr->workaround_brokenFBOReadBack) { + if (pex == 0 || ctx->d_ptr->workaround_brokenFBOReadBack) { QImageTextureGlyphCache::resizeTextureData(width, height); Q_ASSERT(image().depth() == 8); glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, oldWidth, oldHeight, GL_ALPHA, GL_UNSIGNED_BYTE, image().constBits()); @@ -249,7 +250,7 @@ void QGLTextureGlyphCache::fillTexture(const Coord &c, glyph_t glyph) return; } - if (ctx->d_ptr->workaround_brokenFBOReadBack) { + if (pex == 0 || ctx->d_ptr->workaround_brokenFBOReadBack) { QImageTextureGlyphCache::fillTexture(c, glyph); glBindTexture(GL_TEXTURE_2D, m_texture); diff --git a/src/opengl/qglextensions_p.h b/src/opengl/qglextensions_p.h index 7597b33..8f80e5a 100644 --- a/src/opengl/qglextensions_p.h +++ b/src/opengl/qglextensions_p.h @@ -872,10 +872,10 @@ struct QGLExtensionFuncs #endif extern bool qt_resolve_framebufferobject_extensions(QGLContext *ctx); -bool qt_resolve_buffer_extensions(QGLContext *ctx); +bool Q_OPENGL_EXPORT qt_resolve_buffer_extensions(QGLContext *ctx); bool qt_resolve_version_1_3_functions(QGLContext *ctx); -bool qt_resolve_version_2_0_functions(QGLContext *ctx); +bool Q_OPENGL_EXPORT qt_resolve_version_2_0_functions(QGLContext *ctx); bool qt_resolve_stencil_face_extension(QGLContext *ctx); bool qt_resolve_frag_program_extensions(QGLContext *ctx); -- cgit v0.12