diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2010-09-25 23:29:32 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2010-09-25 23:29:32 (GMT) |
commit | 23e03ee30dcd140a51073a0dd665bd871927d05e (patch) | |
tree | 33996e308999b64bcee64ddded2e609e66cace77 | |
parent | 1308b32a1a3e36c5b2788ad4f701a0203b876484 (diff) | |
parent | f0d257ae6ab3e1ec7c5dfb1ea646e5c824e437de (diff) | |
download | Qt-23e03ee30dcd140a51073a0dd665bd871927d05e.zip Qt-23e03ee30dcd140a51073a0dd665bd871927d05e.tar.gz Qt-23e03ee30dcd140a51073a0dd665bd871927d05e.tar.bz2 |
Merge branch 'master' of scm.dev.nokia.troll.no:qt/oslo-staging-2 into master-integration
* 'master' of scm.dev.nokia.troll.no:qt/oslo-staging-2:
Fix problems in QTextureGlyphCache caused by insufficient merge
-rw-r--r-- | src/gui/painting/qtextureglyphcache.cpp | 18 | ||||
-rw-r--r-- | src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp | 10 |
2 files changed, 18 insertions, 10 deletions
diff --git a/src/gui/painting/qtextureglyphcache.cpp b/src/gui/painting/qtextureglyphcache.cpp index 2bb8cce..9219876 100644 --- a/src/gui/painting/qtextureglyphcache.cpp +++ b/src/gui/painting/qtextureglyphcache.cpp @@ -202,18 +202,18 @@ void QTextureGlyphCache::populate(QFontEngine *fontEngine, int numGlyphs, const // now actually use the coords and paint the wanted glyps into cache. QHash<GlyphAndSubPixelPosition, Coord>::iterator iter = listItemCoordinates.begin(); + int requiredWidth = m_w; while (iter != listItemCoordinates.end()) { Coord c = iter.value(); m_currentRowHeight = qMax(m_currentRowHeight, c.h + margin * 2); - if (m_cx + c.w > m_w) { - int new_width = m_w*2; + if (m_cx + c.w > requiredWidth) { + int new_width = requiredWidth*2; while (new_width < m_cx + c.w) new_width *= 2; if (new_width <= maxTextureWidth()) { - resizeTextureData(new_width, m_h); - m_w = new_width; + requiredWidth = new_width; } else { // no room on the current line, start new glyph strip m_cx = 0; @@ -238,21 +238,23 @@ void QTextureGlyphCache::fillInPendingGlyphs() if (m_pendingGlyphs.isEmpty()) return; - int requiredHeight = 0; + int requiredHeight = m_h; + int requiredWidth = m_w; // Use a minimum size to avoid a lot of initial reallocations { QHash<GlyphAndSubPixelPosition, Coord>::iterator iter = m_pendingGlyphs.begin(); while (iter != m_pendingGlyphs.end()) { Coord c = iter.value(); requiredHeight = qMax(requiredHeight, c.y + c.h); + requiredWidth = qMax(requiredWidth, c.x + c.w); ++iter; } } - if (requiredHeight > m_h) { + if (isNull() || requiredHeight > m_h || requiredWidth > m_w) { if (isNull()) - createCache(m_w, qt_next_power_of_two(requiredHeight)); + createCache(qt_next_power_of_two(requiredWidth), qt_next_power_of_two(requiredHeight)); else - resizeCache(m_w, qt_next_power_of_two(requiredHeight)); + resizeCache(qt_next_power_of_two(requiredWidth), qt_next_power_of_two(requiredHeight)); } { diff --git a/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp b/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp index 952427c..f8e34d4 100644 --- a/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp +++ b/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp @@ -293,11 +293,17 @@ int QGLTextureGlyphCache::glyphPadding() const int QGLTextureGlyphCache::maxTextureWidth() const { - return ctx->d_ptr->maxTextureSize(); + if (ctx == 0) + return QImageTextureGlyphCache::maxTextureWidth(); + else + return ctx->d_ptr->maxTextureSize(); } int QGLTextureGlyphCache::maxTextureHeight() const { - return ctx->d_ptr->maxTextureSize(); + if (ctx == 0) + return QImageTextureGlyphCache::maxTextureHeight(); + else + return ctx->d_ptr->maxTextureSize(); } QT_END_NAMESPACE |