fix(manga-cover-dialog): Avoid crash with SubsamplingScaleImageView (SSIV) not fully support Hardware decoder (#1319)
* Avoid crash with SubsamplingScaleImageView (SSIV) not fully support Hardware decoder * keep original config if it's not Hardware * refactor
This commit is contained in:
parent
2d5497dcd9
commit
51c1f95791
1 changed files with 5 additions and 1 deletions
|
|
@ -212,7 +212,11 @@ fun MangaCoverDialog(
|
|||
|
||||
// Copy bitmap in case it came from memory cache
|
||||
// Because SSIV needs to thoroughly read the image
|
||||
val copy = (drawable as? BitmapDrawable)?.bitmap?.copy(Bitmap.Config.HARDWARE, false)
|
||||
// KMK -->
|
||||
val src = (drawable as? BitmapDrawable)?.bitmap
|
||||
val config = src?.config?.takeIf { it != Bitmap.Config.HARDWARE } ?: Bitmap.Config.ARGB_8888
|
||||
// KMK <--
|
||||
val copy = src?.copy(config, false)
|
||||
?.toDrawable(view.context.resources)
|
||||
?: drawable
|
||||
view.setImage(copy, ReaderPageImageView.Config(zoomDuration = 500))
|
||||
|
|
|
|||
Loading…
Reference in a new issue