mirror of
https://github.com/mihonapp/mihon.git
synced 2024-11-06 02:37:26 +01:00
Compare commits
10 Commits
cb44853dc0
...
56b35d28bc
Author | SHA1 | Date | |
---|---|---|---|
|
56b35d28bc | ||
|
3cfc2be104 | ||
|
991f6b1908 | ||
|
6f88633ef5 | ||
|
541a29099e | ||
|
701a77a2d7 | ||
|
e19d302f5e | ||
|
c5d64b4224 | ||
|
bd0f43933d | ||
|
200cc60f5e |
@ -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)
|
||||||
}
|
}
|
||||||
|
@ -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),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -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
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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]
|
||||||
|
@ -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>
|
||||||
|
Loading…
Reference in New Issue
Block a user