summaryrefslogtreecommitdiffstats
path: root/src/declarative
diff options
context:
space:
mode:
authorMichael Brasser <michael.brasser@nokia.com>2009-05-14 05:41:45 (GMT)
committerMichael Brasser <michael.brasser@nokia.com>2009-05-14 05:41:45 (GMT)
commitb7f710a79b3d5f529dde8ad43ee4e0b78100674f (patch)
treeb06f6b6d827d524834bff5ac8a1147c3c918e7c8 /src/declarative
parentefc9a552d6d3f03b962ce0df260fb2c61b8b8ec1 (diff)
downloadQt-b7f710a79b3d5f529dde8ad43ee4e0b78100674f.zip
Qt-b7f710a79b3d5f529dde8ad43ee4e0b78100674f.tar.gz
Qt-b7f710a79b3d5f529dde8ad43ee4e0b78100674f.tar.bz2
Have scale grid images degrade a bit nicer.
If a scale grid image has offsets that add up to bigger than the size, we don't paint the middle bits at all.
Diffstat (limited to 'src/declarative')
-rw-r--r--src/declarative/fx/qfximage.cpp4
-rw-r--r--src/declarative/fx/qfxrect.cpp4
2 files changed, 4 insertions, 4 deletions
diff --git a/src/declarative/fx/qfximage.cpp b/src/declarative/fx/qfximage.cpp
index dfd6915..9d7a36a 100644
--- a/src/declarative/fx/qfximage.cpp
+++ b/src/declarative/fx/qfximage.cpp
@@ -365,8 +365,8 @@ void QFxImage::paintContents(QPainter &p)
const int sgr = d->_scaleGrid->right();
const int sgt = d->_scaleGrid->top();
const int sgb = d->_scaleGrid->bottom();
- const int xSide = sgl + sgr;
- const int ySide = sgt + sgb;
+ const int xSide = qMin(sgl + sgr, int(width()));
+ const int ySide = qMin(sgt + sgb, int(height()));
// Upper left
if (sgt && sgl)
diff --git a/src/declarative/fx/qfxrect.cpp b/src/declarative/fx/qfxrect.cpp
index 371aa0c..dafd8a2 100644
--- a/src/declarative/fx/qfxrect.cpp
+++ b/src/declarative/fx/qfxrect.cpp
@@ -486,8 +486,8 @@ void QFxRect::drawRect(QPainter &p)
}
//basically same code as QFxImage uses to paint sci images
- int xSide = offset * 2;
- int ySide = offset * 2;
+ int xSide = qMin(offset * 2, int(width()));
+ int ySide = qMin(offset * 2, int(height()));;
// Upper left
p.drawImage(QRect(0, 0, offset, offset), d->_rectImage, QRect(0, 0, offset, offset));