Add option to always use SSIV for image decoding

This commit is contained in:
AntsyLich 2024-11-02 20:12:53 +06:00
parent ee134fce58
commit bb4d9fc81a
No known key found for this signature in database
5 changed files with 14 additions and 1 deletions

View file

@ -18,6 +18,7 @@ The format is a modified version of [Keep a Changelog](https://keepachangelog.co
- Fixed "currentTab was used multiple times"
- Fixed a rare crash when invoking "Mark previous as read" action
- Fixed long strip images not loading in some old devices
- Added option to always use SSIV for image decoding
### Improved
- Bangumi search now shows the score and summary of a search result ([@MajorTanya](https://github.com/MajorTanya)) ([#1396](https://github.com/mihonapp/mihon/pull/1396))

View file

@ -30,4 +30,6 @@ class BasePreferences(
}
fun displayProfile() = preferenceStore.getString("pref_display_profile_key", "")
fun alwaysUseSSIVToDecode() = preferenceStore.getBoolean("pref_always_use_ssiv_to_decode", false)
}

View file

@ -341,6 +341,10 @@ object SettingsAdvancedScreen : SearchableSettings {
chooseColorProfile.launch(arrayOf("*/*"))
},
),
Preference.PreferenceItem.SwitchPreference(
pref = basePreferences.alwaysUseSSIVToDecode(),
title = stringResource(MR.strings.pref_always_use_ssiv_to_decode),
),
),
)
}

View file

@ -33,6 +33,7 @@ import com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView.EASE_IN_OUT
import com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView.EASE_OUT_QUAD
import com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView.SCALE_TYPE_CENTER_INSIDE
import com.github.chrisbanes.photoview.PhotoView
import eu.kanade.domain.base.BasePreferences
import eu.kanade.tachiyomi.data.coil.cropBorders
import eu.kanade.tachiyomi.data.coil.customDecoder
import eu.kanade.tachiyomi.ui.reader.viewer.webtoon.WebtoonSubsamplingImageView
@ -41,6 +42,8 @@ import eu.kanade.tachiyomi.util.system.animatorDurationScale
import eu.kanade.tachiyomi.util.view.isVisibleOnScreen
import okio.BufferedSource
import tachiyomi.core.common.util.system.ImageUtil
import uy.kohesive.injekt.Injekt
import uy.kohesive.injekt.api.get
/**
* A wrapper view for showing page image.
@ -58,6 +61,8 @@ open class ReaderPageImageView @JvmOverloads constructor(
private val isWebtoon: Boolean = false,
) : FrameLayout(context, attrs, defStyleAttrs, defStyleRes) {
private val alwaysUseSSIVToDecode by lazy { Injekt.get<BasePreferences>().alwaysUseSSIVToDecode().get() }
private var pageView: View? = null
private var config: Config? = null
@ -295,7 +300,7 @@ open class ReaderPageImageView @JvmOverloads constructor(
isVisible = true
}
is BufferedSource -> {
if (!isWebtoon || !ImageUtil.canUseCoilToDecode(data)) {
if (alwaysUseSSIVToDecode || !isWebtoon || !ImageUtil.canUseCoilToDecode(data)) {
setImage(ImageSource.inputStream(data.inputStream()))
isVisible = true
} else {

View file

@ -392,6 +392,7 @@
<string name="pref_show_reading_mode">Show reading mode</string>
<string name="pref_show_reading_mode_summary">Briefly show current mode when reader is opened</string>
<string name="pref_display_profile">Custom display profile</string>
<string name="pref_always_use_ssiv_to_decode">Always use SSIV to decode long strip images</string>
<string name="pref_crop_borders">Crop borders</string>
<string name="pref_custom_brightness">Custom brightness</string>
<string name="pref_grayscale">Grayscale</string>