Improve performance when draw with SVG fonts.

This commit is contained in:
Roman Telezhynskyi 2023-07-25 09:18:50 +03:00
parent bc1f47921f
commit ba9d9ff501

View File

@ -366,13 +366,13 @@ auto VSvgFontDatabase::QueryFont(const QString &family, SVGFontStyle style, SVGF
auto VSvgFontDatabase::QueryFontEngine(const QString &family, SVGFontStyle style, SVGFontWeight weight, auto VSvgFontDatabase::QueryFontEngine(const QString &family, SVGFontStyle style, SVGFontWeight weight,
int pointSize) const -> VSvgFontEngine int pointSize) const -> VSvgFontEngine
{ {
QByteArray hash = VSvgFont::Hash(family, style, weight); VSvgFont font = QueryFont(family, style, weight);
QByteArray hash = font.Hash();
if (m_fontEngineCache.contains(hash)) if (m_fontEngineCache.contains(hash))
{ {
return {*m_fontEngineCache.object(hash)}; return {*m_fontEngineCache.object(hash)};
} }
VSvgFont font = QueryFont(family, style, weight);
if (font.IsValid()) if (font.IsValid())
{ {
VSvgFontReader reader; VSvgFontReader reader;