diff options
author | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com> | 2010-06-23 14:06:57 (GMT) |
---|---|---|
committer | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com> | 2010-06-23 14:16:14 (GMT) |
commit | fea75b0a31fe62289f9732ee2fc07ee69c131eb2 (patch) | |
tree | c1e95885f44e663be9a1fbb7817eb6e5019ba7b7 /src/opengl | |
parent | 4df39d37942c9c6b998b4e73f30793ec2ba51705 (diff) | |
download | Qt-fea75b0a31fe62289f9732ee2fc07ee69c131eb2.zip Qt-fea75b0a31fe62289f9732ee2fc07ee69c131eb2.tar.gz Qt-fea75b0a31fe62289f9732ee2fc07ee69c131eb2.tar.bz2 |
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
Diffstat (limited to 'src/opengl')
-rw-r--r-- | src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp | 11 | ||||
-rw-r--r-- | 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); |