Don't write cover frame to buffer if option is ignore cover frame
This commit is contained in:
parent
6e497d80cc
commit
63198f6ce7
|
@ -430,6 +430,11 @@ class ApngDecoder {
|
||||||
}
|
}
|
||||||
name.contentEquals(Utils.IDAT) -> {
|
name.contentEquals(Utils.IDAT) -> {
|
||||||
val w = if (png == null) {
|
val w = if (png == null) {
|
||||||
|
if (isApng && !config.decodeCoverFrame) {
|
||||||
|
if (BuildConfig.DEBUG)
|
||||||
|
Log.d(TAG, "Ignoring cover frame")
|
||||||
|
continue
|
||||||
|
}
|
||||||
if (cover == null) {
|
if (cover == null) {
|
||||||
cover = ByteArrayOutputStream()
|
cover = ByteArrayOutputStream()
|
||||||
cover.write(Utils.pngSignature)
|
cover.write(Utils.pngSignature)
|
||||||
|
|
|
@ -55,7 +55,7 @@ class ViewerActivity : AppCompatActivity() {
|
||||||
override fun onError(error: Exception) {
|
override fun onError(error: Exception) {
|
||||||
Log.e("ViewerActivity", "Error when loading file", error)
|
Log.e("ViewerActivity", "Error when loading file", error)
|
||||||
}
|
}
|
||||||
})
|
}, ApngDecoder.Config(decodeCoverFrame = false))
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onRequestPermissionsResult(requestCode: Int,
|
override fun onRequestPermissionsResult(requestCode: Int,
|
||||||
|
|
|
@ -37,7 +37,7 @@ class ApngDecoderFragment : Fragment() {
|
||||||
this.context!!,
|
this.context!!,
|
||||||
URL("https://metagif.files.wordpress.com/2015/01/bugbuckbunny.png"),
|
URL("https://metagif.files.wordpress.com/2015/01/bugbuckbunny.png"),
|
||||||
imageView,
|
imageView,
|
||||||
config = ApngDecoder.Config(bitmapConfig = Bitmap.Config.RGB_565, decodeCoverFrame = false),
|
config = ApngDecoder.Config(bitmapConfig = Bitmap.Config.RGB_565, decodeCoverFrame = true),
|
||||||
callback = object : ApngDecoder.Callback {
|
callback = object : ApngDecoder.Callback {
|
||||||
override fun onSuccess(drawable: Drawable) {
|
override fun onSuccess(drawable: Drawable) {
|
||||||
if (BuildConfig.DEBUG)
|
if (BuildConfig.DEBUG)
|
||||||
|
|
Loading…
Reference in New Issue