aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/scenegraph/adaptations
diff options
context:
space:
mode:
authorMikhail Svetkin <mikhail.svetkin@qt.io>2018-11-19 13:43:42 +0500
committerMikhail Svetkin <mikhail.svetkin@qt.io>2018-11-27 22:28:05 +0000
commit4eadcd6ebaec5a172b874bbb28efe06f3b473817 (patch)
tree19db9a0715e97791f4cdf9fbe5038a166cde8001 /src/quick/scenegraph/adaptations
parentba9d630c3de6a47d96e41b5a4b10ce2d5861e1fb (diff)
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 <andy.nichols@qt.io>
Diffstat (limited to 'src/quick/scenegraph/adaptations')
-rw-r--r--src/quick/scenegraph/adaptations/software/qsgsoftwareinternalrectanglenode.cpp5
1 files changed, 4 insertions, 1 deletions
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);