Merge branch 'fix/343-use-argb8888' of github.com:esensar/Simple-Gallery

This commit is contained in:
tibbi 2023-07-23 23:23:27 +02:00
commit 46be768a17
2 changed files with 3 additions and 4 deletions

View file

@ -665,7 +665,7 @@ class PhotoFragment : ViewPagerFragment() {
} }
val regionDecoder = object : DecoderFactory<ImageRegionDecoder> { val regionDecoder = object : DecoderFactory<ImageRegionDecoder> {
override fun make() = PicassoRegionDecoder(showHighestQuality, mScreenWidth, mScreenHeight, minTileDpi, mMedium.isHeic()) override fun make() = PicassoRegionDecoder(showHighestQuality, mScreenWidth, mScreenHeight, minTileDpi)
} }
var newOrientation = (rotation + mCurrentRotationDegrees) % 360 var newOrientation = (rotation + mCurrentRotationDegrees) % 360

View file

@ -9,8 +9,7 @@ class PicassoRegionDecoder(
val showHighestQuality: Boolean, val showHighestQuality: Boolean,
val screenWidth: Int, val screenWidth: Int,
val screenHeight: Int, val screenHeight: Int,
val minTileDpi: Int, val minTileDpi: Int
val isHeic: Boolean
) : ImageRegionDecoder { ) : ImageRegionDecoder {
private var decoder: BitmapRegionDecoder? = null private var decoder: BitmapRegionDecoder? = null
private val decoderLock = Any() private val decoderLock = Any()
@ -35,7 +34,7 @@ class PicassoRegionDecoder(
val options = BitmapFactory.Options() val options = BitmapFactory.Options()
options.inSampleSize = newSampleSize options.inSampleSize = newSampleSize
options.inPreferredConfig = if (showHighestQuality || isHeic) Bitmap.Config.ARGB_8888 else Bitmap.Config.RGB_565 options.inPreferredConfig = Bitmap.Config.ARGB_8888
val bitmap = decoder!!.decodeRegion(rect, options) val bitmap = decoder!!.decodeRegion(rect, options)
return bitmap ?: throw RuntimeException("Region decoder returned null bitmap - image format may not be supported") return bitmap ?: throw RuntimeException("Region decoder returned null bitmap - image format may not be supported")
} }