From c5655e8803bc32d0931657f0b7bc6afeab70feaf Mon Sep 17 00:00:00 2001 From: AntsyLich <59261191+AntsyLich@users.noreply.github.com> Date: Sun, 22 Dec 2024 01:50:09 +0600 Subject: [PATCH] Revert "Revert "Add option to always use SSIV for image decoding"" This reverts commit 1909126921ac78309f7f7c7c2aa85606611531b8 --- CHANGELOG.md | 2 ++ .../main/java/eu/kanade/domain/base/BasePreferences.kt | 2 ++ .../more/settings/screen/SettingsAdvancedScreen.kt | 5 +++++ .../tachiyomi/ui/reader/viewer/ReaderPageImageView.kt | 9 ++++++++- i18n/src/commonMain/moko-resources/base/strings.xml | 4 +++- 5 files changed, 20 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d47751016..c5775ab80 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,8 @@ The format is a modified version of [Keep a Changelog](https://keepachangelog.co - `Other` - for technical stuff. ## [Unreleased] +### Added +- Add option to always decode long strip images with SSIV ## [v0.17.1] - 2024-12-06 ### Changed diff --git a/app/src/main/java/eu/kanade/domain/base/BasePreferences.kt b/app/src/main/java/eu/kanade/domain/base/BasePreferences.kt index e2651a5f3..416ff4204 100644 --- a/app/src/main/java/eu/kanade/domain/base/BasePreferences.kt +++ b/app/src/main/java/eu/kanade/domain/base/BasePreferences.kt @@ -33,4 +33,6 @@ class BasePreferences( fun displayProfile() = preferenceStore.getString("pref_display_profile_key", "") fun hardwareBitmapThreshold() = preferenceStore.getInt("pref_hardware_bitmap_threshold", GLUtil.SAFE_TEXTURE_LIMIT) + + fun alwaysDecodeLongStripWithSSIV() = preferenceStore.getBoolean("pref_always_decode_long_strip_with_ssiv", false) } diff --git a/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsAdvancedScreen.kt b/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsAdvancedScreen.kt index e8e15d107..8e239f075 100644 --- a/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsAdvancedScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsAdvancedScreen.kt @@ -356,6 +356,11 @@ object SettingsAdvancedScreen : SearchableSettings { .toMap() .toImmutableMap(), ), + Preference.PreferenceItem.SwitchPreference( + pref = basePreferences.alwaysDecodeLongStripWithSSIV(), + title = stringResource(MR.strings.pref_always_decode_long_strip_with_ssiv), + subtitle = stringResource(MR.strings.pref_always_decode_long_strip_with_ssiv_summary), + ), Preference.PreferenceItem.TextPreference( title = stringResource(MR.strings.pref_display_profile), subtitle = basePreferences.displayProfile().get(), diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/ReaderPageImageView.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/ReaderPageImageView.kt index c1f4a2328..b9173ab66 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/ReaderPageImageView.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/ReaderPageImageView.kt @@ -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 @@ -40,6 +41,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. @@ -57,6 +60,10 @@ open class ReaderPageImageView @JvmOverloads constructor( private val isWebtoon: Boolean = false, ) : FrameLayout(context, attrs, defStyleAttrs, defStyleRes) { + private val alwaysDecodeLongStripWithSSIV by lazy { + Injekt.get().alwaysDecodeLongStripWithSSIV().get() + } + private var pageView: View? = null private var config: Config? = null @@ -294,7 +301,7 @@ open class ReaderPageImageView @JvmOverloads constructor( isVisible = true } is BufferedSource -> { - if (!isWebtoon) { + if (!isWebtoon || alwaysDecodeLongStripWithSSIV) { setHardwareConfig(ImageUtil.canUseHardwareBitmap(data)) setImage(ImageSource.inputStream(data.inputStream())) isVisible = true diff --git a/i18n/src/commonMain/moko-resources/base/strings.xml b/i18n/src/commonMain/moko-resources/base/strings.xml index a07f533da..05b72f4e5 100644 --- a/i18n/src/commonMain/moko-resources/base/strings.xml +++ b/i18n/src/commonMain/moko-resources/base/strings.xml @@ -391,10 +391,12 @@ Show page number Show reading mode Briefly show current mode when reader is opened - Custom display profile Custom hardware bitmap threshold Default (%d) If reader loads a blank image incrementally reduce the threshold.\nSelected: %s + Always decode long strip images with SSIV + Affects performance. Only enable if reducing bitmap threshold doesn\'t fix blank image issues + Custom display profile Crop borders Custom brightness Grayscale