.class public Lcom/bumptech/glide/load/resource/bitmap/BitmapEncoder; .super Ljava/lang/Object; .source "BitmapEncoder.java" # interfaces .implements Lcom/bumptech/glide/load/ResourceEncoder; # annotations .annotation system Ldalvik/annotation/Signature; value = { "Ljava/lang/Object;", "Lcom/bumptech/glide/load/ResourceEncoder<", "Landroid/graphics/Bitmap;", ">;" } .end annotation # static fields .field public static final COMPRESSION_FORMAT:Lcom/bumptech/glide/load/Option; .annotation system Ldalvik/annotation/Signature; value = { "Lcom/bumptech/glide/load/Option<", "Landroid/graphics/Bitmap$CompressFormat;", ">;" } .end annotation .end field .field public static final COMPRESSION_QUALITY:Lcom/bumptech/glide/load/Option; .annotation system Ldalvik/annotation/Signature; value = { "Lcom/bumptech/glide/load/Option<", "Ljava/lang/Integer;", ">;" } .end annotation .end field .field private static final TAG:Ljava/lang/String; = "BitmapEncoder" # instance fields .field private final arrayPool:Lcom/bumptech/glide/load/engine/bitmap_recycle/ArrayPool; # direct methods .method static constructor ()V .registers 2 const/16 v0, 0x5a .line 42 invoke-static {v0}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer; move-result-object v0 .line 41 const-string v1, "com.bumptech.glide.load.resource.bitmap.BitmapEncoder.CompressionQuality" invoke-static {v1, v0}, Lcom/bumptech/glide/load/Option;->memory(Ljava/lang/String;Ljava/lang/Object;)Lcom/bumptech/glide/load/Option; move-result-object v0 sput-object v0, Lcom/bumptech/glide/load/resource/bitmap/BitmapEncoder;->COMPRESSION_QUALITY:Lcom/bumptech/glide/load/Option; .line 51 const-string v0, "com.bumptech.glide.load.resource.bitmap.BitmapEncoder.CompressionFormat" invoke-static {v0}, Lcom/bumptech/glide/load/Option;->memory(Ljava/lang/String;)Lcom/bumptech/glide/load/Option; move-result-object v0 sput-object v0, Lcom/bumptech/glide/load/resource/bitmap/BitmapEncoder;->COMPRESSION_FORMAT:Lcom/bumptech/glide/load/Option; return-void .end method .method public constructor ()V .registers 2 .annotation runtime Ljava/lang/Deprecated; .end annotation .line 66 invoke-direct {p0}, Ljava/lang/Object;->()V const/4 v0, 0x0 .line 67 iput-object v0, p0, Lcom/bumptech/glide/load/resource/bitmap/BitmapEncoder;->arrayPool:Lcom/bumptech/glide/load/engine/bitmap_recycle/ArrayPool; return-void .end method .method public constructor (Lcom/bumptech/glide/load/engine/bitmap_recycle/ArrayPool;)V .registers 2 .line 58 invoke-direct {p0}, Ljava/lang/Object;->()V .line 59 iput-object p1, p0, Lcom/bumptech/glide/load/resource/bitmap/BitmapEncoder;->arrayPool:Lcom/bumptech/glide/load/engine/bitmap_recycle/ArrayPool; return-void .end method .method private getFormat(Landroid/graphics/Bitmap;Lcom/bumptech/glide/load/Options;)Landroid/graphics/Bitmap$CompressFormat; .registers 4 .line 118 sget-object v0, Lcom/bumptech/glide/load/resource/bitmap/BitmapEncoder;->COMPRESSION_FORMAT:Lcom/bumptech/glide/load/Option; invoke-virtual {p2, v0}, Lcom/bumptech/glide/load/Options;->get(Lcom/bumptech/glide/load/Option;)Ljava/lang/Object; move-result-object p2 check-cast p2, Landroid/graphics/Bitmap$CompressFormat; if-eqz p2, :cond_b return-object p2 .line 121 :cond_b invoke-virtual {p1}, Landroid/graphics/Bitmap;->hasAlpha()Z move-result p1 if-eqz p1, :cond_14 .line 122 sget-object p1, Landroid/graphics/Bitmap$CompressFormat;->PNG:Landroid/graphics/Bitmap$CompressFormat; return-object p1 .line 124 :cond_14 sget-object p1, Landroid/graphics/Bitmap$CompressFormat;->JPEG:Landroid/graphics/Bitmap$CompressFormat; return-object p1 .end method # virtual methods .method public encode(Lcom/bumptech/glide/load/engine/Resource;Ljava/io/File;Lcom/bumptech/glide/load/Options;)Z .registers 12 .annotation system Ldalvik/annotation/Signature; value = { "(", "Lcom/bumptech/glide/load/engine/Resource<", "Landroid/graphics/Bitmap;", ">;", "Ljava/io/File;", "Lcom/bumptech/glide/load/Options;", ")Z" } .end annotation .line 73 const-string v0, "BitmapEncoder" .line 0 const-string v1, "Compressed with type: " .line 73 invoke-interface {p1}, Lcom/bumptech/glide/load/engine/Resource;->get()Ljava/lang/Object; move-result-object p1 check-cast p1, Landroid/graphics/Bitmap; .line 74 invoke-direct {p0, p1, p3}, Lcom/bumptech/glide/load/resource/bitmap/BitmapEncoder;->getFormat(Landroid/graphics/Bitmap;Lcom/bumptech/glide/load/Options;)Landroid/graphics/Bitmap$CompressFormat; move-result-object v2 .line 76 invoke-virtual {p1}, Landroid/graphics/Bitmap;->getWidth()I move-result v3 invoke-static {v3}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer; move-result-object v3 invoke-virtual {p1}, Landroid/graphics/Bitmap;->getHeight()I move-result v4 invoke-static {v4}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer; move-result-object v4 const-string v5, "encode: [%dx%d] %s" invoke-static {v5, v3, v4, v2}, Lcom/bumptech/glide/util/pool/GlideTrace;->beginSectionFormat(Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)V .line 78 :try_start_23 invoke-static {}, Lcom/bumptech/glide/util/LogTime;->getLogTime()J move-result-wide v3 .line 79 sget-object v5, Lcom/bumptech/glide/load/resource/bitmap/BitmapEncoder;->COMPRESSION_QUALITY:Lcom/bumptech/glide/load/Option; invoke-virtual {p3, v5}, Lcom/bumptech/glide/load/Options;->get(Lcom/bumptech/glide/load/Option;)Ljava/lang/Object; move-result-object v5 check-cast v5, Ljava/lang/Integer; invoke-virtual {v5}, Ljava/lang/Integer;->intValue()I move-result v5 :try_end_33 .catchall {:try_start_23 .. :try_end_33} :catchall_c8 const/4 v6, 0x0 .line 84 :try_start_34 new-instance v7, Ljava/io/FileOutputStream; invoke-direct {v7, p2}, Ljava/io/FileOutputStream;->(Ljava/io/File;)V :try_end_39 .catch Ljava/io/IOException; {:try_start_34 .. :try_end_39} :catch_5a .catchall {:try_start_34 .. :try_end_39} :catchall_58 .line 85 :try_start_39 iget-object p2, p0, Lcom/bumptech/glide/load/resource/bitmap/BitmapEncoder;->arrayPool:Lcom/bumptech/glide/load/engine/bitmap_recycle/ArrayPool; if-eqz p2, :cond_46 .line 86 new-instance p2, Lcom/bumptech/glide/load/data/BufferedOutputStream; iget-object v6, p0, Lcom/bumptech/glide/load/resource/bitmap/BitmapEncoder;->arrayPool:Lcom/bumptech/glide/load/engine/bitmap_recycle/ArrayPool; invoke-direct {p2, v7, v6}, Lcom/bumptech/glide/load/data/BufferedOutputStream;->(Ljava/io/OutputStream;Lcom/bumptech/glide/load/engine/bitmap_recycle/ArrayPool;)V :try_end_44 .catch Ljava/io/IOException; {:try_start_39 .. :try_end_44} :catch_55 .catchall {:try_start_39 .. :try_end_44} :catchall_52 move-object v6, p2 goto :goto_47 :cond_46 move-object v6, v7 .line 88 :goto_47 :try_start_47 invoke-virtual {p1, v2, v5, v6}, Landroid/graphics/Bitmap;->compress(Landroid/graphics/Bitmap$CompressFormat;ILjava/io/OutputStream;)Z .line 89 invoke-virtual {v6}, Ljava/io/OutputStream;->close()V :try_end_4d .catch Ljava/io/IOException; {:try_start_47 .. :try_end_4d} :catch_5a .catchall {:try_start_47 .. :try_end_4d} :catchall_58 .line 98 :try_start_4d invoke-virtual {v6}, Ljava/io/OutputStream;->close()V :try_end_50 .catch Ljava/io/IOException; {:try_start_4d .. :try_end_50} :catch_50 .catchall {:try_start_4d .. :try_end_50} :catchall_c8 :catch_50 const/4 p2, 0x1 goto :goto_6d :catchall_52 move-exception p1 move-object v6, v7 goto :goto_c2 :catch_55 move-exception p2 move-object v6, v7 goto :goto_5b :catchall_58 move-exception p1 goto :goto_c2 :catch_5a move-exception p2 :goto_5b const/4 v5, 0x3 .line 92 :try_start_5c invoke-static {v0, v5}, Landroid/util/Log;->isLoggable(Ljava/lang/String;I)Z move-result v5 if-eqz v5, :cond_67 .line 93 const-string v5, "Failed to encode Bitmap" invoke-static {v0, v5, p2}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I :try_end_67 .catchall {:try_start_5c .. :try_end_67} :catchall_58 :cond_67 if-eqz v6, :cond_6c .line 98 :try_start_69 invoke-virtual {v6}, Ljava/io/OutputStream;->close()V :try_end_6c .catch Ljava/io/IOException; {:try_start_69 .. :try_end_6c} :catch_6c .catchall {:try_start_69 .. :try_end_6c} :catchall_c8 :catch_6c :cond_6c const/4 p2, 0x0 :goto_6d const/4 v5, 0x2 .line 105 :try_start_6e invoke-static {v0, v5}, Landroid/util/Log;->isLoggable(Ljava/lang/String;I)Z move-result v5 if-eqz v5, :cond_be .line 106 new-instance v5, Ljava/lang/StringBuilder; invoke-direct {v5, v1}, Ljava/lang/StringBuilder;->(Ljava/lang/String;)V invoke-virtual {v5, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder; move-result-object v1 const-string v2, " of size " invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; move-result-object v1 invoke-static {p1}, Lcom/bumptech/glide/util/Util;->getBitmapByteSize(Landroid/graphics/Bitmap;)I move-result v2 invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder; move-result-object v1 const-string v2, " in " invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; move-result-object v1 .line 107 invoke-static {v3, v4}, Lcom/bumptech/glide/util/LogTime;->getElapsedMillis(J)D move-result-wide v2 invoke-virtual {v1, v2, v3}, Ljava/lang/StringBuilder;->append(D)Ljava/lang/StringBuilder; move-result-object v1 const-string v2, ", options format: " invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; move-result-object v1 sget-object v2, Lcom/bumptech/glide/load/resource/bitmap/BitmapEncoder;->COMPRESSION_FORMAT:Lcom/bumptech/glide/load/Option; .line 108 invoke-virtual {p3, v2}, Lcom/bumptech/glide/load/Options;->get(Lcom/bumptech/glide/load/Option;)Ljava/lang/Object; move-result-object p3 invoke-virtual {v1, p3}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder; move-result-object p3 const-string v1, ", hasAlpha: " invoke-virtual {p3, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; move-result-object p3 .line 109 invoke-virtual {p1}, Landroid/graphics/Bitmap;->hasAlpha()Z move-result p1 invoke-virtual {p3, p1}, Ljava/lang/StringBuilder;->append(Z)Ljava/lang/StringBuilder; move-result-object p1 invoke-virtual {p1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String; move-result-object p1 .line 106 invoke-static {v0, p1}, Landroid/util/Log;->v(Ljava/lang/String;Ljava/lang/String;)I :try_end_be .catchall {:try_start_6e .. :try_end_be} :catchall_c8 .line 113 :cond_be invoke-static {}, Lcom/bumptech/glide/util/pool/GlideTrace;->endSection()V return p2 :goto_c2 if-eqz v6, :cond_c7 .line 98 :try_start_c4 invoke-virtual {v6}, Ljava/io/OutputStream;->close()V :try_end_c7 .catch Ljava/io/IOException; {:try_start_c4 .. :try_end_c7} :catch_c7 .catchall {:try_start_c4 .. :try_end_c7} :catchall_c8 .line 101 :catch_c7 :cond_c7 :try_start_c7 throw p1 :try_end_c8 .catchall {:try_start_c7 .. :try_end_c8} :catchall_c8 :catchall_c8 move-exception p1 .line 113 invoke-static {}, Lcom/bumptech/glide/util/pool/GlideTrace;->endSection()V throw p1 .end method .method public bridge synthetic encode(Ljava/lang/Object;Ljava/io/File;Lcom/bumptech/glide/load/Options;)Z .registers 4 .line 35 check-cast p1, Lcom/bumptech/glide/load/engine/Resource; invoke-virtual {p0, p1, p2, p3}, Lcom/bumptech/glide/load/resource/bitmap/BitmapEncoder;->encode(Lcom/bumptech/glide/load/engine/Resource;Ljava/io/File;Lcom/bumptech/glide/load/Options;)Z move-result p1 return p1 .end method .method public getEncodeStrategy(Lcom/bumptech/glide/load/Options;)Lcom/bumptech/glide/load/EncodeStrategy; .registers 2 .line 131 sget-object p1, Lcom/bumptech/glide/load/EncodeStrategy;->TRANSFORMED:Lcom/bumptech/glide/load/EncodeStrategy; return-object p1 .end method