Compare commits

...

10 Commits

Author SHA1 Message Date
Raikuha
56b35d28bc
Merge 991f6b1908 into 3cfc2be104 2024-11-05 16:55:21 -03:00
Mend Renovate
3cfc2be104
Update dependency com.pinterest.ktlint:ktlint-cli to v1.4.1 (#1449) 2024-11-06 00:48:00 +06:00
Raikuha
991f6b1908
Update strings.xml 2024-11-05 02:12:41 -03:00
Raikuha
6f88633ef5
Update TachiyomiImageDecoder.kt 2024-11-05 02:08:19 -03:00
Raikuha
541a29099e
Deem images safe if they're within the view dimensions
Some pages present flickering due to having dimensions that surpass those calculated in SubsamplingScaleImageView.
2024-11-05 02:06:21 -03:00
Raikuha
701a77a2d7
- Relocate variable for better lecture flow 2024-11-04 13:47:09 -03:00
Raikuha
e19d302f5e
Update strings.xml 2024-11-04 02:17:57 -03:00
Raikuha
c5d64b4224
Add optional fallback under Advanced Settings 2024-11-04 02:16:48 -03:00
Raikuha
bd0f43933d
Add a toggle so users need to opt-in rather than enforcing it 2024-11-04 02:12:48 -03:00
Raikuha
200cc60f5e
- Add an option to only skip hwBitmap when it could cause empty textures
Debugging shows images may have bigger dimensions than expected. To avoid exceeding maxTextureSize, a second optional check is added, controlled by a toggle under Advanced Settings.
2024-11-04 02:10:24 -03:00
5 changed files with 21 additions and 5 deletions

View File

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

View File

@ -345,6 +345,10 @@ object SettingsAdvancedScreen : SearchableSettings {
pref = basePreferences.alwaysUseSSIVToDecode(), pref = basePreferences.alwaysUseSSIVToDecode(),
title = stringResource(MR.strings.pref_always_use_ssiv_to_decode), title = stringResource(MR.strings.pref_always_use_ssiv_to_decode),
), ),
Preference.PreferenceItem.SwitchPreference(
pref = basePreferences.fallbackForLongStrips(),
title = stringResource(MR.strings.pref_fallback_for_long_strips),
),
), ),
) )
} }

View File

@ -10,10 +10,13 @@ import coil3.decode.ImageSource
import coil3.fetch.SourceFetchResult import coil3.fetch.SourceFetchResult
import coil3.request.Options import coil3.request.Options
import coil3.request.bitmapConfig import coil3.request.bitmapConfig
import eu.kanade.domain.base.BasePreferences
import eu.kanade.tachiyomi.util.system.GLUtil import eu.kanade.tachiyomi.util.system.GLUtil
import okio.BufferedSource import okio.BufferedSource
import tachiyomi.core.common.util.system.ImageUtil import tachiyomi.core.common.util.system.ImageUtil
import tachiyomi.decoder.ImageDecoder import tachiyomi.decoder.ImageDecoder
import uy.kohesive.injekt.Injekt
import uy.kohesive.injekt.api.get
/** /**
* A [Decoder] that uses built-in [ImageDecoder] to decode images that is not supported by the system. * A [Decoder] that uses built-in [ImageDecoder] to decode images that is not supported by the system.
@ -27,6 +30,8 @@ class TachiyomiImageDecoder(private val resources: ImageSource, private val opti
check(decoder != null && decoder.width > 0 && decoder.height > 0) { "Failed to initialize decoder" } check(decoder != null && decoder.width > 0 && decoder.height > 0) { "Failed to initialize decoder" }
val fallbackForLongStrips by lazy { Injekt.get<BasePreferences>().fallbackForLongStrips().get() }
val srcWidth = decoder.width val srcWidth = decoder.width
val srcHeight = decoder.height val srcHeight = decoder.height
@ -50,10 +55,14 @@ class TachiyomiImageDecoder(private val resources: ImageSource, private val opti
options.bitmapConfig == Bitmap.Config.HARDWARE && options.bitmapConfig == Bitmap.Config.HARDWARE &&
maxOf(bitmap.width, bitmap.height) <= GLUtil.maxTextureSize maxOf(bitmap.width, bitmap.height) <= GLUtil.maxTextureSize
) { ) {
val hwBitmap = bitmap.copy(Bitmap.Config.HARDWARE, false) if (
if (hwBitmap != null) { !fallbackForLongStrips || bitmap.width < dstWidth && bitmap.height*1.1 <= GLUtil.maxTextureSize
bitmap.recycle() ) {
bitmap = hwBitmap val hwBitmap = bitmap.copy(Bitmap.Config.HARDWARE, false)
if (hwBitmap != null) {
bitmap.recycle()
bitmap = hwBitmap
}
} }
} }

View File

@ -9,7 +9,7 @@ sqldelight = "2.0.2"
sqlite = "2.4.0" sqlite = "2.4.0"
voyager = "1.0.0" voyager = "1.0.0"
spotless = "7.0.0.BETA4" spotless = "7.0.0.BETA4"
ktlint-core = "1.4.0" ktlint-core = "1.4.1"
firebase-bom = "33.5.1" firebase-bom = "33.5.1"
[libraries] [libraries]

View File

@ -393,6 +393,7 @@
<string name="pref_show_reading_mode_summary">Briefly show current mode when reader is opened</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_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_always_use_ssiv_to_decode">Always use SSIV to decode long strip images</string>
<string name="pref_fallback_for_long_strips">Add safety checks to load vertical strips</string>
<string name="pref_crop_borders">Crop borders</string> <string name="pref_crop_borders">Crop borders</string>
<string name="pref_custom_brightness">Custom brightness</string> <string name="pref_custom_brightness">Custom brightness</string>
<string name="pref_grayscale">Grayscale</string> <string name="pref_grayscale">Grayscale</string>