mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-26 22:47:59 +01:00
really use argb_8888 format at max quality
This commit is contained in:
parent
4b546b6d52
commit
1dd06fc09a
3 changed files with 8 additions and 7 deletions
|
@ -61,7 +61,7 @@ android {
|
|||
}
|
||||
|
||||
dependencies {
|
||||
implementation 'com.simplemobiletools:commons:5.8.5'
|
||||
implementation 'com.simplemobiletools:commons:5.8.7'
|
||||
implementation 'com.theartofdev.edmodo:android-image-cropper:2.8.0'
|
||||
implementation 'androidx.multidex:multidex:2.0.1'
|
||||
implementation 'it.sephiroth.android.exif:library:1.0.1'
|
||||
|
|
|
@ -438,13 +438,15 @@ class PhotoFragment : ViewPagerFragment() {
|
|||
private fun addZoomableView() {
|
||||
val rotation = degreesForRotation(mImageOrientation)
|
||||
mIsSubsamplingVisible = true
|
||||
val config = context!!.config
|
||||
val showHighestQuality = config.showHighestQuality
|
||||
|
||||
val bitmapDecoder = object : DecoderFactory<ImageDecoder> {
|
||||
override fun make() = PicassoDecoder(mMedium.path, Picasso.get(), rotation)
|
||||
}
|
||||
|
||||
val regionDecoder = object : DecoderFactory<ImageRegionDecoder> {
|
||||
override fun make() = PicassoRegionDecoder()
|
||||
override fun make() = PicassoRegionDecoder(showHighestQuality)
|
||||
}
|
||||
|
||||
var newOrientation = (rotation + mCurrentRotationDegrees) % 360
|
||||
|
@ -452,10 +454,9 @@ class PhotoFragment : ViewPagerFragment() {
|
|||
newOrientation += 360
|
||||
}
|
||||
|
||||
val config = context!!.config
|
||||
mView.subsampling_view.apply {
|
||||
setMaxTileSize(if (config.showHighestQuality) Integer.MAX_VALUE else 4096)
|
||||
setMinimumTileDpi(if (config.showHighestQuality) -1 else getMinTileDpi())
|
||||
setMaxTileSize(if (showHighestQuality) Integer.MAX_VALUE else 4096)
|
||||
setMinimumTileDpi(if (showHighestQuality) -1 else getMinTileDpi())
|
||||
background = ColorDrawable(Color.TRANSPARENT)
|
||||
bitmapDecoderFactory = bitmapDecoder
|
||||
regionDecoderFactory = regionDecoder
|
||||
|
|
|
@ -5,7 +5,7 @@ import android.graphics.*
|
|||
import android.net.Uri
|
||||
import com.davemorrissey.labs.subscaleview.ImageRegionDecoder
|
||||
|
||||
class PicassoRegionDecoder : ImageRegionDecoder {
|
||||
class PicassoRegionDecoder(val showHighestQuality: Boolean) : ImageRegionDecoder {
|
||||
private var decoder: BitmapRegionDecoder? = null
|
||||
private val decoderLock = Any()
|
||||
|
||||
|
@ -20,7 +20,7 @@ class PicassoRegionDecoder : ImageRegionDecoder {
|
|||
synchronized(decoderLock) {
|
||||
val options = BitmapFactory.Options()
|
||||
options.inSampleSize = sampleSize
|
||||
options.inPreferredConfig = Bitmap.Config.RGB_565
|
||||
options.inPreferredConfig = if (showHighestQuality) Bitmap.Config.ARGB_8888 else Bitmap.Config.RGB_565
|
||||
val bitmap = decoder!!.decodeRegion(rect, options)
|
||||
return bitmap ?: throw RuntimeException("Region decoder returned null bitmap - image format may not be supported")
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue