From 3fee99255c37185723be4e7206348564d13ceab9 Mon Sep 17 00:00:00 2001 From: David Morrissey Date: Sun, 15 Mar 2015 09:45:18 +0000 Subject: [PATCH] Modified tile map to allow for images close to a multiple of the max bitmap size --- .../labs/subscaleview/SubsamplingScaleImageView.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/library/src/com/davemorrissey/labs/subscaleview/SubsamplingScaleImageView.java b/library/src/com/davemorrissey/labs/subscaleview/SubsamplingScaleImageView.java index f039142f..e6e71a66 100644 --- a/library/src/com/davemorrissey/labs/subscaleview/SubsamplingScaleImageView.java +++ b/library/src/com/davemorrissey/labs/subscaleview/SubsamplingScaleImageView.java @@ -1268,12 +1268,12 @@ private void initialiseTileMap(Point maxTileDimensions) { int sTileHeight = sHeight()/yTiles; int subTileWidth = sTileWidth/sampleSize; int subTileHeight = sTileHeight/sampleSize; - while (subTileWidth > maxTileDimensions.x || (subTileWidth > getWidth() * 1.25 && sampleSize < fullImageSampleSize)) { + while (subTileWidth + xTiles + 1 > maxTileDimensions.x || (subTileWidth > getWidth() * 1.25 && sampleSize < fullImageSampleSize)) { xTiles += 1; sTileWidth = sWidth()/xTiles; subTileWidth = sTileWidth/sampleSize; } - while (subTileHeight > maxTileDimensions.y || (subTileHeight > getHeight() * 1.25 && sampleSize < fullImageSampleSize)) { + while (subTileHeight + yTiles + 1 > maxTileDimensions.y || (subTileHeight > getHeight() * 1.25 && sampleSize < fullImageSampleSize)) { yTiles += 1; sTileHeight = sHeight()/yTiles; subTileHeight = sTileHeight/sampleSize;