b.smali

.class public final Lc9/b;
.super Ljava/lang/Object;
.source "BarCodeUtils.kt"


# annotations
.annotation runtime Lkotlin/Metadata;
    bv = {
        0x1,
        0x0,
        0x3
    }
    d1 = {
        "\u00000\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\u0008\u0002\n\u0002\u0010\u000e\n\u0000\n\u0002\u0018\u0002\n\u0002\u0008\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0008\n\u0002\u0008\u0002\n\u0002\u0018\u0002\n\u0002\u0008\u0004\u0008\u00c6\u0002\u0018\u00002\u00020\u0001B\u0007\u0008\u0002\u00a2\u0006\u0002\u0010\u0002J*\u0010\u0005\u001a\u0004\u0018\u00010\u00062\u0006\u0010\u0007\u001a\u00020\u00042\u0006\u0010\u0008\u001a\u00020\t2\u0006\u0010\n\u001a\u00020\u000b2\u0006\u0010\u000c\u001a\u00020\u000bH\u0002J \u0010\r\u001a\u0004\u0018\u00010\u000e2\u0006\u0010\u0007\u001a\u00020\u00042\u0006\u0010\n\u001a\u00020\u000b2\u0006\u0010\u000c\u001a\u00020\u000bJ\u0018\u0010\u000f\u001a\u00020\u000b2\u0006\u0010\u0007\u001a\u00020\u00042\u0006\u0010\n\u001a\u00020\u000bH\u0002J\u0012\u0010\u0010\u001a\u0004\u0018\u00010\u000e2\u0006\u0010\u0011\u001a\u00020\u0006H\u0002R\u000e\u0010\u0003\u001a\u00020\u0004X\u0082T\u00a2\u0006\u0002\n\u0000\u00a8\u0006\u0012"
    }
    d2 = {
        "Lcom/shopee/android/base/common/BarCodeUtils;",
        "",
        "()V",
        "TAG",
        "",
        "encode",
        "Lcom/google/zxing/common/BitMatrix;",
        "data",
        "format",
        "Lcom/google/zxing/BarcodeFormat;",
        "desireWidth",
        "",
        "desireHeight",
        "generateBarCode",
        "Landroid/graphics/Bitmap;",
        "getOutputWidth",
        "matrixToBitmap",
        "matrix",
        "base_release"
    }
    k = 0x1
    mv = {
        0x1,
        0x1,
        0x10
    }
.end annotation


# static fields
.field public static final a:Lc9/b;


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

    new-instance v0, Lc9/b;

    invoke-direct {v0}, Lc9/b;-><init>()V

    sput-object v0, Lc9/b;->a:Lc9/b;

    return-void
.end method

.method public constructor <init>()V
    .registers 1

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

    return-void
.end method


# virtual methods
.method public final a(Ljava/lang/String;I)I
    .registers 4

    new-instance v0, Lcom/google/zxing/oned/Code128Writer;

    invoke-direct {v0}, Lcom/google/zxing/oned/Code128Writer;-><init>()V

    invoke-virtual {v0, p1}, Lcom/google/zxing/oned/Code128Writer;->a(Ljava/lang/String;)[Z

    move-result-object p1

    array-length p1, p1

    invoke-static {p2, p1}, Ljava/lang/Math;->max(II)I

    move-result p2

    rem-int p1, p2, p1

    sub-int/2addr p2, p1

    return p2
.end method

.method public final a(Lj6/b;)Landroid/graphics/Bitmap;
    .registers 11

    invoke-virtual {p1}, Lj6/b;->c()I

    move-result v6

    invoke-virtual {p1}, Lj6/b;->b()I

    move-result v7

    mul-int v0, v6, v7

    new-array v1, v0, [I

    const/4 v0, 0x0

    const/4 v2, 0x0

    :goto_e
    if-ge v2, v7, :cond_29

    mul-int v3, v2, v6

    const/4 v4, 0x0

    :goto_13
    if-ge v4, v6, :cond_26

    add-int v5, v3, v4

    invoke-virtual {p1, v4, v2}, Lj6/b;->b(II)Z

    move-result v8

    if-eqz v8, :cond_20

    const/high16 v8, -0x1000000

    goto :goto_21

    :cond_20
    const/4 v8, -0x1

    :goto_21
    aput v8, v1, v5

    add-int/lit8 v4, v4, 0x1

    goto :goto_13

    :cond_26
    add-int/lit8 v2, v2, 0x1

    goto :goto_e

    :cond_29
    :try_start_29
    sget-object p1, Landroid/graphics/Bitmap$Config;->RGB_565:Landroid/graphics/Bitmap$Config;

    invoke-static {v6, v7, p1}, Landroid/graphics/Bitmap;->createBitmap(IILandroid/graphics/Bitmap$Config;)Landroid/graphics/Bitmap;

    move-result-object p1

    const/4 v2, 0x0

    const/4 v4, 0x0

    const/4 v5, 0x0

    move-object v0, p1

    move v3, v6

    invoke-virtual/range {v0 .. v7}, Landroid/graphics/Bitmap;->setPixels([IIIIIII)V
    :try_end_37
    .catch Ljava/lang/IllegalArgumentException; {:try_start_29 .. :try_end_37} :catch_38

    goto :goto_46

    :catch_38
    move-exception p1

    sget-object v0, Lqa/d;->e:Lqa/d$a;

    new-instance v1, Lc9/b$b;

    invoke-direct {v1, p1}, Lc9/b$b;-><init>(Ljava/lang/IllegalArgumentException;)V

    const-string p1, "BarCodeUtils"

    invoke-virtual {v0, p1, v1}, Lqa/d$a;->b(Ljava/lang/String;Lkotlin/jvm/functions/Function0;)V

    const/4 p1, 0x0

    :goto_46
    return-object p1
.end method

.method public final a(Ljava/lang/String;II)Landroid/graphics/Bitmap;
    .registers 5

    sget-object v0, Lcom/google/zxing/BarcodeFormat;->CODE_128:Lcom/google/zxing/BarcodeFormat;

    invoke-virtual {p0, p1, v0, p2, p3}, Lc9/b;->a(Ljava/lang/String;Lcom/google/zxing/BarcodeFormat;II)Lj6/b;

    move-result-object p1

    if-eqz p1, :cond_f

    sget-object p2, Lc9/b;->a:Lc9/b;

    invoke-virtual {p2, p1}, Lc9/b;->a(Lj6/b;)Landroid/graphics/Bitmap;

    move-result-object p1

    goto :goto_10

    :cond_f
    const/4 p1, 0x0

    :goto_10
    return-object p1
.end method

.method public final a(Ljava/lang/String;Lcom/google/zxing/BarcodeFormat;II)Lj6/b;
    .registers 12

    :try_start_0
    sget-object v0, Lcom/google/zxing/EncodeHintType;->MARGIN:Lcom/google/zxing/EncodeHintType;

    const/4 v1, 0x0

    invoke-static {v1}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v1

    invoke-static {v0, v1}, Lkotlin/TuplesKt;->to(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;

    move-result-object v0

    invoke-static {v0}, Lkotlin/collections/MapsKt__MapsJVMKt;->mapOf(Lkotlin/Pair;)Ljava/util/Map;

    move-result-object v6

    new-instance v1, Lg6/c;

    invoke-direct {v1}, Lg6/c;-><init>()V

    invoke-virtual {p0, p1, p3}, Lc9/b;->a(Ljava/lang/String;I)I

    move-result v4

    move-object v2, p1

    move-object v3, p2

    move v5, p4

    invoke-virtual/range {v1 .. v6}, Lg6/c;->a(Ljava/lang/String;Lcom/google/zxing/BarcodeFormat;IILjava/util/Map;)Lj6/b;

    move-result-object p1
    :try_end_1f
    .catch Lg6/g; {:try_start_0 .. :try_end_1f} :catch_20

    goto :goto_2e

    :catch_20
    move-exception p1

    sget-object p2, Lqa/d;->e:Lqa/d$a;

    new-instance p3, Lc9/b$a;

    invoke-direct {p3, p1}, Lc9/b$a;-><init>(Lg6/g;)V

    const-string p1, "BarCodeUtils"

    invoke-virtual {p2, p1, p3}, Lqa/d$a;->b(Ljava/lang/String;Lkotlin/jvm/functions/Function0;)V

    const/4 p1, 0x0

    :goto_2e
    return-object p1
.end method