public Bitmap run(ThreadPool.JobContext paramJobContext) {
   ImageCacheService localImageCacheService = this.mApplication.getImageCacheService();
   BytesBufferPool.BytesBuffer localBytesBuffer = MediaItem.getBytesBufferPool().get();
   Bitmap localBitmap1;
   try {
     boolean bool1 = localImageCacheService.getImageData(this.mPath, this.mType, localBytesBuffer);
     boolean bool2 = paramJobContext.isCancelled();
     if (bool2) return null;
     if (bool1) {
       BitmapFactory.Options localOptions = new BitmapFactory.Options();
       localOptions.inPreferredConfig = Bitmap.Config.ARGB_8888;
       if (this.mType == 2) ;
       Bitmap localBitmap3;
       for (Object localObject2 =
               DecodeUtils.decode(
                   paramJobContext,
                   localBytesBuffer.data,
                   localBytesBuffer.offset,
                   localBytesBuffer.length,
                   localOptions,
                   MediaItem.getMicroThumbPool());
           ;
           localObject2 = localBitmap3) {
         if ((localObject2 == null) && (!paramJobContext.isCancelled()))
           Log.w("ImageCacheRequest", "decode cached failed " + debugTag());
         return localObject2;
         localBitmap3 =
             DecodeUtils.decode(
                 paramJobContext,
                 localBytesBuffer.data,
                 localBytesBuffer.offset,
                 localBytesBuffer.length,
                 localOptions,
                 MediaItem.getThumbPool());
       }
     }
     MediaItem.getBytesBufferPool().recycle(localBytesBuffer);
     localBitmap1 = onDecodeOriginal(paramJobContext, this.mType);
     return null;
   } finally {
     MediaItem.getBytesBufferPool().recycle(localBytesBuffer);
   }
   if (localBitmap1 == null) {
     Log.w("ImageCacheRequest", "decode orig failed " + debugTag());
     return null;
   }
   if (this.mType == 2) ;
   for (Bitmap localBitmap2 =
           BitmapUtils.resizeAndCropCenter(localBitmap1, this.mTargetSize, true);
       paramJobContext.isCancelled();
       localBitmap2 = BitmapUtils.resizeDownBySideLength(localBitmap1, this.mTargetSize, true))
     return null;
   byte[] arrayOfByte = BitmapUtils.compressToBytes(localBitmap2);
   if (paramJobContext.isCancelled()) return null;
   localImageCacheService.putImageData(this.mPath, this.mType, arrayOfByte);
   return (Bitmap) localBitmap2;
 }
Ejemplo n.º 2
0
    @Override
    public Bitmap run(JobContext jc) {
      if (!prepareInputFile(jc)) return null;
      int targetSize = MediaItem.getTargetSize(mType);
      Options options = new Options();
      options.inPreferredConfig = Config.ARGB_8888;
      Bitmap bitmap =
          DecodeUtils.decodeThumbnail(
              jc, mFileDescriptor.getFileDescriptor(), options, targetSize, mType);

      if (jc.isCancelled() || bitmap == null) {
        return null;
      }

      if (mType == MediaItem.TYPE_MICROTHUMBNAIL) {
        bitmap = BitmapUtils.resizeAndCropCenter(bitmap, targetSize, true);
      } else {
        bitmap = BitmapUtils.resizeDownBySideLength(bitmap, targetSize, true);
      }
      return bitmap;
    }