BlurUtil.smali
.class public Lcom/sandboxol/common/utils/BlurUtil;
.super Ljava/lang/Object;
.source "BlurUtil.java"
# direct methods
.method public constructor <init>()V
.registers 1
.line 1
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
return-void
.end method
.method public static blur(Landroid/content/Context;Landroid/graphics/Bitmap;FI)Landroid/graphics/Bitmap;
.registers 7
if-nez p1, :cond_4
const/4 p0, 0x0
return-object p0
.line 2
:cond_4
sget v0, Landroid/os/Build$VERSION;->SDK_INT:I
const/16 v1, 0x10
if-le v0, v1, :cond_5f
.line 3
invoke-virtual {p1}, Landroid/graphics/Bitmap;->getWidth()I
move-result v0
int-to-float v0, v0
div-float/2addr v0, p2
float-to-int v0, v0
invoke-virtual {p1}, Landroid/graphics/Bitmap;->getHeight()I
move-result v1
int-to-float v1, v1
div-float/2addr v1, p2
float-to-int v1, v1
sget-object v2, Landroid/graphics/Bitmap$Config;->ARGB_8888:Landroid/graphics/Bitmap$Config;
invoke-static {v0, v1, v2}, Landroid/graphics/Bitmap;->createBitmap(IILandroid/graphics/Bitmap$Config;)Landroid/graphics/Bitmap;
move-result-object v0
.line 4
new-instance v1, Landroid/graphics/Canvas;
invoke-direct {v1, v0}, Landroid/graphics/Canvas;-><init>(Landroid/graphics/Bitmap;)V
const/high16 v2, 0x3f800000 # 1.0f
div-float/2addr v2, p2
.line 5
invoke-virtual {v1, v2, v2}, Landroid/graphics/Canvas;->scale(FF)V
.line 6
new-instance p2, Landroid/graphics/Paint;
invoke-direct {p2}, Landroid/graphics/Paint;-><init>()V
const/4 v2, 0x2
.line 7
invoke-virtual {p2, v2}, Landroid/graphics/Paint;->setFlags(I)V
const/4 v2, 0x0
.line 8
invoke-virtual {v1, p1, v2, v2, p2}, Landroid/graphics/Canvas;->drawBitmap(Landroid/graphics/Bitmap;FFLandroid/graphics/Paint;)V
.line 9
invoke-static {p0}, Landroid/renderscript/RenderScript;->create(Landroid/content/Context;)Landroid/renderscript/RenderScript;
move-result-object p0
.line 10
sget-object p1, Landroid/renderscript/Allocation$MipmapControl;->MIPMAP_FULL:Landroid/renderscript/Allocation$MipmapControl;
const/4 p2, 0x1
invoke-static {p0, v0, p1, p2}, Landroid/renderscript/Allocation;->createFromBitmap(Landroid/renderscript/RenderScript;Landroid/graphics/Bitmap;Landroid/renderscript/Allocation$MipmapControl;I)Landroid/renderscript/Allocation;
move-result-object p1
.line 11
invoke-virtual {p1}, Landroid/renderscript/Allocation;->getType()Landroid/renderscript/Type;
move-result-object p2
invoke-static {p0, p2}, Landroid/renderscript/Allocation;->createTyped(Landroid/renderscript/RenderScript;Landroid/renderscript/Type;)Landroid/renderscript/Allocation;
move-result-object p2
.line 12
invoke-static {p0}, Landroid/renderscript/Element;->U8_4(Landroid/renderscript/RenderScript;)Landroid/renderscript/Element;
move-result-object v1
invoke-static {p0, v1}, Landroid/renderscript/ScriptIntrinsicBlur;->create(Landroid/renderscript/RenderScript;Landroid/renderscript/Element;)Landroid/renderscript/ScriptIntrinsicBlur;
move-result-object p0
.line 13
invoke-virtual {p0, p1}, Landroid/renderscript/ScriptIntrinsicBlur;->setInput(Landroid/renderscript/Allocation;)V
int-to-float p1, p3
.line 14
invoke-virtual {p0, p1}, Landroid/renderscript/ScriptIntrinsicBlur;->setRadius(F)V
.line 15
invoke-virtual {p0, p2}, Landroid/renderscript/ScriptIntrinsicBlur;->forEach(Landroid/renderscript/Allocation;)V
.line 16
invoke-virtual {p2, v0}, Landroid/renderscript/Allocation;->copyTo(Landroid/graphics/Bitmap;)V
return-object v0
.line 17
:cond_5f
invoke-static {p1, p2, p3}, Lcom/sandboxol/common/utils/BlurUtil;->blurApi16(Landroid/graphics/Bitmap;FI)Landroid/graphics/Bitmap;
move-result-object p0
return-object p0
.end method
.method public static blur(Landroid/content/Context;Landroid/graphics/Bitmap;I)Landroid/graphics/Bitmap;
.registers 4
const/high16 v0, 0x41000000 # 8.0f
.line 1
invoke-static {p0, p1, v0, p2}, Lcom/sandboxol/common/utils/BlurUtil;->blur(Landroid/content/Context;Landroid/graphics/Bitmap;FI)Landroid/graphics/Bitmap;
move-result-object p0
return-object p0
.end method
.method private static blurApi16(Landroid/graphics/Bitmap;FI)Landroid/graphics/Bitmap;
.registers 40
move/from16 v0, p2
.line 1
invoke-virtual/range {p0 .. p0}, Landroid/graphics/Bitmap;->getWidth()I
move-result v1
int-to-float v1, v1
div-float v1, v1, p1
float-to-int v1, v1
invoke-virtual/range {p0 .. p0}, Landroid/graphics/Bitmap;->getHeight()I
move-result v2
int-to-float v2, v2
div-float v2, v2, p1
float-to-int v2, v2
sget-object v3, Landroid/graphics/Bitmap$Config;->ARGB_8888:Landroid/graphics/Bitmap$Config;
invoke-static {v1, v2, v3}, Landroid/graphics/Bitmap;->createBitmap(IILandroid/graphics/Bitmap$Config;)Landroid/graphics/Bitmap;
move-result-object v1
.line 2
new-instance v2, Landroid/graphics/Canvas;
invoke-direct {v2, v1}, Landroid/graphics/Canvas;-><init>(Landroid/graphics/Bitmap;)V
const/high16 v3, 0x3f800000 # 1.0f
div-float v3, v3, p1
.line 3
invoke-virtual {v2, v3, v3}, Landroid/graphics/Canvas;->scale(FF)V
.line 4
new-instance v3, Landroid/graphics/Paint;
invoke-direct {v3}, Landroid/graphics/Paint;-><init>()V
const/4 v4, 0x2
.line 5
invoke-virtual {v3, v4}, Landroid/graphics/Paint;->setFlags(I)V
const/4 v5, 0x0
move-object/from16 v6, p0
.line 6
invoke-virtual {v2, v6, v5, v5, v3}, Landroid/graphics/Canvas;->drawBitmap(Landroid/graphics/Bitmap;FFLandroid/graphics/Paint;)V
.line 7
invoke-virtual {v1}, Landroid/graphics/Bitmap;->getConfig()Landroid/graphics/Bitmap$Config;
move-result-object v2
const/4 v3, 0x1
invoke-virtual {v1, v2, v3}, Landroid/graphics/Bitmap;->copy(Landroid/graphics/Bitmap$Config;Z)Landroid/graphics/Bitmap;
move-result-object v1
if-ge v0, v3, :cond_40
const/4 v0, 0x0
return-object v0
.line 8
:cond_40
invoke-virtual {v1}, Landroid/graphics/Bitmap;->getWidth()I
move-result v2
.line 9
invoke-virtual {v1}, Landroid/graphics/Bitmap;->getHeight()I
move-result v13
mul-int v14, v2, v13
.line 10
new-array v15, v14, [I
const/4 v7, 0x0
const/4 v9, 0x0
const/4 v10, 0x0
move-object v5, v1
move-object v6, v15
move v8, v2
move v11, v2
move v12, v13
.line 11
invoke-virtual/range {v5 .. v12}, Landroid/graphics/Bitmap;->getPixels([IIIIIII)V
add-int/lit8 v5, v2, -0x1
add-int/lit8 v6, v13, -0x1
add-int v7, v0, v0
add-int/2addr v7, v3
.line 12
new-array v8, v14, [I
.line 13
new-array v9, v14, [I
.line 14
new-array v10, v14, [I
.line 15
invoke-static {v2, v13}, Ljava/lang/Math;->max(II)I
move-result v11
new-array v11, v11, [I
add-int/lit8 v12, v7, 0x1
shr-int/2addr v12, v3
mul-int v12, v12, v12
mul-int/lit16 v14, v12, 0x100
.line 16
new-array v4, v14, [I
const/4 v3, 0x0
:goto_74
if-ge v3, v14, :cond_7d
.line 17
div-int v17, v3, v12
aput v17, v4, v3
add-int/lit8 v3, v3, 0x1
goto :goto_74
:cond_7d
const/4 v3, 0x3
.line 18
filled-new-array {v7, v3}, [I
move-result-object v3
const-class v12, I
invoke-static {v12, v3}, Ljava/lang/reflect/Array;->newInstance(Ljava/lang/Class;[I)Ljava/lang/Object;
move-result-object v3
check-cast v3, [[I
add-int/lit8 v12, v0, 0x1
const/4 v14, 0x0
const/16 v17, 0x0
const/16 v18, 0x0
:goto_91
if-ge v14, v13, :cond_1bd
move-object/from16 v19, v1
neg-int v1, v0
const/16 v20, 0x0
const/16 v21, 0x0
const/16 v22, 0x0
const/16 v23, 0x0
const/16 v24, 0x0
const/16 v25, 0x0
const/16 v26, 0x0
const/16 v27, 0x0
const/16 v28, 0x0
:goto_a8
const v29, 0xff00
const/high16 v30, 0xff0000
if-gt v1, v0, :cond_112
move/from16 v32, v6
move/from16 v31, v13
const/4 v13, 0x0
.line 19
invoke-static {v1, v13}, Ljava/lang/Math;->max(II)I
move-result v6
invoke-static {v5, v6}, Ljava/lang/Math;->min(II)I
move-result v6
add-int v6, v17, v6
aget v6, v15, v6
add-int v16, v1, v0
.line 20
aget-object v33, v3, v16
and-int v16, v6, v30
shr-int/lit8 v16, v16, 0x10
.line 21
aput v16, v33, v13
and-int v16, v6, v29
shr-int/lit8 v16, v16, 0x8
const/16 v29, 0x1
.line 22
aput v16, v33, v29
and-int/lit16 v6, v6, 0xff
const/16 v30, 0x2
.line 23
aput v6, v33, v30
.line 24
invoke-static {v1}, Ljava/lang/Math;->abs(I)I
move-result v6
sub-int v6, v12, v6
.line 25
aget v16, v33, v13
mul-int v16, v16, v6
add-int v20, v20, v16
.line 26
aget v16, v33, v29
mul-int v16, v16, v6
add-int v21, v21, v16
.line 27
aget v16, v33, v30
mul-int v16, v16, v6
add-int v22, v22, v16
if-lez v1, :cond_ff
.line 28
aget v6, v33, v13
add-int v26, v26, v6
.line 29
aget v6, v33, v29
add-int v27, v27, v6
.line 30
aget v6, v33, v30
add-int v28, v28, v6
goto :goto_10b
.line 31
:cond_ff
aget v6, v33, v13
add-int v23, v23, v6
.line 32
aget v6, v33, v29
add-int v24, v24, v6
.line 33
aget v6, v33, v30
add-int v25, v25, v6
:goto_10b
add-int/lit8 v1, v1, 0x1
move/from16 v13, v31
move/from16 v6, v32
goto :goto_a8
:cond_112
move/from16 v32, v6
move/from16 v31, v13
move v6, v0
const/4 v1, 0x0
:goto_118
if-ge v1, v2, :cond_1af
.line 34
aget v13, v4, v20
aput v13, v8, v17
.line 35
aget v13, v4, v21
aput v13, v9, v17
.line 36
aget v13, v4, v22
aput v13, v10, v17
sub-int v20, v20, v23
sub-int v21, v21, v24
sub-int v22, v22, v25
sub-int v13, v6, v0
add-int/2addr v13, v7
.line 37
rem-int/2addr v13, v7
aget-object v13, v3, v13
const/16 v16, 0x0
.line 38
aget v33, v13, v16
sub-int v23, v23, v33
const/16 v33, 0x1
.line 39
aget v34, v13, v33
sub-int v24, v24, v34
const/16 v34, 0x2
.line 40
aget v35, v13, v34
sub-int v25, v25, v35
if-nez v14, :cond_153
add-int v34, v1, v0
move-object/from16 v35, v4
add-int/lit8 v4, v34, 0x1
.line 41
invoke-static {v4, v5}, Ljava/lang/Math;->min(II)I
move-result v4
aput v4, v11, v1
goto :goto_155
:cond_153
move-object/from16 v35, v4
.line 42
:goto_155
aget v4, v11, v1
add-int v4, v18, v4
aget v4, v15, v4
and-int v33, v4, v30
shr-int/lit8 v33, v33, 0x10
const/16 v16, 0x0
.line 43
aput v33, v13, v16
and-int v33, v4, v29
shr-int/lit8 v33, v33, 0x8
const/16 v34, 0x1
.line 44
aput v33, v13, v34
and-int/lit16 v4, v4, 0xff
const/16 v33, 0x2
.line 45
aput v4, v13, v33
.line 46
aget v4, v13, v16
add-int v26, v26, v4
.line 47
aget v4, v13, v34
add-int v27, v27, v4
.line 48
aget v4, v13, v33
add-int v28, v28, v4
add-int v20, v20, v26
add-int v21, v21, v27
add-int v22, v22, v28
add-int/lit8 v6, v6, 0x1
.line 49
rem-int/2addr v6, v7
.line 50
rem-int v4, v6, v7
aget-object v4, v3, v4
const/4 v13, 0x0
.line 51
aget v16, v4, v13
add-int v23, v23, v16
const/16 v33, 0x1
.line 52
aget v16, v4, v33
add-int v24, v24, v16
const/16 v34, 0x2
.line 53
aget v16, v4, v34
add-int v25, v25, v16
.line 54
aget v36, v4, v13
sub-int v26, v26, v36
.line 55
aget v13, v4, v33
sub-int v27, v27, v13
.line 56
aget v4, v4, v34
sub-int v28, v28, v4
add-int/lit8 v17, v17, 0x1
add-int/lit8 v1, v1, 0x1
move-object/from16 v4, v35
goto/16 :goto_118
:cond_1af
move-object/from16 v35, v4
add-int v18, v18, v2
add-int/lit8 v14, v14, 0x1
move-object/from16 v1, v19
move/from16 v13, v31
move/from16 v6, v32
goto/16 :goto_91
:cond_1bd
move-object/from16 v19, v1
move-object/from16 v35, v4
move/from16 v32, v6
move/from16 v31, v13
const/4 v1, 0x0
:goto_1c6
if-ge v1, v2, :cond_306
neg-int v4, v0
mul-int v5, v4, v2
const/4 v6, 0x0
const/4 v13, 0x0
const/4 v14, 0x0
const/16 v17, 0x0
const/16 v18, 0x0
const/16 v20, 0x0
const/16 v21, 0x0
const/16 v22, 0x0
const/16 v23, 0x0
:goto_1da
if-gt v4, v0, :cond_242
move-object/from16 v24, v11
const/4 v11, 0x0
.line 57
invoke-static {v11, v5}, Ljava/lang/Math;->max(II)I
move-result v16
add-int v25, v16, v1
add-int v16, v4, v0
.line 58
aget-object v26, v3, v16
.line 59
aget v16, v8, v25
aput v16, v26, v11
.line 60
aget v11, v9, v25
const/16 v27, 0x1
aput v11, v26, v27
.line 61
aget v11, v10, v25
const/16 v27, 0x2
aput v11, v26, v27
.line 62
invoke-static {v4}, Ljava/lang/Math;->abs(I)I
move-result v11
sub-int v11, v12, v11
.line 63
aget v27, v8, v25
mul-int v27, v27, v11
add-int v6, v6, v27
.line 64
aget v27, v9, v25
mul-int v27, v27, v11
add-int v13, v13, v27
.line 65
aget v25, v10, v25
mul-int v25, v25, v11
add-int v14, v14, v25
if-lez v4, :cond_225
const/4 v11, 0x0
.line 66
aget v16, v26, v11
add-int v21, v21, v16
const/16 v25, 0x1
.line 67
aget v16, v26, v25
add-int v22, v22, v16
const/16 v27, 0x2
.line 68
aget v16, v26, v27
add-int v23, v23, v16
goto :goto_236
:cond_225
const/4 v11, 0x0
const/16 v25, 0x1
const/16 v27, 0x2
.line 69
aget v28, v26, v11
add-int v17, v17, v28
.line 70
aget v11, v26, v25
add-int v18, v18, v11
.line 71
aget v11, v26, v27
add-int v20, v20, v11
:goto_236
move/from16 v11, v32
if-ge v4, v11, :cond_23b
add-int/2addr v5, v2
:cond_23b
add-int/lit8 v4, v4, 0x1
move/from16 v32, v11
move-object/from16 v11, v24
goto :goto_1da
:cond_242
move-object/from16 v24, v11
move/from16 v11, v32
move/from16 v25, v22
move/from16 v26, v23
move/from16 v4, v31
const/4 v5, 0x0
move/from16 v22, v0
move/from16 v23, v21
move/from16 v21, v20
move/from16 v20, v18
move/from16 v18, v17
move/from16 v17, v14
move v14, v13
move v13, v6
move v6, v1
:goto_25c
if-ge v5, v4, :cond_2f4
const/high16 v27, -0x1000000
.line 72
aget v28, v15, v6
and-int v27, v28, v27
aget v28, v35, v13
shl-int/lit8 v28, v28, 0x10
or-int v27, v27, v28
aget v28, v35, v14
shl-int/lit8 v28, v28, 0x8
or-int v27, v27, v28
aget v28, v35, v17
or-int v27, v27, v28
aput v27, v15, v6
sub-int v13, v13, v18
sub-int v14, v14, v20
sub-int v17, v17, v21
sub-int v27, v22, v0
add-int v27, v27, v7
.line 73
rem-int v27, v27, v7
aget-object v27, v3, v27
const/16 v16, 0x0
.line 74
aget v28, v27, v16
sub-int v18, v18, v28
const/16 v28, 0x1
.line 75
aget v29, v27, v28
sub-int v20, v20, v29
const/16 v28, 0x2
.line 76
aget v29, v27, v28
sub-int v21, v21, v29
if-nez v1, :cond_2a2
add-int v0, v5, v12
.line 77
invoke-static {v0, v11}, Ljava/lang/Math;->min(II)I
move-result v0
mul-int v0, v0, v2
aput v0, v24, v5
.line 78
:cond_2a2
aget v0, v24, v5
add-int/2addr v0, v1
.line 79
aget v28, v8, v0
const/16 v16, 0x0
aput v28, v27, v16
.line 80
aget v28, v9, v0
const/16 v29, 0x1
aput v28, v27, v29
.line 81
aget v0, v10, v0
const/16 v28, 0x2
aput v0, v27, v28
.line 82
aget v0, v27, v16
add-int v23, v23, v0
.line 83
aget v0, v27, v29
add-int v25, v25, v0
.line 84
aget v0, v27, v28
add-int v26, v26, v0
add-int v13, v13, v23
add-int v14, v14, v25
add-int v17, v17, v26
add-int/lit8 v22, v22, 0x1
.line 85
rem-int v22, v22, v7
.line 86
aget-object v0, v3, v22
const/16 v16, 0x0
.line 87
aget v27, v0, v16
add-int v18, v18, v27
const/16 v27, 0x1
.line 88
aget v28, v0, v27
add-int v20, v20, v28
const/16 v28, 0x2
.line 89
aget v29, v0, v28
add-int v21, v21, v29
.line 90
aget v29, v0, v16
sub-int v23, v23, v29
.line 91
aget v29, v0, v27
sub-int v25, v25, v29
.line 92
aget v0, v0, v28
sub-int v26, v26, v0
add-int/2addr v6, v2
add-int/lit8 v5, v5, 0x1
move/from16 v0, p2
goto/16 :goto_25c
:cond_2f4
const/16 v16, 0x0
const/16 v27, 0x1
const/16 v28, 0x2
add-int/lit8 v1, v1, 0x1
move/from16 v0, p2
move/from16 v31, v4
move/from16 v32, v11
move-object/from16 v11, v24
goto/16 :goto_1c6
:cond_306
move/from16 v4, v31
const/4 v7, 0x0
const/4 v9, 0x0
const/4 v10, 0x0
move-object/from16 v5, v19
move-object v6, v15
move v8, v2
move v11, v2
move v12, v4
.line 93
invoke-virtual/range {v5 .. v12}, Landroid/graphics/Bitmap;->setPixels([IIIIIII)V
return-object v19
.end method