void selectBlockSize ( int width , int height , int requestedBlockWidth ) { if ( height < requestedBlockWidth ) { blockHeight = height ; } else { int rows = height / requestedBlockWidth ; blockHeight = height / rows ; } if ( width < requestedBlockWidth ) { blockWidth = width ; } else { int cols = width / requestedBlockWidth ; blockWidth = width / cols ; } }
Selects a block size which is close to the requested block size by the user