summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>2010-02-05 11:57:52 (GMT)
committerEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>2010-02-05 11:57:52 (GMT)
commit6d14ccae6d532a8560da05cdc85d7646ea2744e6 (patch)
tree22843cac62e389198f7c707da4d0e8956499ea57
parent0c444f72281fded5e226ec786614595a86bff4e3 (diff)
downloadQt-6d14ccae6d532a8560da05cdc85d7646ea2744e6.zip
Qt-6d14ccae6d532a8560da05cdc85d7646ea2744e6.tar.gz
Qt-6d14ccae6d532a8560da05cdc85d7646ea2744e6.tar.bz2
Recreate cached vertex arrays for QStaticText when drawn to new context
If you draw the QStaticText object to a new QGLWidget, then we need to recreate the VBOs (if the vertex arrays are cached.) It would be possible to share this across contexts, which can be implemented later as an extra optimization for switching between different target devices.
-rw-r--r--src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
index aec2ade..ed0f708 100644
--- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
+++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
@@ -1345,9 +1345,17 @@ void QGL2PaintEngineExPrivate::drawCachedGlyphs(QFontEngineGlyphCache::Type glyp
QVector<GLuint> indices;
#endif
- if (staticTextItem->userData == 0
- || staticTextItem->userData->type != QStaticTextUserData::OpenGLUserData
- || staticTextItem->userDataNeedsUpdate) {
+ bool recreateVertexArrays = false;
+ if (staticTextItem->userDataNeedsUpdate)
+ recreateVertexArrays = true;
+ else if (staticTextItem->userData == 0)
+ recreateVertexArrays = true;
+ else if (staticTextItem->userData->type != QStaticTextUserData::OpenGLUserData)
+ recreateVertexArrays = true;
+ else if (static_cast<QOpenGLStaticTextUserData *>(staticTextItem->userData)->ctx != ctx)
+ recreateVertexArrays = true;
+
+ if (recreateVertexArrays) {
vertexCoordinateArray.clear();
textureCoordinateArray.clear();