From 4eadcd6ebaec5a172b874bbb28efe06f3b473817 Mon Sep 17 00:00:00 2001 From: Mikhail Svetkin Date: Mon, 19 Nov 2018 13:43:42 +0500 Subject: QSGSoftwareInternalRectangleNode: Reduce memory allocations QSGSoftwareInternalRectangleNode does not check size of the border QPixmap and always generates the new one. Change-Id: I24d5917252ae310238417cc01935b9471992e1c8 Reviewed-by: Andy Nichols --- .../adaptations/software/qsgsoftwareinternalrectanglenode.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/quick/scenegraph/adaptations/software/qsgsoftwareinternalrectanglenode.cpp b/src/quick/scenegraph/adaptations/software/qsgsoftwareinternalrectanglenode.cpp index 2c361e03e2..868fbf1a90 100644 --- a/src/quick/scenegraph/adaptations/software/qsgsoftwareinternalrectanglenode.cpp +++ b/src/quick/scenegraph/adaptations/software/qsgsoftwareinternalrectanglenode.cpp @@ -425,8 +425,11 @@ void QSGSoftwareInternalRectangleNode::generateCornerPixmap() { //Generate new corner Pixmap int radius = qFloor(qMin(qMin(m_rect.width(), m_rect.height()) * 0.5, m_radius)); + const auto width = qRound(radius * 2 * m_devicePixelRatio); + + if (m_cornerPixmap.width() != width) + m_cornerPixmap = QPixmap(width, width); - m_cornerPixmap = QPixmap(qRound(radius * 2 * m_devicePixelRatio), qRound(radius * 2 * m_devicePixelRatio)); m_cornerPixmap.setDevicePixelRatio(m_devicePixelRatio); m_cornerPixmap.fill(Qt::transparent); -- cgit v1.2.3