Rabbit-R1/android (non root)/smali/smali_classes3/com/google/zxing/pdf417/PDF417Writer.smali
2024-05-21 17:08:36 -04:00

575 lines
13 KiB
Smali

.class public final Lcom/google/zxing/pdf417/PDF417Writer;
.super Ljava/lang/Object;
.source "PDF417Writer.java"
# interfaces
.implements Lcom/google/zxing/Writer;
# static fields
.field private static final DEFAULT_ERROR_CORRECTION_LEVEL:I = 0x2
.field private static final WHITE_SPACE:I = 0x1e
# direct methods
.method public constructor <init>()V
.locals 0
.line 35
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
return-void
.end method
.method private static bitMatrixFromBitArray([[BI)Lcom/google/zxing/common/BitMatrix;
.locals 8
.line 141
new-instance v0, Lcom/google/zxing/common/BitMatrix;
const/4 v1, 0x0
aget-object v2, p0, v1
array-length v2, v2
mul-int/lit8 v3, p1, 0x2
add-int/2addr v2, v3
array-length v4, p0
add-int/2addr v4, v3
invoke-direct {v0, v2, v4}, Lcom/google/zxing/common/BitMatrix;-><init>(II)V
.line 142
invoke-virtual {v0}, Lcom/google/zxing/common/BitMatrix;->clear()V
.line 143
invoke-virtual {v0}, Lcom/google/zxing/common/BitMatrix;->getHeight()I
move-result v2
sub-int/2addr v2, p1
const/4 v3, 0x1
sub-int/2addr v2, v3
move v4, v1
:goto_0
array-length v5, p0
if-ge v4, v5, :cond_2
.line 144
aget-object v5, p0, v4
move v6, v1
.line 145
:goto_1
aget-object v7, p0, v1
array-length v7, v7
if-ge v6, v7, :cond_1
.line 147
aget-byte v7, v5, v6
if-ne v7, v3, :cond_0
add-int v7, v6, p1
.line 148
invoke-virtual {v0, v7, v2}, Lcom/google/zxing/common/BitMatrix;->set(II)V
:cond_0
add-int/lit8 v6, v6, 0x1
goto :goto_1
:cond_1
add-int/lit8 v4, v4, 0x1
add-int/lit8 v2, v2, -0x1
goto :goto_0
:cond_2
return-object v0
.end method
.method private static bitMatrixFromEncoder(Lcom/google/zxing/pdf417/encoder/PDF417;Ljava/lang/String;IIII)Lcom/google/zxing/common/BitMatrix;
.locals 4
.annotation system Ldalvik/annotation/Throws;
value = {
Lcom/google/zxing/WriterException;
}
.end annotation
.line 107
invoke-virtual {p0, p1, p2}, Lcom/google/zxing/pdf417/encoder/PDF417;->generateBarcodeLogic(Ljava/lang/String;I)V
.line 110
invoke-virtual {p0}, Lcom/google/zxing/pdf417/encoder/PDF417;->getBarcodeMatrix()Lcom/google/zxing/pdf417/encoder/BarcodeMatrix;
move-result-object p1
const/4 p2, 0x4
const/4 v0, 0x1
invoke-virtual {p1, v0, p2}, Lcom/google/zxing/pdf417/encoder/BarcodeMatrix;->getScaledMatrix(II)[[B
move-result-object p1
const/4 p2, 0x0
if-le p4, p3, :cond_0
move v1, v0
goto :goto_0
:cond_0
move v1, p2
.line 112
:goto_0
aget-object v2, p1, p2
array-length v2, v2
array-length v3, p1
if-ge v2, v3, :cond_1
move v2, v0
goto :goto_1
:cond_1
move v2, p2
:goto_1
if-eq v1, v2, :cond_2
.line 113
invoke-static {p1}, Lcom/google/zxing/pdf417/PDF417Writer;->rotateArray([[B)[[B
move-result-object p1
move v1, v0
goto :goto_2
:cond_2
move v1, p2
.line 117
:goto_2
aget-object p2, p1, p2
array-length p2, p2
div-int/2addr p3, p2
.line 118
array-length p2, p1
div-int/2addr p4, p2
.line 119
invoke-static {p3, p4}, Ljava/lang/Math;->min(II)I
move-result p2
if-le p2, v0, :cond_4
.line 123
invoke-virtual {p0}, Lcom/google/zxing/pdf417/encoder/PDF417;->getBarcodeMatrix()Lcom/google/zxing/pdf417/encoder/BarcodeMatrix;
move-result-object p0
shl-int/lit8 p1, p2, 0x2
invoke-virtual {p0, p2, p1}, Lcom/google/zxing/pdf417/encoder/BarcodeMatrix;->getScaledMatrix(II)[[B
move-result-object p0
if-eqz v1, :cond_3
.line 125
invoke-static {p0}, Lcom/google/zxing/pdf417/PDF417Writer;->rotateArray([[B)[[B
move-result-object p0
.line 127
:cond_3
invoke-static {p0, p5}, Lcom/google/zxing/pdf417/PDF417Writer;->bitMatrixFromBitArray([[BI)Lcom/google/zxing/common/BitMatrix;
move-result-object p0
return-object p0
.line 129
:cond_4
invoke-static {p1, p5}, Lcom/google/zxing/pdf417/PDF417Writer;->bitMatrixFromBitArray([[BI)Lcom/google/zxing/common/BitMatrix;
move-result-object p0
return-object p0
.end method
.method private static rotateArray([[B)[[B
.locals 7
const/4 v0, 0x0
.line 159
aget-object v1, p0, v0
array-length v1, v1
array-length v2, p0
filled-new-array {v1, v2}, [I
move-result-object v1
sget-object v2, Ljava/lang/Byte;->TYPE:Ljava/lang/Class;
invoke-static {v2, v1}, Ljava/lang/reflect/Array;->newInstance(Ljava/lang/Class;[I)Ljava/lang/Object;
move-result-object v1
check-cast v1, [[B
move v2, v0
.line 160
:goto_0
array-length v3, p0
if-ge v2, v3, :cond_1
.line 163
array-length v3, p0
sub-int/2addr v3, v2
add-int/lit8 v3, v3, -0x1
move v4, v0
.line 164
:goto_1
aget-object v5, p0, v0
array-length v5, v5
if-ge v4, v5, :cond_0
.line 165
aget-object v5, v1, v4
aget-object v6, p0, v2
aget-byte v6, v6, v4
aput-byte v6, v5, v3
add-int/lit8 v4, v4, 0x1
goto :goto_1
:cond_0
add-int/lit8 v2, v2, 0x1
goto :goto_0
:cond_1
return-object v1
.end method
# virtual methods
.method public encode(Ljava/lang/String;Lcom/google/zxing/BarcodeFormat;II)Lcom/google/zxing/common/BitMatrix;
.locals 6
.annotation system Ldalvik/annotation/Throws;
value = {
Lcom/google/zxing/WriterException;
}
.end annotation
const/4 v5, 0x0
move-object v0, p0
move-object v1, p1
move-object v2, p2
move v3, p3
move v4, p4
.line 95
invoke-virtual/range {v0 .. v5}, Lcom/google/zxing/pdf417/PDF417Writer;->encode(Ljava/lang/String;Lcom/google/zxing/BarcodeFormat;IILjava/util/Map;)Lcom/google/zxing/common/BitMatrix;
move-result-object p0
return-object p0
.end method
.method public encode(Ljava/lang/String;Lcom/google/zxing/BarcodeFormat;IILjava/util/Map;)Lcom/google/zxing/common/BitMatrix;
.locals 6
.annotation system Ldalvik/annotation/Signature;
value = {
"(",
"Ljava/lang/String;",
"Lcom/google/zxing/BarcodeFormat;",
"II",
"Ljava/util/Map<",
"Lcom/google/zxing/EncodeHintType;",
"*>;)",
"Lcom/google/zxing/common/BitMatrix;"
}
.end annotation
.annotation system Ldalvik/annotation/Throws;
value = {
Lcom/google/zxing/WriterException;
}
.end annotation
.line 53
sget-object p0, Lcom/google/zxing/BarcodeFormat;->PDF_417:Lcom/google/zxing/BarcodeFormat;
if-ne p2, p0, :cond_6
.line 57
new-instance v0, Lcom/google/zxing/pdf417/encoder/PDF417;
invoke-direct {v0}, Lcom/google/zxing/pdf417/encoder/PDF417;-><init>()V
const/16 p0, 0x1e
const/4 p2, 0x2
if-eqz p5, :cond_5
.line 62
sget-object v1, Lcom/google/zxing/EncodeHintType;->PDF417_COMPACT:Lcom/google/zxing/EncodeHintType;
invoke-interface {p5, v1}, Ljava/util/Map;->containsKey(Ljava/lang/Object;)Z
move-result v1
if-eqz v1, :cond_0
.line 63
sget-object v1, Lcom/google/zxing/EncodeHintType;->PDF417_COMPACT:Lcom/google/zxing/EncodeHintType;
invoke-interface {p5, v1}, Ljava/util/Map;->get(Ljava/lang/Object;)Ljava/lang/Object;
move-result-object v1
invoke-virtual {v1}, Ljava/lang/Object;->toString()Ljava/lang/String;
move-result-object v1
invoke-static {v1}, Ljava/lang/Boolean;->parseBoolean(Ljava/lang/String;)Z
move-result v1
invoke-virtual {v0, v1}, Lcom/google/zxing/pdf417/encoder/PDF417;->setCompact(Z)V
.line 65
:cond_0
sget-object v1, Lcom/google/zxing/EncodeHintType;->PDF417_COMPACTION:Lcom/google/zxing/EncodeHintType;
invoke-interface {p5, v1}, Ljava/util/Map;->containsKey(Ljava/lang/Object;)Z
move-result v1
if-eqz v1, :cond_1
.line 66
sget-object v1, Lcom/google/zxing/EncodeHintType;->PDF417_COMPACTION:Lcom/google/zxing/EncodeHintType;
invoke-interface {p5, v1}, Ljava/util/Map;->get(Ljava/lang/Object;)Ljava/lang/Object;
move-result-object v1
invoke-virtual {v1}, Ljava/lang/Object;->toString()Ljava/lang/String;
move-result-object v1
invoke-static {v1}, Lcom/google/zxing/pdf417/encoder/Compaction;->valueOf(Ljava/lang/String;)Lcom/google/zxing/pdf417/encoder/Compaction;
move-result-object v1
invoke-virtual {v0, v1}, Lcom/google/zxing/pdf417/encoder/PDF417;->setCompaction(Lcom/google/zxing/pdf417/encoder/Compaction;)V
.line 68
:cond_1
sget-object v1, Lcom/google/zxing/EncodeHintType;->PDF417_DIMENSIONS:Lcom/google/zxing/EncodeHintType;
invoke-interface {p5, v1}, Ljava/util/Map;->containsKey(Ljava/lang/Object;)Z
move-result v1
if-eqz v1, :cond_2
.line 69
sget-object v1, Lcom/google/zxing/EncodeHintType;->PDF417_DIMENSIONS:Lcom/google/zxing/EncodeHintType;
invoke-interface {p5, v1}, Ljava/util/Map;->get(Ljava/lang/Object;)Ljava/lang/Object;
move-result-object v1
check-cast v1, Lcom/google/zxing/pdf417/encoder/Dimensions;
.line 70
invoke-virtual {v1}, Lcom/google/zxing/pdf417/encoder/Dimensions;->getMaxCols()I
move-result v2
.line 71
invoke-virtual {v1}, Lcom/google/zxing/pdf417/encoder/Dimensions;->getMinCols()I
move-result v3
.line 72
invoke-virtual {v1}, Lcom/google/zxing/pdf417/encoder/Dimensions;->getMaxRows()I
move-result v4
.line 73
invoke-virtual {v1}, Lcom/google/zxing/pdf417/encoder/Dimensions;->getMinRows()I
move-result v1
.line 70
invoke-virtual {v0, v2, v3, v4, v1}, Lcom/google/zxing/pdf417/encoder/PDF417;->setDimensions(IIII)V
.line 75
:cond_2
sget-object v1, Lcom/google/zxing/EncodeHintType;->MARGIN:Lcom/google/zxing/EncodeHintType;
invoke-interface {p5, v1}, Ljava/util/Map;->containsKey(Ljava/lang/Object;)Z
move-result v1
if-eqz v1, :cond_3
.line 76
sget-object p0, Lcom/google/zxing/EncodeHintType;->MARGIN:Lcom/google/zxing/EncodeHintType;
invoke-interface {p5, p0}, Ljava/util/Map;->get(Ljava/lang/Object;)Ljava/lang/Object;
move-result-object p0
invoke-virtual {p0}, Ljava/lang/Object;->toString()Ljava/lang/String;
move-result-object p0
invoke-static {p0}, Ljava/lang/Integer;->parseInt(Ljava/lang/String;)I
move-result p0
.line 78
:cond_3
sget-object v1, Lcom/google/zxing/EncodeHintType;->ERROR_CORRECTION:Lcom/google/zxing/EncodeHintType;
invoke-interface {p5, v1}, Ljava/util/Map;->containsKey(Ljava/lang/Object;)Z
move-result v1
if-eqz v1, :cond_4
.line 79
sget-object p2, Lcom/google/zxing/EncodeHintType;->ERROR_CORRECTION:Lcom/google/zxing/EncodeHintType;
invoke-interface {p5, p2}, Ljava/util/Map;->get(Ljava/lang/Object;)Ljava/lang/Object;
move-result-object p2
invoke-virtual {p2}, Ljava/lang/Object;->toString()Ljava/lang/String;
move-result-object p2
invoke-static {p2}, Ljava/lang/Integer;->parseInt(Ljava/lang/String;)I
move-result p2
.line 81
:cond_4
sget-object v1, Lcom/google/zxing/EncodeHintType;->CHARACTER_SET:Lcom/google/zxing/EncodeHintType;
invoke-interface {p5, v1}, Ljava/util/Map;->containsKey(Ljava/lang/Object;)Z
move-result v1
if-eqz v1, :cond_5
.line 82
sget-object v1, Lcom/google/zxing/EncodeHintType;->CHARACTER_SET:Lcom/google/zxing/EncodeHintType;
invoke-interface {p5, v1}, Ljava/util/Map;->get(Ljava/lang/Object;)Ljava/lang/Object;
move-result-object p5
invoke-virtual {p5}, Ljava/lang/Object;->toString()Ljava/lang/String;
move-result-object p5
invoke-static {p5}, Ljava/nio/charset/Charset;->forName(Ljava/lang/String;)Ljava/nio/charset/Charset;
move-result-object p5
.line 83
invoke-virtual {v0, p5}, Lcom/google/zxing/pdf417/encoder/PDF417;->setEncoding(Ljava/nio/charset/Charset;)V
:cond_5
move v5, p0
move v2, p2
move-object v1, p1
move v3, p3
move v4, p4
.line 87
invoke-static/range {v0 .. v5}, Lcom/google/zxing/pdf417/PDF417Writer;->bitMatrixFromEncoder(Lcom/google/zxing/pdf417/encoder/PDF417;Ljava/lang/String;IIII)Lcom/google/zxing/common/BitMatrix;
move-result-object p0
return-object p0
.line 54
:cond_6
new-instance p0, Ljava/lang/IllegalArgumentException;
const-string p1, "Can only encode PDF_417, but got "
invoke-static {p2}, Ljava/lang/String;->valueOf(Ljava/lang/Object;)Ljava/lang/String;
move-result-object p2
invoke-virtual {p1, p2}, Ljava/lang/String;->concat(Ljava/lang/String;)Ljava/lang/String;
move-result-object p1
invoke-direct {p0, p1}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
throw p0
.end method