r.smali

.class public final Lcom/bumptech/glide/load/resource/c/r;
.super Ljava/lang/Object;
.source "GifResourceEncoder.java"

# interfaces
.implements Lcom/bumptech/glide/load/e;


# annotations
.annotation system Ldalvik/annotation/Signature;
    value = {
        "Ljava/lang/Object;",
        "Lcom/bumptech/glide/load/e",
        "<",
        "Lcom/bumptech/glide/load/resource/c/b;",
        ">;"
    }
.end annotation


# instance fields
.field private final BG:Lcom/bumptech/glide/load/engine/a/e;

.field private final Is:Lcom/bumptech/glide/b/b;


# direct methods
.method static constructor <clinit>()V
    .registers 1

    .prologue
    .line 26
    new-instance v0, Lcom/bumptech/glide/load/resource/c/s;

    invoke-direct {v0}, Lcom/bumptech/glide/load/resource/c/s;-><init>()V

    return-void
.end method

.method public constructor <init>(Lcom/bumptech/glide/load/engine/a/e;)V
    .registers 3

    .prologue
    .line 33
    const/4 v0, 0x0

    invoke-direct {p0, p1, v0}, Lcom/bumptech/glide/load/resource/c/r;-><init>(Lcom/bumptech/glide/load/engine/a/e;B)V

    .line 34
    return-void
.end method

.method private constructor <init>(Lcom/bumptech/glide/load/engine/a/e;B)V
    .registers 4

    .prologue
    .line 37
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 38
    iput-object p1, p0, Lcom/bumptech/glide/load/resource/c/r;->BG:Lcom/bumptech/glide/load/engine/a/e;

    .line 39
    new-instance v0, Lcom/bumptech/glide/load/resource/c/a;

    invoke-direct {v0, p1}, Lcom/bumptech/glide/load/resource/c/a;-><init>(Lcom/bumptech/glide/load/engine/a/e;)V

    iput-object v0, p0, Lcom/bumptech/glide/load/resource/c/r;->Is:Lcom/bumptech/glide/b/b;

    .line 41
    return-void
.end method

.method private a(Lcom/bumptech/glide/load/engine/u;Ljava/io/OutputStream;)Z
    .registers 14
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Lcom/bumptech/glide/load/engine/u",
            "<",
            "Lcom/bumptech/glide/load/resource/c/b;",
            ">;",
            "Ljava/io/OutputStream;",
            ")Z"
        }
    .end annotation

    .prologue
    const/4 v3, 0x0

    .line 45
    invoke-static {}, Lcom/bumptech/glide/g/d;->eK()J

    move-result-wide v4

    .line 47
    invoke-interface {p1}, Lcom/bumptech/glide/load/engine/u;->get()Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lcom/bumptech/glide/load/resource/c/b;

    .line 1128
    iget-object v1, v0, Lcom/bumptech/glide/load/resource/c/b;->HQ:Lcom/bumptech/glide/load/resource/c/c;

    iget-object v6, v1, Lcom/bumptech/glide/load/resource/c/c;->HX:Lcom/bumptech/glide/load/f;

    .line 49
    instance-of v1, v6, Lcom/bumptech/glide/load/resource/d;

    if-eqz v1, :cond_1c

    .line 1132
    iget-object v0, v0, Lcom/bumptech/glide/load/resource/c/b;->HQ:Lcom/bumptech/glide/load/resource/c/c;

    iget-object v0, v0, Lcom/bumptech/glide/load/resource/c/c;->data:[B

    .line 50
    invoke-static {v0, p2}, Lcom/bumptech/glide/load/resource/c/r;->a([BLjava/io/OutputStream;)Z

    move-result v3

    .line 84
    :cond_1b
    :goto_1b
    return v3

    .line 2132
    :cond_1c
    iget-object v1, v0, Lcom/bumptech/glide/load/resource/c/b;->HQ:Lcom/bumptech/glide/load/resource/c/c;

    iget-object v1, v1, Lcom/bumptech/glide/load/resource/c/c;->data:[B

    .line 3137
    new-instance v2, Lcom/bumptech/glide/b/e;

    invoke-direct {v2}, Lcom/bumptech/glide/b/e;-><init>()V

    .line 3102
    invoke-virtual {v2, v1}, Lcom/bumptech/glide/b/e;->b([B)Lcom/bumptech/glide/b/e;

    .line 3103
    invoke-virtual {v2}, Lcom/bumptech/glide/b/e;->dw()Lcom/bumptech/glide/b/d;

    move-result-object v2

    .line 3105
    iget-object v7, p0, Lcom/bumptech/glide/load/resource/c/r;->Is:Lcom/bumptech/glide/b/b;

    .line 4133
    new-instance v8, Lcom/bumptech/glide/b/a;

    invoke-direct {v8, v7}, Lcom/bumptech/glide/b/a;-><init>(Lcom/bumptech/glide/b/b;)V

    .line 3106
    invoke-virtual {v8, v2, v1}, Lcom/bumptech/glide/b/a;->a(Lcom/bumptech/glide/b/d;[B)V

    .line 3107
    invoke-virtual {v8}, Lcom/bumptech/glide/b/a;->advance()V

    .line 4141
    new-instance v7, Lcom/bumptech/glide/c/a;

    invoke-direct {v7}, Lcom/bumptech/glide/c/a;-><init>()V

    .line 56
    invoke-virtual {v7, p2}, Lcom/bumptech/glide/c/a;->a(Ljava/io/OutputStream;)Z

    move-result v1

    if-eqz v1, :cond_1b

    move v2, v3

    .line 4221
    :goto_45
    iget-object v1, v8, Lcom/bumptech/glide/b/a;->Do:Lcom/bumptech/glide/b/d;

    iget v1, v1, Lcom/bumptech/glide/b/d;->DE:I

    .line 60
    if-ge v2, v1, :cond_9a

    .line 61
    invoke-virtual {v8}, Lcom/bumptech/glide/b/a;->dt()Landroid/graphics/Bitmap;

    move-result-object v1

    .line 5115
    iget-object v9, p0, Lcom/bumptech/glide/load/resource/c/r;->BG:Lcom/bumptech/glide/load/engine/a/e;

    .line 5145
    new-instance v10, Lcom/bumptech/glide/load/resource/bitmap/c;

    invoke-direct {v10, v1, v9}, Lcom/bumptech/glide/load/resource/bitmap/c;-><init>(Landroid/graphics/Bitmap;Lcom/bumptech/glide/load/engine/a/e;)V

    .line 5116
    invoke-virtual {v0}, Lcom/bumptech/glide/load/resource/c/b;->getIntrinsicWidth()I

    move-result v1

    invoke-virtual {v0}, Lcom/bumptech/glide/load/resource/c/b;->getIntrinsicHeight()I

    move-result v9

    invoke-interface {v6, v10, v1, v9}, Lcom/bumptech/glide/load/f;->a(Lcom/bumptech/glide/load/engine/u;II)Lcom/bumptech/glide/load/engine/u;

    move-result-object v9

    .line 5118
    invoke-virtual {v10, v9}, Ljava/lang/Object;->equals(Ljava/lang/Object;)Z

    move-result v1

    if-nez v1, :cond_6b

    .line 5119
    invoke-interface {v10}, Lcom/bumptech/glide/load/engine/u;->recycle()V

    .line 64
    :cond_6b
    :try_start_6b
    invoke-interface {v9}, Lcom/bumptech/glide/load/engine/u;->get()Ljava/lang/Object;

    move-result-object v1

    check-cast v1, Landroid/graphics/Bitmap;

    invoke-virtual {v7, v1}, Lcom/bumptech/glide/c/a;->b(Landroid/graphics/Bitmap;)Z
    :try_end_74
    .catchall {:try_start_6b .. :try_end_74} :catchall_95

    move-result v1

    if-nez v1, :cond_7b

    .line 73
    invoke-interface {v9}, Lcom/bumptech/glide/load/engine/u;->recycle()V

    goto :goto_1b

    .line 5230
    :cond_7b
    :try_start_7b
    iget v1, v8, Lcom/bumptech/glide/b/a;->Dn:I

    .line 68
    invoke-virtual {v8, v1}, Lcom/bumptech/glide/b/a;->ah(I)I

    move-result v1

    .line 6094
    int-to-float v1, v1

    const/high16 v10, 0x41200000    # 10.0f

    div-float/2addr v1, v10

    invoke-static {v1}, Ljava/lang/Math;->round(F)I

    move-result v1

    iput v1, v7, Lcom/bumptech/glide/c/a;->delay:I

    .line 71
    invoke-virtual {v8}, Lcom/bumptech/glide/b/a;->advance()V
    :try_end_8e
    .catchall {:try_start_7b .. :try_end_8e} :catchall_95

    .line 73
    invoke-interface {v9}, Lcom/bumptech/glide/load/engine/u;->recycle()V

    .line 60
    add-int/lit8 v1, v2, 0x1

    move v2, v1

    goto :goto_45

    .line 73
    :catchall_95
    move-exception v0

    invoke-interface {v9}, Lcom/bumptech/glide/load/engine/u;->recycle()V

    throw v0

    .line 77
    :cond_9a
    invoke-virtual {v7}, Lcom/bumptech/glide/c/a;->dC()Z

    move-result v3

    .line 79
    const-string v1, "GifEncoder"

    const/4 v2, 0x2

    invoke-static {v1, v2}, Landroid/util/Log;->isLoggable(Ljava/lang/String;I)Z

    move-result v1

    if-eqz v1, :cond_1b

    .line 80
    new-instance v1, Ljava/lang/StringBuilder;

    const-string v2, "Encoded gif with "

    invoke-direct {v1, v2}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    .line 6221
    iget-object v2, v8, Lcom/bumptech/glide/b/a;->Do:Lcom/bumptech/glide/b/d;

    iget v2, v2, Lcom/bumptech/glide/b/d;->DE:I

    .line 80
    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    move-result-object v1

    const-string v2, " frames and "

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    .line 7132
    iget-object v0, v0, Lcom/bumptech/glide/load/resource/c/b;->HQ:Lcom/bumptech/glide/load/resource/c/c;

    iget-object v0, v0, Lcom/bumptech/glide/load/resource/c/c;->data:[B

    .line 80
    array-length v0, v0

    invoke-virtual {v1, v0}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    move-result-object v0

    const-string v1, " bytes in "

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    invoke-static {v4, v5}, Lcom/bumptech/glide/g/d;->e(J)D

    move-result-wide v4

    invoke-virtual {v0, v4, v5}, Ljava/lang/StringBuilder;->append(D)Ljava/lang/StringBuilder;

    move-result-object v0

    const-string v1, " ms"

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    goto/16 :goto_1b
.end method

.method private static a([BLjava/io/OutputStream;)Z
    .registers 3

    .prologue
    .line 88
    const/4 v0, 0x1

    .line 90
    :try_start_1
    invoke-virtual {p1, p0}, Ljava/io/OutputStream;->write([B)V
    :try_end_4
    .catch Ljava/io/IOException; {:try_start_1 .. :try_end_4} :catch_5

    .line 97
    :goto_4
    return v0

    .line 95
    :catch_5
    move-exception v0

    const/4 v0, 0x0

    goto :goto_4
.end method


# virtual methods
.method public final bridge synthetic a(Ljava/lang/Object;Ljava/io/OutputStream;)Z
    .registers 4

    .prologue
    .line 25
    check-cast p1, Lcom/bumptech/glide/load/engine/u;

    invoke-direct {p0, p1, p2}, Lcom/bumptech/glide/load/resource/c/r;->a(Lcom/bumptech/glide/load/engine/u;Ljava/io/OutputStream;)Z

    move-result v0

    return v0
.end method

.method public final getId()Ljava/lang/String;
    .registers 2

    .prologue
    .line 126
    const-string v0, ""

    return-object v0
.end method