public static int computeMinImageSampleSize(ImageSize srcSize){
  final int srcWidth=srcSize.getWidth();
  final int srcHeight=srcSize.getHeight();
  final int targetWidth=maxBitmapSize.getWidth();
  final int targetHeight=maxBitmapSize.getHeight();
  final int widthScale=(int)Math.ceil((float)srcWidth / targetWidth);
  final int heightScale=(int)Math.ceil((float)srcHeight / targetHeight);
  return Math.max(widthScale,heightScale);
}

public static int computeMinImageSampleSize ( ImageSize srcSize ) { final int srcWidth = srcSize . getWidth ( ) ; final int srcHeight = srcSize . getHeight ( ) ; final int targetWidth = maxBitmapSize . getWidth ( ) ; final int targetHeight = maxBitmapSize . getHeight ( ) ; final int widthScale = ( int ) Math . ceil ( ( float ) srcWidth / targetWidth ) ; final int heightScale = ( int ) Math . ceil ( ( float ) srcHeight / targetHeight ) ; return Math . max ( widthScale , heightScale ) ; }
computes minimal sample size for downscaling image so result image size won ' t exceed max acceptable opengl texture size . < br / > we can ' t create bitmap in memory with size exceed max texture size ( usually this is 2048x2048 ) so this method calculate minimal sample size which should be applied to image to fit into these limits .
