RandomEtc/modestmaps-processing — pull request #2 by camillol (2011-10-23 05:39:14+00:00)
Title: Do not draw offscreen tiles

The current formula for maxCol and maxRow results in treating a row and a column of offscreen tiles as visible. For instance, say you are at a zoom of 4, and thus have 16 columns, numbered from 0 to 15; then `(maxX-minX)` is 4096. If `(screenMaxX-minX)` is between 1793 and 2048, then the rightmost visible column is column 7, but ceil will return 8. This patch subtracts 1 to get the correct value.

Note that replacing `ceil` with `floor` would still produce an off-by-one value when `(screenMaxX-minX)` is a multiple of the tile width; for instance, floor(1792/4098*16) is 7, while the rightmost visible column in that case is 6.