diff options
authorEskil Abrahamsen Blomfeldt <>2019-10-15 09:30:30 +0200
committerEskil Abrahamsen Blomfeldt <>2019-10-15 10:08:08 +0200
commit6336fa98ca7340fe65ab252cc576c3d10c9ddb76 (patch)
parent0cf8283ab85dc4149a51816a97949560dfdaa67b (diff)
Fix loading pregenerated distance field cachev2.5.0-rc
We can't assume the stride of the internal QImage data matches the width, since this is likely to be aligned to four bytes. Therefore we copy one scan line at the time instead. [ChangeLog][Text] Pregenerating distance field caches would sometimes lead to corrupted rendering. Fixes: QT3DS-3908 Change-Id: I3c30c6c707d6f220d852d6c067301ab4d468884c Reviewed-by: Jere Tuliniemi <> Reviewed-by: Tomi Korpipää <>
1 files changed, 2 insertions, 1 deletions
diff --git a/src/runtimerender/Qt3DSDistanceFieldGlyphCache.cpp b/src/runtimerender/Qt3DSDistanceFieldGlyphCache.cpp
index b919ca5..d19c9f6 100644
--- a/src/runtimerender/Qt3DSDistanceFieldGlyphCache.cpp
+++ b/src/runtimerender/Qt3DSDistanceFieldGlyphCache.cpp
@@ -494,7 +494,8 @@ bool Q3DSDistanceFieldGlyphCache::loadPregeneratedCache(const QRawFont &font)
resizeTexture(texInfo, width, height);
- memcpy(texInfo->copy.bits(), textureData, size);
+ for (int y = 0; y < height; ++y)
+ memcpy(texInfo->copy.scanLine(y), textureData + y * width, width);
textureData += size;
QImage &image = texInfo->copy;