HoneycombBitmapFactory.smali
.class public Lcom/facebook/imagepipeline/bitmaps/HoneycombBitmapFactory;
.super Lcom/facebook/imagepipeline/bitmaps/PlatformBitmapFactory;
.source "SourceFile"
# annotations
.annotation build Landroid/annotation/TargetApi;
value = 0xb
.end annotation
# static fields
.field private static final TAG:Ljava/lang/String; = "HoneycombBitmapFactory"
# instance fields
.field private final mCloseableReferenceFactory:Lcom/facebook/imagepipeline/core/CloseableReferenceFactory;
.field private mImmutableBitmapFallback:Z
.field private final mJpegGenerator:Lcom/facebook/imagepipeline/bitmaps/EmptyJpegGenerator;
.field private final mPurgeableDecoder:Lcom/facebook/imagepipeline/platform/PlatformDecoder;
# direct methods
.method public constructor <init>(Lcom/facebook/imagepipeline/bitmaps/EmptyJpegGenerator;Lcom/facebook/imagepipeline/platform/PlatformDecoder;Lcom/facebook/imagepipeline/core/CloseableReferenceFactory;)V
.registers 4
.line 1
invoke-direct {p0}, Lcom/facebook/imagepipeline/bitmaps/PlatformBitmapFactory;-><init>()V
.line 2
iput-object p1, p0, Lcom/facebook/imagepipeline/bitmaps/HoneycombBitmapFactory;->mJpegGenerator:Lcom/facebook/imagepipeline/bitmaps/EmptyJpegGenerator;
.line 3
iput-object p2, p0, Lcom/facebook/imagepipeline/bitmaps/HoneycombBitmapFactory;->mPurgeableDecoder:Lcom/facebook/imagepipeline/platform/PlatformDecoder;
.line 4
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
.line 1
iget-object v0, p0, Lcom/facebook/imagepipeline/bitmaps/HoneycombBitmapFactory;->mCloseableReferenceFactory:Lcom/facebook/imagepipeline/core/CloseableReferenceFactory;
.line 2
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
.line 3
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
.line 1
iget-boolean v0, p0, Lcom/facebook/imagepipeline/bitmaps/HoneycombBitmapFactory;->mImmutableBitmapFallback:Z
if-eqz v0, :cond_9
.line 2
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
.line 3
: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
.line 4
: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
.line 5
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
.line 6
:try_start_1b
iget-object v2, p0, Lcom/facebook/imagepipeline/bitmaps/HoneycombBitmapFactory;->mPurgeableDecoder:Lcom/facebook/imagepipeline/platform/PlatformDecoder;
const/4 v3, 0x0
.line 7
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
.line 8
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
.line 9
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
.line 10
invoke-static {v2}, Lcom/facebook/common/references/CloseableReference;->closeSafely(Lcom/facebook/common/references/CloseableReference;)V
.line 11
iput-boolean v4, p0, Lcom/facebook/imagepipeline/bitmaps/HoneycombBitmapFactory;->mImmutableBitmapFallback:Z
.line 12
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
.line 13
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
.line 14
: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
.line 15
invoke-virtual {v0}, Lcom/facebook/common/references/CloseableReference;->close()V
return-object p1
.line 16
: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
.line 17
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
.line 18
: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
.line 19
invoke-virtual {v0}, Lcom/facebook/common/references/CloseableReference;->close()V
return-object v2
:catchall_6a
move-exception p1
.line 20
:try_start_6b
invoke-static {v1}, Lcom/facebook/imagepipeline/image/EncodedImage;->closeSafely(Lcom/facebook/imagepipeline/image/EncodedImage;)V
.line 21
throw p1
:try_end_6f
.catchall {:try_start_6b .. :try_end_6f} :catchall_6f
:catchall_6f
move-exception p1
.line 22
invoke-virtual {v0}, Lcom/facebook/common/references/CloseableReference;->close()V
.line 23
throw p1
.end method