From b7f710a79b3d5f529dde8ad43ee4e0b78100674f Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Thu, 14 May 2009 15:41:45 +1000 Subject: 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. --- src/declarative/fx/qfximage.cpp | 4 ++-- src/declarative/fx/qfxrect.cpp | 4 ++-- 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)); -- cgit v0.12