mirror of
https://github.com/null2264/yokai.git
synced 2025-06-21 10:44:42 +00:00
refactor(reader): Improve hardware bitmap threshold option
This commit is contained in:
parent
37ba0634ac
commit
9322836e48
4 changed files with 24 additions and 9 deletions
|
@ -15,6 +15,8 @@ The format is simplified version of [Keep a Changelog](https://keepachangelog.co
|
||||||
- Sync DoH provider list with upstream (added Mullvad, Control D, Njalla, and Shecan)
|
- Sync DoH provider list with upstream (added Mullvad, Control D, Njalla, and Shecan)
|
||||||
- Added option to enable verbose logging
|
- Added option to enable verbose logging
|
||||||
- Added category hopper long-press action to open random series from **any** category
|
- Added category hopper long-press action to open random series from **any** category
|
||||||
|
- Added option to enable reader debug mode
|
||||||
|
- Added option to adjust reader's hardware bitmap threshold (@AntsyLich)
|
||||||
|
|
||||||
### Changes
|
### Changes
|
||||||
- Enable 'Split Tall Images' by default (@Smol-Ame)
|
- Enable 'Split Tall Images' by default (@Smol-Ame)
|
||||||
|
|
|
@ -401,7 +401,15 @@ class SettingsAdvancedController : SettingsLegacyController() {
|
||||||
titleRes = MR.strings.pref_hardware_bitmap_threshold
|
titleRes = MR.strings.pref_hardware_bitmap_threshold
|
||||||
|
|
||||||
val entryMap = GLUtil.CUSTOM_TEXTURE_LIMIT_OPTIONS
|
val entryMap = GLUtil.CUSTOM_TEXTURE_LIMIT_OPTIONS
|
||||||
.associateWith { it.toString() }
|
.mapIndexed { index, option ->
|
||||||
|
val display = if (index == 0) {
|
||||||
|
context.getString(MR.strings.pref_hardware_bitmap_threshold_default, option)
|
||||||
|
} else {
|
||||||
|
option.toString()
|
||||||
|
}
|
||||||
|
option to display
|
||||||
|
}
|
||||||
|
.toMap()
|
||||||
.toImmutableMap()
|
.toImmutableMap()
|
||||||
entries = entryMap.values.toList()
|
entries = entryMap.values.toList()
|
||||||
entryValues = entryMap.keys.toList()
|
entryValues = entryMap.keys.toList()
|
||||||
|
@ -409,7 +417,7 @@ class SettingsAdvancedController : SettingsLegacyController() {
|
||||||
isVisible = GLUtil.DEVICE_TEXTURE_LIMIT > GLUtil.SAFE_TEXTURE_LIMIT
|
isVisible = GLUtil.DEVICE_TEXTURE_LIMIT > GLUtil.SAFE_TEXTURE_LIMIT
|
||||||
|
|
||||||
basePreferences.hardwareBitmapThreshold().changesIn(viewScope) { threshold ->
|
basePreferences.hardwareBitmapThreshold().changesIn(viewScope) { threshold ->
|
||||||
summary = context.getString(MR.strings.pref_hardware_bitmap_threshold_summary, threshold)
|
summary = context.getString(MR.strings.pref_hardware_bitmap_threshold_summary, entryMap[threshold].orEmpty())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@ package eu.kanade.tachiyomi.util.system
|
||||||
import javax.microedition.khronos.egl.EGL10
|
import javax.microedition.khronos.egl.EGL10
|
||||||
import javax.microedition.khronos.egl.EGLConfig
|
import javax.microedition.khronos.egl.EGLConfig
|
||||||
import javax.microedition.khronos.egl.EGLContext
|
import javax.microedition.khronos.egl.EGLContext
|
||||||
|
import kotlin.math.max
|
||||||
|
|
||||||
object GLUtil {
|
object GLUtil {
|
||||||
val DEVICE_TEXTURE_LIMIT: Int by lazy {
|
val DEVICE_TEXTURE_LIMIT: Int by lazy {
|
||||||
|
@ -38,18 +39,21 @@ object GLUtil {
|
||||||
egl.eglTerminate(display)
|
egl.eglTerminate(display)
|
||||||
|
|
||||||
// Return largest texture size found (after making it a multiplier of [Multiplier]), or default
|
// Return largest texture size found (after making it a multiplier of [Multiplier]), or default
|
||||||
if (maximumTextureSize > SAFE_TEXTURE_LIMIT) {
|
max(maximumTextureSize, SAFE_TEXTURE_LIMIT)
|
||||||
(maximumTextureSize / MULTIPLIER) * MULTIPLIER
|
|
||||||
} else {
|
|
||||||
SAFE_TEXTURE_LIMIT
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const val SAFE_TEXTURE_LIMIT: Int = 2048
|
const val SAFE_TEXTURE_LIMIT: Int = 2048
|
||||||
|
|
||||||
val CUSTOM_TEXTURE_LIMIT_OPTIONS: List<Int> by lazy {
|
val CUSTOM_TEXTURE_LIMIT_OPTIONS: List<Int> by lazy {
|
||||||
val steps = ((DEVICE_TEXTURE_LIMIT / MULTIPLIER) - 1)
|
val steps = DEVICE_TEXTURE_LIMIT / MULTIPLIER
|
||||||
List(steps) { (it + 2) * MULTIPLIER }.asReversed()
|
buildList(steps) {
|
||||||
|
add(DEVICE_TEXTURE_LIMIT)
|
||||||
|
for (step in steps downTo 2) {
|
||||||
|
val value = step * MULTIPLIER
|
||||||
|
if (value >= DEVICE_TEXTURE_LIMIT) continue
|
||||||
|
add(value)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -514,6 +514,7 @@
|
||||||
<string name="pref_lowest">Lowest</string>
|
<string name="pref_lowest">Lowest</string>
|
||||||
<string name="pref_display_profile">Custom display profile</string>
|
<string name="pref_display_profile">Custom display profile</string>
|
||||||
<string name="pref_hardware_bitmap_threshold">Custom hardware bitmap threshold</string>
|
<string name="pref_hardware_bitmap_threshold">Custom hardware bitmap threshold</string>
|
||||||
|
<string name="pref_hardware_bitmap_threshold_default">Default (%d)</string>
|
||||||
<string name="pref_hardware_bitmap_threshold_summary">If reader loads a blank image incrementally reduce the threshold.\nSelected: %s</string>
|
<string name="pref_hardware_bitmap_threshold_summary">If reader loads a blank image incrementally reduce the threshold.\nSelected: %s</string>
|
||||||
<string name="pref_double_tap_zoom">Double tap to zoom</string>
|
<string name="pref_double_tap_zoom">Double tap to zoom</string>
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue