Change in plasma-framework[master]: don't animate icons when they get resized
Marco Martin (Code Review)
noreply at kde.org
Fri Jan 16 19:03:36 UTC 2015
Marco Martin has uploaded a new change for review.
https://gerrit.vesnicky.cesnet.cz/r/336
Change subject: don't animate icons when they get resized
......................................................................
don't animate icons when they get resized
simplify a bit logic ans
make sure if m_sizeChanged is true, never to animate the change
Change-Id: I552f79b13f7714749137fa90df1f9f30120e6a37
---
M src/declarativeimports/core/iconitem.cpp
1 file changed, 10 insertions(+), 16 deletions(-)
git pull ssh://gerrit.vesnicky.cesnet.cz:29418/plasma-framework refs/changes/36/336/1
diff --git a/src/declarativeimports/core/iconitem.cpp b/src/declarativeimports/core/iconitem.cpp
index 08bb47d..005e339 100644
--- a/src/declarativeimports/core/iconitem.cpp
+++ b/src/declarativeimports/core/iconitem.cpp
@@ -251,20 +251,16 @@
QSGTexture *source = window()->createTextureFromImage(m_iconPixmap.toImage());
QSGTexture *target = window()->createTextureFromImage(m_oldIconPixmap.toImage());
animatingNode = new FadingNode(source, target);
- m_sizeChanged = true;
m_textureChanged = false;
}
animatingNode->setProgress(m_animValue);
- if (m_sizeChanged) {
- const int iconSize = Units::roundToIconSize(qMin(boundingRect().size().width(), boundingRect().size().height()));
- const QRect destRect(QPointF(boundingRect().center() - QPointF(iconSize/2, iconSize/2)).toPoint(),
- QSize(iconSize, iconSize));
+ const int iconSize = Units::roundToIconSize(qMin(boundingRect().size().width(), boundingRect().size().height()));
+ const QRect destRect(QPointF(boundingRect().center() - QPointF(iconSize/2, iconSize/2)).toPoint(),
+ QSize(iconSize, iconSize));
- animatingNode->setRect(destRect);
- m_sizeChanged = false;
- }
+ animatingNode->setRect(destRect);
return animatingNode;
} else {
@@ -274,18 +270,15 @@
delete oldNode;
textureNode = new ManagedTextureNode;
textureNode->setTexture(QSharedPointer<QSGTexture>(window()->createTextureFromImage(m_iconPixmap.toImage())));
- m_sizeChanged = true;
m_textureChanged = false;
}
- if (m_sizeChanged) {
- const int iconSize = Units::roundToIconSize(qMin(boundingRect().size().width(), boundingRect().size().height()));
- const QRect destRect(QPointF(boundingRect().center() - QPointF(iconSize/2, iconSize/2)).toPoint(),
- QSize(iconSize, iconSize));
+ const int iconSize = Units::roundToIconSize(qMin(boundingRect().size().width(), boundingRect().size().height()));
+ const QRect destRect(QPointF(boundingRect().center() - QPointF(iconSize/2, iconSize/2)).toPoint(),
+ QSize(iconSize, iconSize));
- textureNode->setRect(destRect);
- m_sizeChanged = false;
- }
+ textureNode->setRect(destRect);
+
return textureNode;
}
}
@@ -354,6 +347,7 @@
m_animation->stop();
}
update();
+ m_sizeChanged = false;
}
void IconItem::geometryChanged(const QRectF &newGeometry,
--
To view, visit https://gerrit.vesnicky.cesnet.cz/r/336
To unsubscribe, visit https://gerrit.vesnicky.cesnet.cz/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I552f79b13f7714749137fa90df1f9f30120e6a37
Gerrit-PatchSet: 1
Gerrit-Project: plasma-framework
Gerrit-Branch: master
Gerrit-Owner: Marco Martin <notmart at gmail.com>
Gerrit-Reviewer: David Edmundson <david at davidedmundson.co.uk>
More information about the Plasma-devel
mailing list