今奥全景相机
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

704 lines
15 KiB

.class abstract Lcom/via/gpuimage/GPUImage$LoadImageTask;
.super Landroid/os/AsyncTask;
.source "GPUImage.java"
# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
value = Lcom/via/gpuimage/GPUImage;
.end annotation
.annotation system Ldalvik/annotation/InnerClass;
accessFlags = 0x402
name = "LoadImageTask"
.end annotation
.annotation system Ldalvik/annotation/Signature;
value = {
"Landroid/os/AsyncTask",
"<",
"Ljava/lang/Void;",
"Ljava/lang/Void;",
"Landroid/graphics/Bitmap;",
">;"
}
.end annotation
# instance fields
.field private final mGPUImage:Lcom/via/gpuimage/GPUImage;
.field private mOutputHeight:I
.field private mOutputWidth:I
.field final synthetic this$0:Lcom/via/gpuimage/GPUImage;
# direct methods
.method public constructor <init>(Lcom/via/gpuimage/GPUImage;Lcom/via/gpuimage/GPUImage;)V
.locals 0
.prologue
.line 557
iput-object p1, p0, Lcom/via/gpuimage/GPUImage$LoadImageTask;->this$0:Lcom/via/gpuimage/GPUImage;
invoke-direct {p0}, Landroid/os/AsyncTask;-><init>()V
.line 558
iput-object p2, p0, Lcom/via/gpuimage/GPUImage$LoadImageTask;->mGPUImage:Lcom/via/gpuimage/GPUImage;
.line 559
return-void
.end method
.method private checkSize(ZZ)Z
.locals 4
.prologue
const/4 v0, 0x1
const/4 v1, 0x0
.line 667
iget-object v2, p0, Lcom/via/gpuimage/GPUImage$LoadImageTask;->this$0:Lcom/via/gpuimage/GPUImage;
invoke-static {v2}, Lcom/via/gpuimage/GPUImage;->access$700(Lcom/via/gpuimage/GPUImage;)Lcom/via/gpuimage/GPUImage$ScaleType;
move-result-object v2
sget-object v3, Lcom/via/gpuimage/GPUImage$ScaleType;->CENTER_CROP:Lcom/via/gpuimage/GPUImage$ScaleType;
if-ne v2, v3, :cond_1
.line 668
if-eqz p1, :cond_0
if-eqz p2, :cond_0
.line 670
:goto_0
return v0
:cond_0
move v0, v1
.line 668
goto :goto_0
.line 670
:cond_1
if-nez p1, :cond_2
if-eqz p2, :cond_3
:cond_2
move v1, v0
:cond_3
move v0, v1
goto :goto_0
.end method
.method private getScaleSize(II)[I
.locals 6
.prologue
const/4 v2, 0x1
const/4 v3, 0x0
.line 650
int-to-float v0, p1
iget v1, p0, Lcom/via/gpuimage/GPUImage$LoadImageTask;->mOutputWidth:I
int-to-float v1, v1
div-float/2addr v0, v1
.line 651
int-to-float v1, p2
iget v4, p0, Lcom/via/gpuimage/GPUImage$LoadImageTask;->mOutputHeight:I
int-to-float v4, v4
div-float/2addr v1, v4
.line 653
iget-object v4, p0, Lcom/via/gpuimage/GPUImage$LoadImageTask;->this$0:Lcom/via/gpuimage/GPUImage;
invoke-static {v4}, Lcom/via/gpuimage/GPUImage;->access$700(Lcom/via/gpuimage/GPUImage;)Lcom/via/gpuimage/GPUImage$ScaleType;
move-result-object v4
sget-object v5, Lcom/via/gpuimage/GPUImage$ScaleType;->CENTER_CROP:Lcom/via/gpuimage/GPUImage$ScaleType;
if-ne v4, v5, :cond_1
cmpl-float v0, v0, v1
if-lez v0, :cond_0
move v0, v2
.line 656
:goto_0
if-eqz v0, :cond_3
.line 657
iget v0, p0, Lcom/via/gpuimage/GPUImage$LoadImageTask;->mOutputHeight:I
int-to-float v0, v0
.line 658
int-to-float v1, p2
div-float v1, v0, v1
int-to-float v4, p1
mul-float/2addr v1, v4
.line 663
:goto_1
const/4 v4, 0x2
new-array v4, v4, [I
invoke-static {v1}, Ljava/lang/Math;->round(F)I
move-result v1
aput v1, v4, v3
invoke-static {v0}, Ljava/lang/Math;->round(F)I
move-result v0
aput v0, v4, v2
return-object v4
:cond_0
move v0, v3
.line 653
goto :goto_0
:cond_1
cmpg-float v0, v0, v1
if-gez v0, :cond_2
move v0, v2
goto :goto_0
:cond_2
move v0, v3
goto :goto_0
.line 660
:cond_3
iget v0, p0, Lcom/via/gpuimage/GPUImage$LoadImageTask;->mOutputWidth:I
int-to-float v1, v0
.line 661
int-to-float v0, p1
div-float v0, v1, v0
int-to-float v4, p2
mul-float/2addr v0, v4
goto :goto_1
.end method
.method private loadResizedImage()Landroid/graphics/Bitmap;
.locals 7
.prologue
const/4 v3, 0x0
const/4 v1, 0x1
.line 587
new-instance v5, Landroid/graphics/BitmapFactory$Options;
invoke-direct {v5}, Landroid/graphics/BitmapFactory$Options;-><init>()V
.line 588
iput-boolean v1, v5, Landroid/graphics/BitmapFactory$Options;->inJustDecodeBounds:Z
.line 589
invoke-virtual {p0, v5}, Lcom/via/gpuimage/GPUImage$LoadImageTask;->decode(Landroid/graphics/BitmapFactory$Options;)Landroid/graphics/Bitmap;
move v0, v1
.line 591
:goto_0
iget v2, v5, Landroid/graphics/BitmapFactory$Options;->outWidth:I
div-int/2addr v2, v0
iget v4, p0, Lcom/via/gpuimage/GPUImage$LoadImageTask;->mOutputWidth:I
if-le v2, v4, :cond_0
move v2, v1
:goto_1
iget v4, v5, Landroid/graphics/BitmapFactory$Options;->outHeight:I
div-int/2addr v4, v0
iget v6, p0, Lcom/via/gpuimage/GPUImage$LoadImageTask;->mOutputHeight:I
if-le v4, v6, :cond_1
move v4, v1
:goto_2
invoke-direct {p0, v2, v4}, Lcom/via/gpuimage/GPUImage$LoadImageTask;->checkSize(ZZ)Z
move-result v2
if-eqz v2, :cond_2
.line 592
add-int/lit8 v0, v0, 0x1
goto :goto_0
:cond_0
move v2, v3
.line 591
goto :goto_1
:cond_1
move v4, v3
goto :goto_2
.line 595
:cond_2
add-int/lit8 v0, v0, -0x1
.line 596
if-ge v0, v1, :cond_3
move v0, v1
.line 599
:cond_3
new-instance v2, Landroid/graphics/BitmapFactory$Options;
invoke-direct {v2}, Landroid/graphics/BitmapFactory$Options;-><init>()V
.line 600
iput v0, v2, Landroid/graphics/BitmapFactory$Options;->inSampleSize:I
.line 601
sget-object v0, Landroid/graphics/Bitmap$Config;->RGB_565:Landroid/graphics/Bitmap$Config;
iput-object v0, v2, Landroid/graphics/BitmapFactory$Options;->inPreferredConfig:Landroid/graphics/Bitmap$Config;
.line 602
iput-boolean v1, v2, Landroid/graphics/BitmapFactory$Options;->inPurgeable:Z
.line 603
const v0, 0x8000
new-array v0, v0, [B
iput-object v0, v2, Landroid/graphics/BitmapFactory$Options;->inTempStorage:[B
.line 604
invoke-virtual {p0, v2}, Lcom/via/gpuimage/GPUImage$LoadImageTask;->decode(Landroid/graphics/BitmapFactory$Options;)Landroid/graphics/Bitmap;
move-result-object v0
.line 605
if-nez v0, :cond_4
.line 606
const/4 v0, 0x0
.line 610
:goto_3
return-object v0
.line 608
:cond_4
invoke-direct {p0, v0}, Lcom/via/gpuimage/GPUImage$LoadImageTask;->rotateImage(Landroid/graphics/Bitmap;)Landroid/graphics/Bitmap;
move-result-object v0
.line 609
invoke-direct {p0, v0}, Lcom/via/gpuimage/GPUImage$LoadImageTask;->scaleBitmap(Landroid/graphics/Bitmap;)Landroid/graphics/Bitmap;
move-result-object v0
goto :goto_3
.end method
.method private rotateImage(Landroid/graphics/Bitmap;)Landroid/graphics/Bitmap;
.locals 7
.prologue
.line 675
if-nez p1, :cond_1
.line 676
const/4 p1, 0x0
.line 691
:cond_0
:goto_0
return-object p1
.line 680
:cond_1
:try_start_0
invoke-virtual {p0}, Lcom/via/gpuimage/GPUImage$LoadImageTask;->getImageOrientation()I
move-result v0
.line 681
if-eqz v0, :cond_0
.line 682
new-instance v5, Landroid/graphics/Matrix;
invoke-direct {v5}, Landroid/graphics/Matrix;-><init>()V
.line 683
int-to-float v0, v0
invoke-virtual {v5, v0}, Landroid/graphics/Matrix;->postRotate(F)Z
.line 684
const/4 v1, 0x0
const/4 v2, 0x0
invoke-virtual {p1}, Landroid/graphics/Bitmap;->getWidth()I
move-result v3
.line 685
invoke-virtual {p1}, Landroid/graphics/Bitmap;->getHeight()I
move-result v4
const/4 v6, 0x1
move-object v0, p1
.line 684
invoke-static/range {v0 .. v6}, Landroid/graphics/Bitmap;->createBitmap(Landroid/graphics/Bitmap;IIIILandroid/graphics/Matrix;Z)Landroid/graphics/Bitmap;
:try_end_0
.catch Ljava/io/IOException; {:try_start_0 .. :try_end_0} :catch_0
move-result-object v0
.line 686
:try_start_1
invoke-virtual {p1}, Landroid/graphics/Bitmap;->recycle()V
:try_end_1
.catch Ljava/io/IOException; {:try_start_1 .. :try_end_1} :catch_1
move-object p1, v0
goto :goto_0
.line 688
:catch_0
move-exception v0
.line 689
:goto_1
invoke-virtual {v0}, Ljava/io/IOException;->printStackTrace()V
goto :goto_0
.line 688
:catch_1
move-exception v1
move-object p1, v0
move-object v0, v1
goto :goto_1
.end method
.method private scaleBitmap(Landroid/graphics/Bitmap;)Landroid/graphics/Bitmap;
.locals 7
.prologue
const/4 v5, 0x0
const/4 v6, 0x1
.line 615
invoke-virtual {p1}, Landroid/graphics/Bitmap;->getWidth()I
move-result v0
.line 616
invoke-virtual {p1}, Landroid/graphics/Bitmap;->getHeight()I
move-result v1
.line 617
invoke-direct {p0, v0, v1}, Lcom/via/gpuimage/GPUImage$LoadImageTask;->getScaleSize(II)[I
move-result-object v1
.line 618
aget v0, v1, v5
aget v2, v1, v6
invoke-static {p1, v0, v2, v6}, Landroid/graphics/Bitmap;->createScaledBitmap(Landroid/graphics/Bitmap;IIZ)Landroid/graphics/Bitmap;
move-result-object v0
.line 619
if-eq v0, p1, :cond_0
.line 620
invoke-virtual {p1}, Landroid/graphics/Bitmap;->recycle()V
move-object p1, v0
.line 622
invoke-static {}, Ljava/lang/System;->gc()V
.line 625
:cond_0
iget-object v0, p0, Lcom/via/gpuimage/GPUImage$LoadImageTask;->this$0:Lcom/via/gpuimage/GPUImage;
invoke-static {v0}, Lcom/via/gpuimage/GPUImage;->access$700(Lcom/via/gpuimage/GPUImage;)Lcom/via/gpuimage/GPUImage$ScaleType;
move-result-object v0
sget-object v2, Lcom/via/gpuimage/GPUImage$ScaleType;->CENTER_CROP:Lcom/via/gpuimage/GPUImage$ScaleType;
if-ne v0, v2, :cond_1
.line 627
aget v0, v1, v5
iget v2, p0, Lcom/via/gpuimage/GPUImage$LoadImageTask;->mOutputWidth:I
sub-int/2addr v0, v2
.line 628
aget v2, v1, v6
iget v3, p0, Lcom/via/gpuimage/GPUImage$LoadImageTask;->mOutputHeight:I
sub-int/2addr v2, v3
.line 629
div-int/lit8 v3, v0, 0x2
div-int/lit8 v4, v2, 0x2
aget v5, v1, v5
sub-int v0, v5, v0
aget v1, v1, v6
sub-int/2addr v1, v2
invoke-static {p1, v3, v4, v0, v1}, Landroid/graphics/Bitmap;->createBitmap(Landroid/graphics/Bitmap;IIII)Landroid/graphics/Bitmap;
move-result-object v0
.line 631
if-eq v0, p1, :cond_1
.line 632
invoke-virtual {p1}, Landroid/graphics/Bitmap;->recycle()V
move-object p1, v0
.line 637
:cond_1
return-object p1
.end method
# virtual methods
.method protected abstract decode(Landroid/graphics/BitmapFactory$Options;)Landroid/graphics/Bitmap;
.end method
.method protected varargs doInBackground([Ljava/lang/Void;)Landroid/graphics/Bitmap;
.locals 4
.prologue
.line 563
iget-object v0, p0, Lcom/via/gpuimage/GPUImage$LoadImageTask;->this$0:Lcom/via/gpuimage/GPUImage;
invoke-static {v0}, Lcom/via/gpuimage/GPUImage;->access$400(Lcom/via/gpuimage/GPUImage;)Lcom/via/gpuimage/GPUImageRenderer;
move-result-object v0
if-eqz v0, :cond_0
iget-object v0, p0, Lcom/via/gpuimage/GPUImage$LoadImageTask;->this$0:Lcom/via/gpuimage/GPUImage;
invoke-static {v0}, Lcom/via/gpuimage/GPUImage;->access$400(Lcom/via/gpuimage/GPUImage;)Lcom/via/gpuimage/GPUImageRenderer;
move-result-object v0
invoke-virtual {v0}, Lcom/via/gpuimage/GPUImageRenderer;->getFrameWidth()I
move-result v0
if-nez v0, :cond_0
.line 565
:try_start_0
iget-object v0, p0, Lcom/via/gpuimage/GPUImage$LoadImageTask;->this$0:Lcom/via/gpuimage/GPUImage;
invoke-static {v0}, Lcom/via/gpuimage/GPUImage;->access$400(Lcom/via/gpuimage/GPUImage;)Lcom/via/gpuimage/GPUImageRenderer;
move-result-object v0
iget-object v1, v0, Lcom/via/gpuimage/GPUImageRenderer;->mSurfaceChangedWaiter:Ljava/lang/Object;
monitor-enter v1
:try_end_0
.catch Ljava/lang/InterruptedException; {:try_start_0 .. :try_end_0} :catch_0
.line 566
:try_start_1
iget-object v0, p0, Lcom/via/gpuimage/GPUImage$LoadImageTask;->this$0:Lcom/via/gpuimage/GPUImage;
invoke-static {v0}, Lcom/via/gpuimage/GPUImage;->access$400(Lcom/via/gpuimage/GPUImage;)Lcom/via/gpuimage/GPUImageRenderer;
move-result-object v0
iget-object v0, v0, Lcom/via/gpuimage/GPUImageRenderer;->mSurfaceChangedWaiter:Ljava/lang/Object;
const-wide/16 v2, 0xbb8
invoke-virtual {v0, v2, v3}, Ljava/lang/Object;->wait(J)V
.line 567
monitor-exit v1
:try_end_1
.catchall {:try_start_1 .. :try_end_1} :catchall_0
.line 572
:cond_0
:goto_0
iget-object v0, p0, Lcom/via/gpuimage/GPUImage$LoadImageTask;->this$0:Lcom/via/gpuimage/GPUImage;
invoke-static {v0}, Lcom/via/gpuimage/GPUImage;->access$500(Lcom/via/gpuimage/GPUImage;)I
move-result v0
iput v0, p0, Lcom/via/gpuimage/GPUImage$LoadImageTask;->mOutputWidth:I
.line 573
iget-object v0, p0, Lcom/via/gpuimage/GPUImage$LoadImageTask;->this$0:Lcom/via/gpuimage/GPUImage;
invoke-static {v0}, Lcom/via/gpuimage/GPUImage;->access$600(Lcom/via/gpuimage/GPUImage;)I
move-result v0
iput v0, p0, Lcom/via/gpuimage/GPUImage$LoadImageTask;->mOutputHeight:I
.line 574
invoke-direct {p0}, Lcom/via/gpuimage/GPUImage$LoadImageTask;->loadResizedImage()Landroid/graphics/Bitmap;
move-result-object v0
return-object v0
.line 567
:catchall_0
move-exception v0
:try_start_2
monitor-exit v1
:try_end_2
.catchall {:try_start_2 .. :try_end_2} :catchall_0
:try_start_3
throw v0
:try_end_3
.catch Ljava/lang/InterruptedException; {:try_start_3 .. :try_end_3} :catch_0
.line 568
:catch_0
move-exception v0
.line 569
invoke-virtual {v0}, Ljava/lang/InterruptedException;->printStackTrace()V
goto :goto_0
.end method
.method protected bridge synthetic doInBackground([Ljava/lang/Object;)Ljava/lang/Object;
.locals 1
.prologue
.line 550
check-cast p1, [Ljava/lang/Void;
invoke-virtual {p0, p1}, Lcom/via/gpuimage/GPUImage$LoadImageTask;->doInBackground([Ljava/lang/Void;)Landroid/graphics/Bitmap;
move-result-object v0
return-object v0
.end method
.method protected abstract getImageOrientation()I
.end method
.method protected onPostExecute(Landroid/graphics/Bitmap;)V
.locals 1
.prologue
.line 579
invoke-super {p0, p1}, Landroid/os/AsyncTask;->onPostExecute(Ljava/lang/Object;)V
.line 580
iget-object v0, p0, Lcom/via/gpuimage/GPUImage$LoadImageTask;->mGPUImage:Lcom/via/gpuimage/GPUImage;
invoke-virtual {v0}, Lcom/via/gpuimage/GPUImage;->deleteImage()V
.line 581
iget-object v0, p0, Lcom/via/gpuimage/GPUImage$LoadImageTask;->mGPUImage:Lcom/via/gpuimage/GPUImage;
invoke-virtual {v0, p1}, Lcom/via/gpuimage/GPUImage;->setImage(Landroid/graphics/Bitmap;)V
.line 582
return-void
.end method
.method protected bridge synthetic onPostExecute(Ljava/lang/Object;)V
.locals 0
.prologue
.line 550
check-cast p1, Landroid/graphics/Bitmap;
invoke-virtual {p0, p1}, Lcom/via/gpuimage/GPUImage$LoadImageTask;->onPostExecute(Landroid/graphics/Bitmap;)V
return-void
.end method