HoneycombBitmapFactory.smali
.class public Lcom/facebook/imagepipeline/bitmaps/HoneycombBitmapFactory;
.super Lcom/facebook/imagepipeline/bitmaps/PlatformBitmapFactory;
.source "HoneycombBitmapFactory.java"
# annotations
.annotation build Landroid/annotation/TargetApi;
value = 0xb
.end annotation
.annotation build Ljavax/annotation/concurrent/ThreadSafe;
.end annotation
# static fields
.field public static final TAG:Ljava/lang/String; = "HoneycombBitmapFactory"
# instance fields
.field public final mCloseableReferenceFactory:Lcom/facebook/imagepipeline/core/CloseableReferenceFactory;
.field public mImmutableBitmapFallback:Z
.field public final mJpegGenerator:Lcom/facebook/imagepipeline/bitmaps/EmptyJpegGenerator;
.field public final mPurgeableDecoder:Lcom/facebook/imagepipeline/platform/PlatformDecoder;
# direct methods
.method public static constructor <clinit>()V
.registers 0
return-void
.end method
.method public constructor <init>(Lcom/facebook/imagepipeline/bitmaps/EmptyJpegGenerator;Lcom/facebook/imagepipeline/platform/PlatformDecoder;Lcom/facebook/imagepipeline/core/CloseableReferenceFactory;)V
.registers 4
invoke-direct {p0}, Lcom/facebook/imagepipeline/bitmaps/PlatformBitmapFactory;-><init>()V
iput-object p1, p0, Lcom/facebook/imagepipeline/bitmaps/HoneycombBitmapFactory;->mJpegGenerator:Lcom/facebook/imagepipeline/bitmaps/EmptyJpegGenerator;
iput-object p2, p0, Lcom/facebook/imagepipeline/bitmaps/HoneycombBitmapFactory;->mPurgeableDecoder:Lcom/facebook/imagepipeline/platform/PlatformDecoder;
iput-object p3, p0, Lcom/facebook/imagepipeline/bitmaps/HoneycombBitmapFactory;->mCloseableReferenceFactory:Lcom/facebook/imagepipeline/core/CloseableReferenceFactory;
return-void
.end method
.method private createFallbackBitmap(IILandroid/graphics/Bitmap$Config;)Lcom/facebook/common/references/CloseableReference;
.registers 5
.annotation system Ldalvik/annotation/Signature;
value = {
"(II",
"Landroid/graphics/Bitmap$Config;",
")",
"Lcom/facebook/common/references/CloseableReference<",
"Landroid/graphics/Bitmap;",
">;"
}
.end annotation
iget-object v0, p0, Lcom/facebook/imagepipeline/bitmaps/HoneycombBitmapFactory;->mCloseableReferenceFactory:Lcom/facebook/imagepipeline/core/CloseableReferenceFactory;
invoke-static {p1, p2, p3}, Landroid/graphics/Bitmap;->createBitmap(IILandroid/graphics/Bitmap$Config;)Landroid/graphics/Bitmap;
move-result-object p1
invoke-static {}, Lcom/facebook/imagepipeline/bitmaps/SimpleBitmapReleaser;->getInstance()Lcom/facebook/imagepipeline/bitmaps/SimpleBitmapReleaser;
move-result-object p2
invoke-virtual {v0, p1, p2}, Lcom/facebook/imagepipeline/core/CloseableReferenceFactory;->create(Ljava/lang/Object;Lcom/facebook/common/references/ResourceReleaser;)Lcom/facebook/common/references/CloseableReference;
move-result-object p1
return-object p1
.end method
# virtual methods
.method public createBitmapInternal(IILandroid/graphics/Bitmap$Config;)Lcom/facebook/common/references/CloseableReference;
.registers 9
.annotation build Landroid/annotation/TargetApi;
value = 0xc
.end annotation
.annotation system Ldalvik/annotation/Signature;
value = {
"(II",
"Landroid/graphics/Bitmap$Config;",
")",
"Lcom/facebook/common/references/CloseableReference<",
"Landroid/graphics/Bitmap;",
">;"
}
.end annotation
iget-boolean v0, p0, Lcom/facebook/imagepipeline/bitmaps/HoneycombBitmapFactory;->mImmutableBitmapFallback:Z
if-eqz v0, :cond_9
invoke-direct {p0, p1, p2, p3}, Lcom/facebook/imagepipeline/bitmaps/HoneycombBitmapFactory;->createFallbackBitmap(IILandroid/graphics/Bitmap$Config;)Lcom/facebook/common/references/CloseableReference;
move-result-object p1
return-object p1
:cond_9
iget-object v0, p0, Lcom/facebook/imagepipeline/bitmaps/HoneycombBitmapFactory;->mJpegGenerator:Lcom/facebook/imagepipeline/bitmaps/EmptyJpegGenerator;
int-to-short v1, p1
int-to-short v2, p2
invoke-virtual {v0, v1, v2}, Lcom/facebook/imagepipeline/bitmaps/EmptyJpegGenerator;->generate(SS)Lcom/facebook/common/references/CloseableReference;
move-result-object v0
:try_start_11
new-instance v1, Lcom/facebook/imagepipeline/image/EncodedImage;
invoke-direct {v1, v0}, Lcom/facebook/imagepipeline/image/EncodedImage;-><init>(Lcom/facebook/common/references/CloseableReference;)V
sget-object v2, Lcom/facebook/imageformat/DefaultImageFormats;->JPEG:Lcom/facebook/imageformat/ImageFormat;
invoke-virtual {v1, v2}, Lcom/facebook/imagepipeline/image/EncodedImage;->setImageFormat(Lcom/facebook/imageformat/ImageFormat;)V
:try_end_1b
.catchall {:try_start_11 .. :try_end_1b} :catchall_6f
:try_start_1b
iget-object v2, p0, Lcom/facebook/imagepipeline/bitmaps/HoneycombBitmapFactory;->mPurgeableDecoder:Lcom/facebook/imagepipeline/platform/PlatformDecoder;
const/4 v3, 0x0
invoke-virtual {v0}, Lcom/facebook/common/references/CloseableReference;->get()Ljava/lang/Object;
move-result-object v4
check-cast v4, Lcom/facebook/common/memory/PooledByteBuffer;
invoke-interface {v4}, Lcom/facebook/common/memory/PooledByteBuffer;->size()I
move-result v4
invoke-interface {v2, v1, p3, v3, v4}, Lcom/facebook/imagepipeline/platform/PlatformDecoder;->decodeJPEGFromEncodedImage(Lcom/facebook/imagepipeline/image/EncodedImage;Landroid/graphics/Bitmap$Config;Landroid/graphics/Rect;I)Lcom/facebook/common/references/CloseableReference;
move-result-object v2
invoke-virtual {v2}, Lcom/facebook/common/references/CloseableReference;->get()Ljava/lang/Object;
move-result-object v3
check-cast v3, Landroid/graphics/Bitmap;
invoke-virtual {v3}, Landroid/graphics/Bitmap;->isMutable()Z
move-result v3
const/4 v4, 0x1
if-nez v3, :cond_50
invoke-static {v2}, Lcom/facebook/common/references/CloseableReference;->closeSafely(Lcom/facebook/common/references/CloseableReference;)V
iput-boolean v4, p0, Lcom/facebook/imagepipeline/bitmaps/HoneycombBitmapFactory;->mImmutableBitmapFallback:Z
sget-object v2, Lcom/facebook/imagepipeline/bitmaps/HoneycombBitmapFactory;->TAG:Ljava/lang/String;
const-string v3, "Immutable bitmap returned by decoder"
invoke-static {v2, v3}, Lcom/facebook/common/logging/FLog;->wtf(Ljava/lang/String;Ljava/lang/String;)V
invoke-direct {p0, p1, p2, p3}, Lcom/facebook/imagepipeline/bitmaps/HoneycombBitmapFactory;->createFallbackBitmap(IILandroid/graphics/Bitmap$Config;)Lcom/facebook/common/references/CloseableReference;
move-result-object p1
:try_end_49
.catchall {:try_start_1b .. :try_end_49} :catchall_6a
:try_start_49
invoke-static {v1}, Lcom/facebook/imagepipeline/image/EncodedImage;->closeSafely(Lcom/facebook/imagepipeline/image/EncodedImage;)V
:try_end_4c
.catchall {:try_start_49 .. :try_end_4c} :catchall_6f
invoke-virtual {v0}, Lcom/facebook/common/references/CloseableReference;->close()V
return-object p1
:cond_50
:try_start_50
invoke-virtual {v2}, Lcom/facebook/common/references/CloseableReference;->get()Ljava/lang/Object;
move-result-object p1
check-cast p1, Landroid/graphics/Bitmap;
invoke-virtual {p1, v4}, Landroid/graphics/Bitmap;->setHasAlpha(Z)V
invoke-virtual {v2}, Lcom/facebook/common/references/CloseableReference;->get()Ljava/lang/Object;
move-result-object p1
check-cast p1, Landroid/graphics/Bitmap;
const/4 p2, 0x0
invoke-virtual {p1, p2}, Landroid/graphics/Bitmap;->eraseColor(I)V
:try_end_63
.catchall {:try_start_50 .. :try_end_63} :catchall_6a
:try_start_63
invoke-static {v1}, Lcom/facebook/imagepipeline/image/EncodedImage;->closeSafely(Lcom/facebook/imagepipeline/image/EncodedImage;)V
:try_end_66
.catchall {:try_start_63 .. :try_end_66} :catchall_6f
invoke-virtual {v0}, Lcom/facebook/common/references/CloseableReference;->close()V
return-object v2
:catchall_6a
move-exception p1
:try_start_6b
invoke-static {v1}, Lcom/facebook/imagepipeline/image/EncodedImage;->closeSafely(Lcom/facebook/imagepipeline/image/EncodedImage;)V
throw p1
:try_end_6f
.catchall {:try_start_6b .. :try_end_6f} :catchall_6f
:catchall_6f
move-exception p1
invoke-virtual {v0}, Lcom/facebook/common/references/CloseableReference;->close()V
throw p1
.end method