diff options
author | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com> | 2011-01-10 13:11:30 (GMT) |
---|---|---|
committer | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com> | 2011-01-10 13:11:30 (GMT) |
commit | 3263f8036128cc4403cf6383324f5390eecee13b (patch) | |
tree | 227ea1dfe86b9297cf7808b5b304a039c438e1fe /src/opengl/gl2paintengineex | |
parent | 4d53a691aaac9789ddd4f9d4e968d28ace2181ca (diff) | |
parent | 0faab4442040fdfe3790e3c02808fd45993f0265 (diff) | |
download | Qt-3263f8036128cc4403cf6383324f5390eecee13b.zip Qt-3263f8036128cc4403cf6383324f5390eecee13b.tar.gz Qt-3263f8036128cc4403cf6383324f5390eecee13b.tar.bz2 |
Merge branch 'qt-graphics-team-text-master'
Diffstat (limited to 'src/opengl/gl2paintengineex')
-rw-r--r-- | src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp index cf63626..0cb6f85 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp @@ -1592,7 +1592,6 @@ void QGL2PaintEngineExPrivate::drawCachedGlyphs(QFontEngineGlyphCache::Type glyp } } - if (recreateVertexArrays) { vertexCoordinates->clear(); textureCoordinates->clear(); @@ -1605,7 +1604,10 @@ void QGL2PaintEngineExPrivate::drawCachedGlyphs(QFontEngineGlyphCache::Type glyp QTextureGlyphCache::GlyphAndSubPixelPosition glyph(staticTextItem->glyphs[i], subPixelPosition); - const QTextureGlyphCache::Coord &c = cache->coords.value(glyph); + const QTextureGlyphCache::Coord &c = cache->coords[glyph]; + if (c.isNull()) + continue; + int x = staticTextItem->glyphPositions[i].x.toInt() + c.baseLineX - margin; int y = staticTextItem->glyphPositions[i].y.toInt() - c.baseLineY - margin; @@ -1616,10 +1618,12 @@ void QGL2PaintEngineExPrivate::drawCachedGlyphs(QFontEngineGlyphCache::Type glyp staticTextItem->userDataNeedsUpdate = false; } - if (elementIndices.size() < staticTextItem->numGlyphs*6) { + int numGlyphs = vertexCoordinates->vertexCount() / 4; + + if (elementIndices.size() < numGlyphs*6) { Q_ASSERT(elementIndices.size() % 6 == 0); int j = elementIndices.size() / 6 * 4; - while (j < staticTextItem->numGlyphs*4) { + while (j < numGlyphs*4) { elementIndices.append(j + 0); elementIndices.append(j + 0); elementIndices.append(j + 1); @@ -1708,9 +1712,9 @@ void QGL2PaintEngineExPrivate::drawCachedGlyphs(QFontEngineGlyphCache::Type glyp updateTextureFilter(GL_TEXTURE_2D, GL_REPEAT, false); #if defined(QT_OPENGL_DRAWCACHEDGLYPHS_INDEX_ARRAY_VBO) - glDrawElements(GL_TRIANGLE_STRIP, 6 * staticTextItem->numGlyphs, GL_UNSIGNED_SHORT, 0); + glDrawElements(GL_TRIANGLE_STRIP, 6 * numGlyphs, GL_UNSIGNED_SHORT, 0); #else - glDrawElements(GL_TRIANGLE_STRIP, 6 * staticTextItem->numGlyphs, GL_UNSIGNED_SHORT, elementIndices.data()); + glDrawElements(GL_TRIANGLE_STRIP, 6 * numGlyphs, GL_UNSIGNED_SHORT, elementIndices.data()); #endif shaderManager->setMaskType(QGLEngineShaderManager::SubPixelMaskPass2); @@ -1758,10 +1762,10 @@ void QGL2PaintEngineExPrivate::drawCachedGlyphs(QFontEngineGlyphCache::Type glyp } #if defined(QT_OPENGL_DRAWCACHEDGLYPHS_INDEX_ARRAY_VBO) - glDrawElements(GL_TRIANGLE_STRIP, 6 * staticTextItem->numGlyphs, GL_UNSIGNED_SHORT, 0); + glDrawElements(GL_TRIANGLE_STRIP, 6 * numGlyphs, GL_UNSIGNED_SHORT, 0); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); #else - glDrawElements(GL_TRIANGLE_STRIP, 6 * staticTextItem->numGlyphs, GL_UNSIGNED_SHORT, elementIndices.data()); + glDrawElements(GL_TRIANGLE_STRIP, 6 * numGlyphs, GL_UNSIGNED_SHORT, elementIndices.data()); #endif } |