Skip to content

Commit 3fee992

Browse files
committed
Modified tile map to allow for images close to a multiple of the max bitmap size
1 parent 81119c9 commit 3fee992

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

library/src/com/davemorrissey/labs/subscaleview/SubsamplingScaleImageView.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1268,12 +1268,12 @@ private void initialiseTileMap(Point maxTileDimensions) {
12681268
int sTileHeight = sHeight()/yTiles;
12691269
int subTileWidth = sTileWidth/sampleSize;
12701270
int subTileHeight = sTileHeight/sampleSize;
1271-
while (subTileWidth > maxTileDimensions.x || (subTileWidth > getWidth() * 1.25 && sampleSize < fullImageSampleSize)) {
1271+
while (subTileWidth + xTiles + 1 > maxTileDimensions.x || (subTileWidth > getWidth() * 1.25 && sampleSize < fullImageSampleSize)) {
12721272
xTiles += 1;
12731273
sTileWidth = sWidth()/xTiles;
12741274
subTileWidth = sTileWidth/sampleSize;
12751275
}
1276-
while (subTileHeight > maxTileDimensions.y || (subTileHeight > getHeight() * 1.25 && sampleSize < fullImageSampleSize)) {
1276+
while (subTileHeight + yTiles + 1 > maxTileDimensions.y || (subTileHeight > getHeight() * 1.25 && sampleSize < fullImageSampleSize)) {
12771277
yTiles += 1;
12781278
sTileHeight = sHeight()/yTiles;
12791279
subTileHeight = sTileHeight/sampleSize;

0 commit comments

Comments
 (0)