I can merge 2 calculation into single one like below.

    static void calculateInSampleSize(Request data, BitmapFactory.Options options) {
      final int height = options.outHeight;
      final int width = options.outWidth;
      int sampleSize = Utils.calculateValidInSampleSize(options.inSampleSize);
      if (data.hasSize()) {
        if (height > data.targetHeight || width > data.targetWidth) {
          final int heightRatio = Math.round((float) height / (float) data.targetHeight);
          final int widthRatio = Math.round((float) width / (float) data.targetWidth);
          sampleSize = heightRatio < widthRatio ? heightRatio : widthRatio;
        }
      }
      if (!data.overTextureSize) {
        sampleSize = Utils.calculateValidInSampleSize(sampleSize);
        final int scaledHeight = height / sampleSize;
        final int scaledWidth = width / sampleSize;
        if (scaledHeight > MAX_TEXTURE_SIZE || scaledWidth > MAX_TEXTURE_SIZE) {
          final int heightRatio = Math.round((float) scaledHeight / (float) MAX_TEXTURE_SIZE);
          final int widthRatio = Math.round((float) scaledWidth / (float) MAX_TEXTURE_SIZE);
          sampleSize = heightRatio < widthRatio ? heightRatio : widthRatio;
        }
      }
      options.inSampleSize = sampleSize;
      options.inJustDecodeBounds = false;
    }
Is it what you said? If it's right, i can change it.
(I think it would be better to use separate method, because `calculateTargetSizeInSampleSize` and `calculateTextureSizeLimitInSampleSize` are different logic.)