From d4ca38b20f359b1017c863c5b09b17099dfbdb64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexis=20M=C3=A9nard?= Date: Thu, 16 Jul 2009 13:09:19 +0000 Subject: [PATCH] This almost fix the performance issue when zooming out on plasma-desktop. We don't need to call prepareGeometryChange if the geometry will not change, this mistake end up with a new paint event that will paint for nothing. This should be backported into 4.3 svn path=/trunk/KDE/kdelibs/; revision=997763 --- private/desktoptoolbox.cpp | 6 +++--- private/toolbox.cpp | 2 +- private/toolbox_p.h | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/private/desktoptoolbox.cpp b/private/desktoptoolbox.cpp index e61058a4d..72c80083d 100644 --- a/private/desktoptoolbox.cpp +++ b/private/desktoptoolbox.cpp @@ -108,6 +108,8 @@ class EmptyGraphicsItem : public QGraphicsItem void setRect(const QRectF &rect) { + if (m_rect == rect) + return; //kDebug() << "setting rect to" << rect; prepareGeometryChange(); m_rect = rect; @@ -510,9 +512,8 @@ void DesktopToolBox::showToolBox() { setFlag(ItemIgnoresTransformations, isToolbar()); - if (showing() && !isToolbar()) { + if (showing() && !isToolbar()) return; - } // put tools 5px from icon edge const int iconWidth = KIconLoader::SizeMedium; @@ -696,7 +697,6 @@ void DesktopToolBox::showToolBox() } } - d->toolBacker->setRect(backerRect); d->toolBacker->show(); diff --git a/private/toolbox.cpp b/private/toolbox.cpp index 1a01e2f97..8d76dc5ae 100644 --- a/private/toolbox.cpp +++ b/private/toolbox.cpp @@ -362,7 +362,7 @@ QTransform ToolBox::viewTransform() const return d->viewTransform; } -void ToolBox::setViewTransform(QTransform transform) +void ToolBox::setViewTransform(const QTransform &transform) { if (transform.isScaling()) { d->toolbar = true; diff --git a/private/toolbox_p.h b/private/toolbox_p.h index 7ae36d184..9c9934365 100644 --- a/private/toolbox_p.h +++ b/private/toolbox_p.h @@ -84,7 +84,7 @@ public: void setIsToolbar(bool toolbar); QTransform viewTransform() const; - void setViewTransform(QTransform transforn); + void setViewTransform(const QTransform &transform); void save(KConfigGroup &cg) const; void load(const KConfigGroup &containmentGroup = KConfigGroup());