From a68d35accab68e76df16c34a769c9b3427cf5ac1 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 (cherry picked from commit c5655e8803bc32d0931657f0b7bc6afeab70feaf) --- CHANGELOG.md | 9 +++++++-- .../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, 25 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 24114b87a2..c5775ab80a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,12 +11,16 @@ 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 - Bump default user agent ([@AntsyLich](https://github.com/AntsyLich)) ([`76dcf90`](https://github.com/mihonapp/mihon/commit/76dcf903403d565056f44c66d965c1ea8affffc3)) ### 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)) -- Extension repo URLs are now auto-formatted ([@AntsyLich](https://github.com/AntsyLich), [@MajorTanya](https://github.com/MajorTanya)) +- Extension repo URLs are now auto-formatted ([@AntsyLich](https://github.com/AntsyLich), [@MajorTanya](https://github.com/MajorTanya)) ([`22d8aad`](https://github.com/mihonapp/mihon/commit/22d8aad598bea8f00f2831779e45a6645392ca0f)) ### Fixed - Fix "currentTab was used multiple times" ([@AntsyLich](https://github.com/AntsyLich)) ([`371c143`](https://github.com/mihonapp/mihon/commit/371c1432e218f6dcf129f05405dceb2cd351c647)) @@ -277,7 +281,8 @@ The format is a modified version of [Keep a Changelog](https://keepachangelog.co - Branding to Mihon ([@AntsyLich](https://github.com/AntsyLich)) - Minimum supported Android version to 8 ([@AntsyLich](https://github.com/AntsyLich)) ([`dfb3091`](https://github.com/mihonapp/mihon/commit/dfb3091e380dda3e9bfb64bf5c9a685cf3a03d0e)) -[unreleased]: https://github.com/mihonapp/mihon/compare/v0.17.0...main +[unreleased]: https://github.com/mihonapp/mihon/compare/v0.17.1...main +[v0.17.1]: https://github.com/mihonapp/mihon/compare/v0.17.0...v0.17.1 [v0.17.0]: https://github.com/mihonapp/mihon/compare/v0.16.5...v0.17.0 [v0.16.5]: https://github.com/mihonapp/mihon/compare/v0.16.4...v0.16.5 [v0.16.4]: https://github.com/mihonapp/mihon/compare/v0.16.3...v0.16.4 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 e2651a5f3e..416ff42041 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 e897a8d8be..0326f29544 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 @@ -424,6 +424,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 b357a4dd02..7f258b701d 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 9729aa3405..e76d75873e 100644 --- a/i18n/src/commonMain/moko-resources/base/strings.xml +++ b/i18n/src/commonMain/moko-resources/base/strings.xml @@ -393,10 +393,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