summaryrefslogtreecommitdiffstats
path: root/src/declarative/graphicsitems
diff options
context:
space:
mode:
Diffstat (limited to 'src/declarative/graphicsitems')
-rw-r--r--src/declarative/graphicsitems/qdeclarativeimage.cpp10
-rw-r--r--src/declarative/graphicsitems/qdeclarativeimagebase.cpp2
2 files changed, 7 insertions, 5 deletions
diff --git a/src/declarative/graphicsitems/qdeclarativeimage.cpp b/src/declarative/graphicsitems/qdeclarativeimage.cpp
index ec20200..ed5d5fc 100644
--- a/src/declarative/graphicsitems/qdeclarativeimage.cpp
+++ b/src/declarative/graphicsitems/qdeclarativeimage.cpp
@@ -389,14 +389,16 @@ void QDeclarativeImage::updatePaintedGeometry()
if (d->fillMode == PreserveAspectFit) {
if (!d->pix.width() || !d->pix.height())
return;
- qreal widthScale = width() / qreal(d->pix.width());
- qreal heightScale = height() / qreal(d->pix.height());
+ qreal w = widthValid() ? width() : d->pix.width();
+ qreal widthScale = w / qreal(d->pix.width());
+ qreal h = heightValid() ? height() : d->pix.height();
+ qreal heightScale = h / qreal(d->pix.height());
if (widthScale <= heightScale) {
- d->paintedWidth = width();
+ d->paintedWidth = w;
d->paintedHeight = widthScale * qreal(d->pix.height());
} else if(heightScale < widthScale) {
d->paintedWidth = heightScale * qreal(d->pix.width());
- d->paintedHeight = height();
+ d->paintedHeight = h;
}
if (widthValid() && !heightValid()) {
setImplicitHeight(d->paintedHeight);
diff --git a/src/declarative/graphicsitems/qdeclarativeimagebase.cpp b/src/declarative/graphicsitems/qdeclarativeimagebase.cpp
index 471c87f..2de3ba0 100644
--- a/src/declarative/graphicsitems/qdeclarativeimagebase.cpp
+++ b/src/declarative/graphicsitems/qdeclarativeimagebase.cpp
@@ -130,7 +130,7 @@ QSize QDeclarativeImageBase::sourceSize() const
int width = d->sourcesize.width();
int height = d->sourcesize.height();
- return QSize(width != -1 ? width : implicitWidth(), height != -1 ? height : implicitHeight());
+ return QSize(width != -1 ? width : d->pix.width(), height != -1 ? height : d->pix.height());
}
bool QDeclarativeImageBase::cache() const