use always qreal and convert to int just at the last moment, should

avoid some nice divide by 0
CCBUG:178746

svn path=/trunk/KDE/kdelibs/; revision=901542
This commit is contained in:
Marco Martin 2008-12-25 21:23:26 +00:00
parent 173a19d10d
commit 938b6291fc

View File

@ -141,7 +141,7 @@ public:
if (elementRect.width() > elementRect.height()) {
qreal ratio = tileSize.height() / tileSize.width();
int numTiles = elementRect.width()/(elementRect.height()/ratio);
int numTiles = qreal(elementRect.width())/(qreal(elementRect.height())/ratio);
tileSize = QSize(elementRect.width()/numTiles, elementRect.height());
QPoint center = elementRect.center().toPoint();
@ -149,7 +149,7 @@ public:
elementRect.moveCenter(center);
} else {
qreal ratio = tileSize.width() / tileSize.height();
int numTiles = elementRect.height()/(elementRect.width()/ratio);
int numTiles = qreal(elementRect.height())/(qreal(elementRect.width())/ratio);
tileSize = QSize(elementRect.width(), elementRect.height()/numTiles);
QPoint center = elementRect.center().toPoint();