QFusionStyle: optimize cache-key generation for qt_fusion_draw_button():

Instead of passing a QLatin1StringView to QStyleHelper::uniqueName(),
which takes a QString, allocating, and then using QStringBuilder to
append something to the result of uniqueHelper(), allocating again,
pull the appends to before the call to uniqueName(), folding these two
allocations into one.

Pick-to: 6.6 6.5
Task-number: QTBUG-112200
Change-Id: I501dd4a3df4b9f5267ca931b550d521f4dafe493
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
This commit is contained in:
Marc Mutz 2023-06-05 11:01:28 +02:00
parent 6ab0d25a09
commit 362b5b8428

View File

@ -224,9 +224,10 @@ static void qt_fusion_draw_arrow(Qt::ArrowType type, QPainter *painter, const QS
const int size = qMin(arrowMax, rectMax);
QPixmap cachePixmap;
QString cacheKey = QStyleHelper::uniqueName("fusion-arrow"_L1, option, rect.size())
% HexString<uint>(type)
% HexString<uint>(color.rgba());
const QString cacheKey = QStyleHelper::uniqueName("fusion-arrow"_L1
% HexString<uint>(type)
% HexString<uint>(color.rgba()),
option, rect.size());
if (!QPixmapCache::find(cacheKey, &cachePixmap)) {
cachePixmap = styleCachePixmap(rect.size());
cachePixmap.fill(Qt::transparent);