summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorYann Bodson <yann.bodson@nokia.com>2010-02-08 05:28:35 (GMT)
committerYann Bodson <yann.bodson@nokia.com>2010-02-08 05:28:35 (GMT)
commit2fd36a6320aed7c2f825c2c38f2ef6d0b2703e17 (patch)
tree37802e738540d43775f9c1a00092463dab6c485d /src
parent6fb18bf757ca3c0c774ffdcb5004eac4a165e415 (diff)
downloadQt-2fd36a6320aed7c2f825c2c38f2ef6d0b2703e17.zip
Qt-2fd36a6320aed7c2f825c2c38f2ef6d0b2703e17.tar.gz
Qt-2fd36a6320aed7c2f825c2c38f2ef6d0b2703e17.tar.bz2
clip if tile mode is 'PreserveAspectCrop' and 'clip' property is true.
Diffstat (limited to 'src')
-rw-r--r--src/declarative/graphicsitems/qmlgraphicsimage.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/declarative/graphicsitems/qmlgraphicsimage.cpp b/src/declarative/graphicsitems/qmlgraphicsimage.cpp
index a1e8c17..7e63c8b 100644
--- a/src/declarative/graphicsitems/qmlgraphicsimage.cpp
+++ b/src/declarative/graphicsitems/qmlgraphicsimage.cpp
@@ -126,13 +126,13 @@ QML_DEFINE_TYPE(Qt,4,6,Image,QmlGraphicsImage)
*/
QmlGraphicsImage::QmlGraphicsImage(QmlGraphicsItem *parent)
- : QmlGraphicsImageBase(*(new QmlGraphicsImagePrivate), parent)
+ : QmlGraphicsImageBase(*(new QmlGraphicsImagePrivate), parent)
{
connect(this, SIGNAL(sourceChanged(QUrl)), this, SLOT(updatePaintedGeometry()));
}
QmlGraphicsImage::QmlGraphicsImage(QmlGraphicsImagePrivate &dd, QmlGraphicsItem *parent)
- : QmlGraphicsImageBase(dd, parent)
+ : QmlGraphicsImageBase(dd, parent)
{
}
@@ -343,12 +343,18 @@ void QmlGraphicsImage::paint(QPainter *p, const QStyleOptionGraphicsItem *, QWid
scale.translate(0, (height() - heightScale * d->pix.height()) / 2);
}
}
-
+ if (clip()) {
+ p->save();
+ p->setClipRect(boundingRect(), Qt::IntersectClip);
+ }
scale.scale(widthScale, heightScale);
QTransform old = p->transform();
p->setWorldTransform(scale * old);
p->drawPixmap(0, 0, d->pix);
p->setWorldTransform(old);
+ if (clip()) {
+ p->restore();
+ }
}
} else {
p->drawPixmap(0, 0, d->pix);