aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/scenegraph/qsgshareddistancefieldglyphcache.cpp
diff options
context:
space:
mode:
authorYoann Lopes <yoann.lopes@digia.com>2013-08-21 14:40:01 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-08-27 20:35:55 +0200
commit184e27c0e69f9f8c342339e83cdf79ec5a97b58e (patch)
tree0529dcf5a0b5b86b98c40d257f69ecb7dcb9b3ee /src/quick/scenegraph/qsgshareddistancefieldglyphcache.cpp
parentcb9672c86d2679bcb0d9e10f76b12eb03f4c515e (diff)
Updated distance field glyph caches to use QDistanceField.
Some OpenGL drivers assume alpha-only images are always tightly packed, regardless of what is set for GL_UNPACK_ALIGNMENT. We now use QDistanceField to store glyphs, which aligns scanlines on a 1-byte boundary, instead of QImage which uses a 4-byte boundary. A previous workaround uploaded scanlines one at a time, but this is also broken with some other drivers... Task-number: QTBUG-30908 Task-number: QTBUG-32861 Change-Id: I46527fb48de1e00116f776427c45baa752c6176d Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
Diffstat (limited to 'src/quick/scenegraph/qsgshareddistancefieldglyphcache.cpp')
-rw-r--r--src/quick/scenegraph/qsgshareddistancefieldglyphcache.cpp16
1 files changed, 7 insertions, 9 deletions
diff --git a/src/quick/scenegraph/qsgshareddistancefieldglyphcache.cpp b/src/quick/scenegraph/qsgshareddistancefieldglyphcache.cpp
index 97bb4295f7..c15263f53f 100644
--- a/src/quick/scenegraph/qsgshareddistancefieldglyphcache.cpp
+++ b/src/quick/scenegraph/qsgshareddistancefieldglyphcache.cpp
@@ -300,7 +300,7 @@ void QSGSharedDistanceFieldGlyphCache::waitForGlyphs()
}
}
-void QSGSharedDistanceFieldGlyphCache::storeGlyphs(const QHash<glyph_t, QImage> &glyphs)
+void QSGSharedDistanceFieldGlyphCache::storeGlyphs(const QList<QDistanceField> &glyphs)
{
{
QMutexLocker locker(&m_pendingGlyphsMutex);
@@ -312,14 +312,12 @@ void QSGSharedDistanceFieldGlyphCache::storeGlyphs(const QHash<glyph_t, QImage>
int glyphCount = glyphs.size();
QVector<quint32> glyphIds(glyphCount);
QVector<QImage> images(glyphCount);
- QHash<glyph_t, QImage>::const_iterator it = glyphs.constBegin();
- int i=0;
- while (it != glyphs.constEnd()) {
- m_requestedGlyphsThatHaveNotBeenReturned.insert(it.key());
- glyphIds[i] = it.key();
- images[i] = it.value();
-
- ++it; ++i;
+ for (int i = 0; i < glyphs.size(); ++i) {
+ const QDistanceField &df = glyphs.at(i);
+ m_requestedGlyphsThatHaveNotBeenReturned.insert(df.glyph());
+ glyphIds[i] = df.glyph();
+ // ### TODO: Handle QDistanceField in QPlatformSharedGraphicsCache
+ images[i] = df.toImage(QImage::Format_Indexed8);
}
m_hasPostedEvents = true;