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:
Cuong-Tran 2025-12-09 16:16:05 +07:00 committed by GitHub
parent 2d5497dcd9
commit 51c1f95791
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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))