public void run() {
   if (this.imageAware.isCollected()) {
     C0126L.m33d(LOG_TASK_CANCELLED_IMAGEAWARE_COLLECTED, this.memoryCacheKey);
     this.listener.onLoadingCancelled(this.imageUri, this.imageAware.getWrappedView());
   } else if (isViewWasReused()) {
     C0126L.m33d(LOG_TASK_CANCELLED_IMAGEAWARE_REUSED, this.memoryCacheKey);
     this.listener.onLoadingCancelled(this.imageUri, this.imageAware.getWrappedView());
   } else {
     C0126L.m33d(LOG_DISPLAY_IMAGE_IN_IMAGEAWARE, this.loadedFrom, this.memoryCacheKey);
     this.displayer.display(this.bitmap, this.imageAware, this.loadedFrom);
     this.engine.cancelDisplayTaskFor(this.imageAware);
     this.listener.onLoadingComplete(this.imageUri, this.imageAware.getWrappedView(), this.bitmap);
   }
 }
 protected Options prepareDecodingOptions(ImageSize imageSize, ImageDecodingInfo decodingInfo) {
   int scale;
   ImageScaleType scaleType = decodingInfo.getImageScaleType();
   if (scaleType == ImageScaleType.NONE) {
     scale = 1;
   } else if (scaleType == ImageScaleType.NONE_SAFE) {
     scale = ImageSizeUtils.computeMinImageSampleSize(imageSize);
   } else {
     boolean powerOf2;
     ImageSize targetSize = decodingInfo.getTargetSize();
     if (scaleType == ImageScaleType.IN_SAMPLE_POWER_OF_2) {
       powerOf2 = true;
     } else {
       powerOf2 = false;
     }
     scale =
         ImageSizeUtils.computeImageSampleSize(
             imageSize, targetSize, decodingInfo.getViewScaleType(), powerOf2);
   }
   if (scale > 1 && this.loggingEnabled) {
     C0126L.m33d(
         LOG_SUBSAMPLE_IMAGE,
         imageSize,
         imageSize.scaleDown(scale),
         Integer.valueOf(scale),
         decodingInfo.getImageKey());
   }
   Options decodingOptions = decodingInfo.getDecodingOptions();
   decodingOptions.inSampleSize = scale;
   return decodingOptions;
 }
 public Bitmap decode(ImageDecodingInfo decodingInfo) throws IOException {
   Bitmap bitmap = null;
   InputStream imageStream = getImageStream(decodingInfo);
   if (imageStream == null) {
     C0126L.m34e(ERROR_NO_IMAGE_STREAM, decodingInfo.getImageKey());
     return bitmap;
   }
   try {
     ImageFileInfo imageInfo = defineImageSizeAndRotation(imageStream, decodingInfo);
     imageStream = resetStream(imageStream, decodingInfo);
     bitmap =
         BitmapFactory.decodeStream(
             imageStream, null, prepareDecodingOptions(imageInfo.imageSize, decodingInfo));
     if (bitmap != null) {
       return considerExactScaleAndOrientatiton(
           bitmap, decodingInfo, imageInfo.exif.rotation, imageInfo.exif.flipHorizontal);
     }
     C0126L.m34e(ERROR_CANT_DECODE_IMAGE, decodingInfo.getImageKey());
     return bitmap;
   } finally {
     IoUtils.closeSilently(imageStream);
   }
 }