summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>2019-10-15 09:30:30 +0200
committerEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>2019-10-15 10:08:08 +0200
commit6336fa98ca7340fe65ab252cc576c3d10c9ddb76 (patch)
tree62d8ce603bb53ebc792771d236a252587d8062a4
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 <jere.tuliniemi@qt.io> Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
-rw-r--r--src/runtimerender/Qt3DSDistanceFieldGlyphCache.cpp3
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;