From d3bff41f31d68ffcae1ce0071ccef30010aa4043 Mon Sep 17 00:00:00 2001 From: "Aaron J. Seigo" Date: Mon, 22 Sep 2008 23:15:57 +0000 Subject: [PATCH] make it easy for when source == dest, which is a common case svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=863721 --- panelsvg.cpp | 2 +- panelsvg.h | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/panelsvg.cpp b/panelsvg.cpp index cd3bdb03f..ac26388b5 100644 --- a/panelsvg.cpp +++ b/panelsvg.cpp @@ -379,7 +379,7 @@ void PanelSvg::paintPanel(QPainter* painter, const QRectF& target, const QRectF& Q_ASSERT(panel->cachedBackground); } - painter->drawPixmap(target, *(panel->cachedBackground), source); + painter->drawPixmap(target, *(panel->cachedBackground), source.isValid() ? source : target); } void PanelSvg::paintPanel(QPainter* painter, const QPointF& pos) diff --git a/panelsvg.h b/panelsvg.h index 9770032f7..cbe0cf6ba 100644 --- a/panelsvg.h +++ b/panelsvg.h @@ -229,7 +229,8 @@ class PLASMA_EXPORT PanelSvg : public Svg * @arg target the target rectangle on the paint device * @arg source the portion rectangle of the source image */ - Q_INVOKABLE void paintPanel(QPainter* painter, const QRectF& target, const QRectF& source); + Q_INVOKABLE void paintPanel(QPainter* painter, const QRectF& target, + const QRectF& source = QRectF()); /** * Paints the loaded SVG with the elements that represents the border