Mercurial > hg > svcore
diff data/model/PowerOfTwoZoomConstraint.cpp @ 1527:710e6250a401 zoom
Merge from default branch
author | Chris Cannam |
---|---|
date | Mon, 17 Sep 2018 13:51:14 +0100 |
parents | d4a28d1479a8 48e9f538e6e9 |
children | c1c45c5146bb |
line wrap: on
line diff
--- a/data/model/PowerOfTwoZoomConstraint.cpp Mon Dec 12 15:18:52 2016 +0000 +++ b/data/model/PowerOfTwoZoomConstraint.cpp Mon Sep 17 13:51:14 2018 +0100 @@ -45,28 +45,28 @@ int PowerOfTwoZoomConstraint::getNearestBlockSize(int req, - RoundingDirection dir) const + RoundingDirection dir) const { int result = 0; for (int bs = 1; ; bs *= 2) { - if (bs >= req) { - if (dir == RoundNearest) { - if (bs - req < req - bs/2) { - result = bs; - break; - } else { - result = bs/2; - break; - } - } else if (dir == RoundDown) { - result = bs/2; - break; - } else { - result = bs; - break; - } - } + if (bs >= req) { + if (dir == RoundNearest) { + if (bs - req < req - bs/2) { + result = bs; + break; + } else { + result = bs/2; + break; + } + } else if (dir == RoundDown) { + result = bs/2; + break; + } else { + result = bs; + break; + } + } } if (result > getMaxZoomLevel().level) result = getMaxZoomLevel().level;