Remove assert in QImageTextureGlyphCache::fillTexture()
The assert assumes that we are calculating the transformed bounds of a glyph with exactly the same parameters as the image of the glyph is later transformed. However, when calculating the new bounding box of the glyph in alphaMapBoundingBox, we do: t.mapRect(QRectF(gx, gy, gw, gh)) And then round the width and height up. When we transform the image of the glyph, we do: t.mapRect(QRectF(0, 0, gw, gh)).toAlignedRect() Note the origin is at origo and we align the rect. This can lead to the actual transformed image sometimes being larger than what is returned from alphaMapBoundingBox(). We could change alphaMapBoundingBox() to match the behavior of the image transform, but it has a risk of missing some corner cases, especially given that the same code paths are used for scalable bitmap fonts. In the end, just removing the assert is safe, since there is a qMin() protecting against buffer overruns later, and there does not seem to be any visual difference from actually calculating the correct bounds. [ChangeLog][Freetype] Fixed possible assert when transforming bitmap fonts. Pick-to: 6.5 Fixes: QTBUG-130930 Change-Id: I0406e6f45e0d436a5248dd986703bb3a9288b9f4 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io> (cherry picked from commit fd75a66f3f65f6c8e8bfb933260676b5c18f2df1) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
3a0e4b6147
commit
214101b1b3
@ -309,8 +309,6 @@ void QImageTextureGlyphCache::fillTexture(const Coord &c,
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
Q_ASSERT(mask.width() <= c.w && mask.height() <= c.h);
|
||||
|
||||
if (m_format == QFontEngine::Format_A32
|
||||
|| m_format == QFontEngine::Format_ARGB) {
|
||||
QImage ref(m_image.bits() + (c.x * 4 + c.y * m_image.bytesPerLine()),
|
||||
|
Loading…
x
Reference in New Issue
Block a user