private static void internalCopyBitmap(Bitmap destBitmap, Bitmap sourceBitmap) {
    if (NativeCodeSetup.getUseNativeCode() && destBitmap.getConfig() == sourceBitmap.getConfig()) {
      try {
        if (sCopyBitmap == null) {
          Class<?> clazz = Class.forName("com.facebook.imagepipeline.nativecode.Bitmaps");
          sCopyBitmap = clazz.getDeclaredMethod("copyBitmap", Bitmap.class, Bitmap.class);
        }
        sCopyBitmap.invoke(null, destBitmap, sourceBitmap);
        return;
      } catch (ClassNotFoundException e) {
        throw new RuntimeException("Wrong Native code setup, reflection failed.", e);
      } catch (IllegalAccessException e) {
        throw new RuntimeException("Wrong Native code setup, reflection failed.", e);
      } catch (NoSuchMethodException e) {
        throw new RuntimeException("Wrong Native code setup, reflection failed.", e);
      } catch (InvocationTargetException e) {
        throw new RuntimeException("Wrong Native code setup, reflection failed.", e);
      }
    }

    // This code will be run only if we fail to use native version with any reason (configuration or
    // reflection fail).
    // The bitmap configurations might be different when the source bitmap's configuration is
    // null, because it uses an internal configuration and the destination bitmap's configuration
    // is the FALLBACK_BITMAP_CONFIGURATION. This is the case for static images for animated GIFs.
    Canvas canvas = new Canvas(destBitmap);
    canvas.drawBitmap(sourceBitmap, 0, 0, null);
  }
Copies the content of {@code sourceBitmap} to {@code destBitmap}. Both bitmaps must have the
same width and height. If their {@link Bitmap.Config} are identical, the memory is directly
copied. Otherwise, the {@code sourceBitmap} is drawn into {@code destBitmap}.
imagepipeline/src/main/java/com/facebook/imagepipeline/request/BasePostprocessor.java