aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/scenegraph/qsgdefaultdistancefieldglyphcache.cpp
diff options
context:
space:
mode:
authorYoann Lopes <yoann.lopes@digia.com>2013-07-23 16:19:57 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-07-26 13:56:01 +0200
commitd5b4e460bde0c152da5b872ac8ed6f675bf227a9 (patch)
tree1718d80c2b231fb5829417082eb31bc71c5f4625 /src/quick/scenegraph/qsgdefaultdistancefieldglyphcache.cpp
parentc9ec0c206544b37139057932a6dceed88565a75f (diff)
Workaround for distance field glyph upload problem.
It seems uploading an image (into a texture) which has padding at the end of each scanLine and alpha-only pixel format is broken with some OpenGL ES drivers. The workaround is to upload one line at a time. Task-number: QTBUG-30908 Change-Id: Ic680654951b6aec294c1a173708c1fb75e57ff8f Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
Diffstat (limited to 'src/quick/scenegraph/qsgdefaultdistancefieldglyphcache.cpp')
-rw-r--r--src/quick/scenegraph/qsgdefaultdistancefieldglyphcache.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/quick/scenegraph/qsgdefaultdistancefieldglyphcache.cpp b/src/quick/scenegraph/qsgdefaultdistancefieldglyphcache.cpp
index afea96b35c..4652a2241e 100644
--- a/src/quick/scenegraph/qsgdefaultdistancefieldglyphcache.cpp
+++ b/src/quick/scenegraph/qsgdefaultdistancefieldglyphcache.cpp
@@ -172,7 +172,8 @@ void QSGDefaultDistanceFieldGlyphCache::storeGlyphs(const QHash<glyph_t, QImage>
}
}
- glTexSubImage2D(GL_TEXTURE_2D, 0, c.x, c.y, glyph.width(), glyph.height(), GL_ALPHA, GL_UNSIGNED_BYTE, glyph.constBits());
+ for (int i = 0; i < glyph.height(); ++i)
+ glTexSubImage2D(GL_TEXTURE_2D, 0, c.x, c.y + i, glyph.width(), 1, GL_ALPHA, GL_UNSIGNED_BYTE, glyph.scanLine(i));
}
QHash<TextureInfo *, QVector<glyph_t> >::const_iterator i;
@@ -242,7 +243,8 @@ void QSGDefaultDistanceFieldGlyphCache::resizeTexture(TextureInfo *texInfo, int
updateTexture(oldTexture, texInfo->texture, texInfo->size);
if (useWorkaround()) {
- glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, oldWidth, oldHeight, GL_ALPHA, GL_UNSIGNED_BYTE, texInfo->image.constBits());
+ for (int i = 0; i < oldHeight; ++i)
+ glTexSubImage2D(GL_TEXTURE_2D, 0, 0, i, oldWidth, 1, GL_ALPHA, GL_UNSIGNED_BYTE, texInfo->image.scanLine(i));
texInfo->image = texInfo->image.copy(0, 0, width, height);
glDeleteTextures(1, &oldTexture);
return;