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) -> {
|
||||
val w = if (png == null) {
|
||||
if (isApng && !config.decodeCoverFrame) {
|
||||
if (BuildConfig.DEBUG)
|
||||
Log.d(TAG, "Ignoring cover frame")
|
||||
continue
|
||||
}
|
||||
if (cover == null) {
|
||||
cover = ByteArrayOutputStream()
|
||||
cover.write(Utils.pngSignature)
|
||||
|
|
|
@ -55,7 +55,7 @@ class ViewerActivity : AppCompatActivity() {
|
|||
override fun onError(error: Exception) {
|
||||
Log.e("ViewerActivity", "Error when loading file", error)
|
||||
}
|
||||
})
|
||||
}, ApngDecoder.Config(decodeCoverFrame = false))
|
||||
}
|
||||
|
||||
override fun onRequestPermissionsResult(requestCode: Int,
|
||||
|
|
|
@ -37,7 +37,7 @@ class ApngDecoderFragment : Fragment() {
|
|||
this.context!!,
|
||||
URL("https://metagif.files.wordpress.com/2015/01/bugbuckbunny.png"),
|
||||
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 {
|
||||
override fun onSuccess(drawable: Drawable) {
|
||||
if (BuildConfig.DEBUG)
|
||||
|
|
Loading…
Reference in New Issue