enhance: Increase max texture size

This commit is contained in:
Ahmad Ansori Palembani 2024-05-23 18:11:56 +07:00
parent 2063a5a096
commit ec3e307933
Signed by: null2264
GPG key ID: BA64F8B60AF3EFB6

View file

@ -55,18 +55,19 @@ class TachiyomiImageDecoder(private val resources: ImageSource, private val opti
} }
} }
if (maxOf(bitmap.width, bitmap.height) > GLUtil.maxTextureSize) { val maxTextureSize = 4096f
val widthRatio = bitmap.width / GLUtil.maxTextureSize.toFloat() if (maxOf(bitmap.width, bitmap.height) > maxTextureSize) {
val heightRatio = bitmap.height / GLUtil.maxTextureSize.toFloat() val widthRatio = bitmap.width / maxTextureSize
val heightRatio = bitmap.height / maxTextureSize
val targetWidth: Float val targetWidth: Float
val targetHeight: Float val targetHeight: Float
if (widthRatio >= heightRatio) { if (widthRatio >= heightRatio) {
targetWidth = GLUtil.maxTextureSize.toFloat() targetWidth = maxTextureSize
targetHeight = (targetWidth / bitmap.width) * bitmap.height targetHeight = (targetWidth / bitmap.width) * bitmap.height
} else { } else {
targetHeight = GLUtil.maxTextureSize.toFloat() targetHeight = maxTextureSize
targetWidth = (targetHeight / bitmap.height) * bitmap.width targetWidth = (targetHeight / bitmap.height) * bitmap.width
} }