docs: private static Bitmap fractionalDecode(FractionalDecodeShim shim,
              Options options, int requestedWidth, int requestedHeight) {
          final int rawWidth = options.outWidth;
          final int rawHeight = options.outHeight;
          final float sampledWidth = (float) rawWidth / options.inSampleSize;
          final float sampledHeight = (float) rawHeight / options.inSampleSize;
  
          // Use the simple path, if we can/must
          if (requestedWidth == 0
                  || requestedHeight == 0 //
                  || sampledWidth <= Math.abs(requestedWidth)
                  || sampledHeight <= Math.abs(requestedHeight)) {
              if (VERBOSE_DECODE) {
                  Log.d(TAG,
                          "Can't use slice decoder: sampledWidth = %.0f, requestedWidth = %d; sampledHeight = %.0f, requestedHeight = %d",
                          sampledWidth, requestedWidth, sampledHeight,
                          requestedHeight);
              }
              return shim.decode(options);
          }
  
          // We must use a BitmapRegionDecoder to read and resize 'slices' of the
          // input
          BitmapRegionDecoder decoder = shim.newRegionDecoder();
          try {
  
              float scale = Math.max(scale(requestedWidth, sampledWidth),
                      scale(requestedHeight, sampledHeight));
  
              int scaledSliceWidth = roundUp(sampledWidth * scale);
              int slices = (decoder == null) ? 1 : roundUp(sampledHeight
                      / (SLICE_SIZE / sampledWidth));
              int sliceRows = (int) (rawHeight / slices);
              float scaledSliceRows = sliceRows / options.inSampleSize * scale;
  
              Bitmap result = Bitmap.createBitmap((int) (sampledWidth * scale),
                      (int) (sampledHeight * scale), Config.ARGB_8888);
              Canvas canvas = new Canvas(result);
              Paint paint = new Paint(Paint.FILTER_BITMAP_FLAG);
  
              // Rect decode, uses 'raw' coordinates
              Rect decode = new Rect(0, 0, rawWidth, sliceRows);
              // RectF target, uses scaled coordinates
              RectF target = new RectF(0, 0, scaledSliceWidth, scaledSliceRows);
              Bitmap slice = options.inBitmap = null;
              boolean hasAlpha = false;
              for (int index = 0; index < slices; ++index) {
                  slice = options.inBitmap = //
                  (decoder == null) ? shim.decode(options) : //
                          decoder.decodeRegion(decode, options);
  
                  hasAlpha |= slice.hasAlpha();
  
                  canvas.drawBitmap(slice, null, target, paint);
  
                  decode.offset(0, sliceRows);
                  target.offset(0, scaledSliceRows);
              }
              slice.recycle();
  
              // log(TAG,
              // "fractionalDecode: result.hasAlpha() == %b, slices' hasAlpha == %b",
              // result.hasAlpha(), hasAlpha);
              result.setHasAlpha(hasAlpha);
              return result;
  
          } finally {
              if (decoder != null) {
                  decoder.recycle();
              }
          }
      }