Always use ARGB_8888 to avoid artifacts in images

This closes #343
This commit is contained in:
Ensar Sarajčić 2023-07-21 15:27:07 +02:00
parent 345f314a44
commit 92ea6d8138
2 changed files with 3 additions and 4 deletions

View file

@ -665,7 +665,7 @@ class PhotoFragment : ViewPagerFragment() {
}
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

View file

@ -9,8 +9,7 @@ class PicassoRegionDecoder(
val showHighestQuality: Boolean,
val screenWidth: Int,
val screenHeight: Int,
val minTileDpi: Int,
val isHeic: Boolean
val minTileDpi: Int
) : ImageRegionDecoder {
private var decoder: BitmapRegionDecoder? = null
private val decoderLock = Any()
@ -35,7 +34,7 @@ class PicassoRegionDecoder(
val options = BitmapFactory.Options()
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)
return bitmap ?: throw RuntimeException("Region decoder returned null bitmap - image format may not be supported")
}