From 29bc7ed49e761de5e116c8ea1435f9aabd57a730 Mon Sep 17 00:00:00 2001 From: "Aaron J. Seigo" Date: Tue, 22 May 2007 00:20:52 +0000 Subject: [PATCH] i'll take the red pill. svn path=/trunk/KDE/kdebase/workspace/plasma/lib/; revision=667153 --- svg.cpp | 35 +++++++++++------------------------ svg.h | 12 +++--------- 2 files changed, 14 insertions(+), 33 deletions(-) diff --git a/svg.cpp b/svg.cpp index 0ae22cc61..c8725dfa0 100644 --- a/svg.cpp +++ b/svg.cpp @@ -53,7 +53,7 @@ class Svg::Private id.clear(); } - void findInCache(const QMatrix& matrix, QPixmap& p, const QString& elementId) + void findInCache(QPixmap& p, const QString& elementId) { if ( path.isNull() ) { path = Plasma::Theme::self()->image( themePath ); @@ -64,18 +64,10 @@ class Svg::Private } } - //QMatrix matrix = painter->worldMatrix(); - - //TODO: if the id changes, should we remove it or just let QPixmapCache do that for us? - id = QString::fromLatin1( "%7_%1_%2_%3_%4_%5_%6" ) - .arg( size.width() ) - .arg( size.height() ) - .arg( matrix.m11() ) - .arg( matrix.m12() ) - .arg( matrix.m21() ) - .arg( matrix.m22() ) - .arg( themePath ); - + id = QString::fromLatin1("%3_%2_%1") + .arg( size.width() ) + .arg( size.height() ) + .arg( themePath ); if (!elementId.isEmpty()) { id.append(elementId); } @@ -105,7 +97,6 @@ class Svg::Private p = QPixmap(s); p.fill(Qt::transparent); QPainter renderPainter( &p ); - renderPainter.setWorldMatrix( matrix ); if ( elementId.isEmpty() ) { renderer->render( &renderPainter ); @@ -136,26 +127,22 @@ Svg::~Svg() } -void Svg::paint(QPainter* painter, const QPointF& point, const QString& elementID, const QMatrix* matrix) +void Svg::paint(QPainter* painter, const QPointF& point, const QString& elementID) { QPixmap pix; - d->findInCache(matrix ? *matrix : painter->worldMatrix(), pix, elementID); - -/* QMatrix matrix = painter->worldMatrix(); - painter->setWorldMatrix( QMatrix() );*/ + d->findInCache(pix, elementID); painter->drawPixmap(point.toPoint(), pix); -// painter->setWorldMatrix( matrix ); } -void Svg::paint(QPainter* painter, int x, int y, const QString& elementID, const QMatrix* matrix) +void Svg::paint(QPainter* painter, int x, int y, const QString& elementID) { - paint(painter, QPointF( x, y ), elementID, matrix); + paint(painter, QPointF( x, y ), elementID); } -void Svg::paint(QPainter* painter, const QRectF& rect, const QString& elementID, const QMatrix* matrix) +void Svg::paint(QPainter* painter, const QRectF& rect, const QString& elementID) { QPixmap pix; - d->findInCache(matrix ? *matrix : painter->worldMatrix(), pix, elementID); + d->findInCache(pix, elementID); painter->drawPixmap(rect, pix, rect); } diff --git a/svg.h b/svg.h index 0c7573112..921dc62f7 100644 --- a/svg.h +++ b/svg.h @@ -63,13 +63,9 @@ class PLASMA_EXPORT Svg : public QObject * @arg painter the QPainter to use * @arg point the position to start drawing; the entire svg will be * drawn starting at this point. - * @arg matrix the QMatrix to transform the drawing by; useful if, for instance - * you are drawing into a painter with a transformation, but you want the - * SVG to be painted in relation to, rather than using, that */ void paint(QPainter* painter, const QPointF& point, - const QString& elementID = QString(), - const QMatrix* matrix = 0); + const QString& elementID = QString()); /** * Paints the SVG represented by this object @@ -81,8 +77,7 @@ class PLASMA_EXPORT Svg : public QObject * SVG to be painted in relation to, rather than using, that */ void paint(QPainter* painter, int x, int y, - const QString& elementID = QString(), - const QMatrix* matrix = 0); + const QString& elementID = QString()); /** * Paints the SVG represented by this object @@ -95,8 +90,7 @@ class PLASMA_EXPORT Svg : public QObject * SVG to be painted in relation to, rather than using, that */ void paint(QPainter* painter, const QRectF& rect, - const QString& elementID = QString(), - const QMatrix* matrix = 0); + const QString& elementID = QString()); /** * Resizes the rendered image. Rendering will actually take place on