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:
parent
173a19d10d
commit
938b6291fc
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user