diff --git a/CHANGELOG.md b/CHANGELOG.md index 4002e8496d..f5ae827eb3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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) - Added option to enable verbose logging - 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 - Enable 'Split Tall Images' by default (@Smol-Ame) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/controllers/SettingsAdvancedController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/controllers/SettingsAdvancedController.kt index 3b33a53a36..97f12ffc58 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/controllers/SettingsAdvancedController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/controllers/SettingsAdvancedController.kt @@ -401,7 +401,15 @@ class SettingsAdvancedController : SettingsLegacyController() { titleRes = MR.strings.pref_hardware_bitmap_threshold 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() entries = entryMap.values.toList() entryValues = entryMap.keys.toList() @@ -409,7 +417,7 @@ class SettingsAdvancedController : SettingsLegacyController() { isVisible = GLUtil.DEVICE_TEXTURE_LIMIT > GLUtil.SAFE_TEXTURE_LIMIT 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()) } } diff --git a/app/src/main/java/eu/kanade/tachiyomi/util/system/GLUtil.kt b/app/src/main/java/eu/kanade/tachiyomi/util/system/GLUtil.kt index a3a3ac6216..edd01ac370 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/util/system/GLUtil.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/util/system/GLUtil.kt @@ -3,6 +3,7 @@ package eu.kanade.tachiyomi.util.system import javax.microedition.khronos.egl.EGL10 import javax.microedition.khronos.egl.EGLConfig import javax.microedition.khronos.egl.EGLContext +import kotlin.math.max object GLUtil { val DEVICE_TEXTURE_LIMIT: Int by lazy { @@ -38,18 +39,21 @@ object GLUtil { egl.eglTerminate(display) // Return largest texture size found (after making it a multiplier of [Multiplier]), or default - if (maximumTextureSize > SAFE_TEXTURE_LIMIT) { - (maximumTextureSize / MULTIPLIER) * MULTIPLIER - } else { - SAFE_TEXTURE_LIMIT - } + max(maximumTextureSize, SAFE_TEXTURE_LIMIT) } const val SAFE_TEXTURE_LIMIT: Int = 2048 val CUSTOM_TEXTURE_LIMIT_OPTIONS: List by lazy { - val steps = ((DEVICE_TEXTURE_LIMIT / MULTIPLIER) - 1) - List(steps) { (it + 2) * MULTIPLIER }.asReversed() + val steps = DEVICE_TEXTURE_LIMIT / MULTIPLIER + buildList(steps) { + add(DEVICE_TEXTURE_LIMIT) + for (step in steps downTo 2) { + val value = step * MULTIPLIER + if (value >= DEVICE_TEXTURE_LIMIT) continue + add(value) + } + } } } diff --git a/i18n/src/commonMain/moko-resources/base/strings.xml b/i18n/src/commonMain/moko-resources/base/strings.xml index a74e0d3b3a..1ac8fdb86f 100644 --- a/i18n/src/commonMain/moko-resources/base/strings.xml +++ b/i18n/src/commonMain/moko-resources/base/strings.xml @@ -514,6 +514,7 @@ Lowest Custom display profile Custom hardware bitmap threshold + Default (%d) If reader loads a blank image incrementally reduce the threshold.\nSelected: %s Double tap to zoom