QFusionStyle: de-pessimize arrow painting
Instead of holding three QPointF's in a QPolygonF, which will allocate them on the heap, use QVarLengthArray<>, which will allocate them on the stack instead. Pick-to: 6.6 6.5 Task-numbber: QTBUG-112200 Change-Id: If078e5a9a5cb82fd03b511e28cceb88bd42996f8 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
This commit is contained in:
parent
362b5b8428
commit
d6ce0bad67
@ -241,8 +241,7 @@ static void qt_fusion_draw_arrow(Qt::ArrowType type, QPainter *painter, const QS
|
|||||||
arrowRect.moveTo((rect.width() - arrowRect.width()) / 2.0,
|
arrowRect.moveTo((rect.width() - arrowRect.width()) / 2.0,
|
||||||
(rect.height() - arrowRect.height()) / 2.0);
|
(rect.height() - arrowRect.height()) / 2.0);
|
||||||
|
|
||||||
QPolygonF triangle;
|
QVarLengthArray<QPointF, 3> triangle;
|
||||||
triangle.reserve(3);
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case Qt::DownArrow:
|
case Qt::DownArrow:
|
||||||
triangle << arrowRect.topLeft() << arrowRect.topRight() << QPointF(arrowRect.center().x(), arrowRect.bottom());
|
triangle << arrowRect.topLeft() << arrowRect.topRight() << QPointF(arrowRect.center().x(), arrowRect.bottom());
|
||||||
@ -261,7 +260,7 @@ static void qt_fusion_draw_arrow(Qt::ArrowType type, QPainter *painter, const QS
|
|||||||
cachePainter.setPen(Qt::NoPen);
|
cachePainter.setPen(Qt::NoPen);
|
||||||
cachePainter.setBrush(color);
|
cachePainter.setBrush(color);
|
||||||
cachePainter.setRenderHint(QPainter::Antialiasing);
|
cachePainter.setRenderHint(QPainter::Antialiasing);
|
||||||
cachePainter.drawPolygon(triangle);
|
cachePainter.drawPolygon(triangle.data(), int(triangle.size()));
|
||||||
|
|
||||||
QPixmapCache::insert(cacheKey, cachePixmap);
|
QPixmapCache::insert(cacheKey, cachePixmap);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user