Switch to hardware bitmap in reader only if device can handle it

Closes #1460

(cherry picked from commit e6d96bd348ea5d18a005d6465222ad5f5123103e)

# Conflicts:
#	app/src/main/java/eu/kanade/tachiyomi/data/coil/TachiyomiImageDecoder.kt
#	app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/ReaderPageImageView.kt
This commit is contained in:
AntsyLich
2024-11-17 03:04:38 +06:00
committed by Jobobby04
parent 1a28c7fb35
commit d286cf3267
4 changed files with 39 additions and 33 deletions
@@ -360,9 +360,18 @@ object ImageUtil {
val bottomOffset = topOffset + splitHeight
}
fun canUseCoilToDecode(imageSource: BufferedSource): Boolean {
val options = extractImageOptions(imageSource)
return maxOf(options.outWidth, options.outHeight) <= GLUtil.maxTextureSize
fun canUseHardwareBitmap(bitmap: Bitmap): Boolean {
return canUseHardwareBitmap(bitmap.width, bitmap.height)
}
fun canUseHardwareBitmap(imageSource: BufferedSource): Boolean {
return with(extractImageOptions(imageSource)) {
canUseHardwareBitmap(outWidth, outHeight)
}
}
private fun canUseHardwareBitmap(width: Int, height: Int): Boolean {
return maxOf(width, height) <= GLUtil.maxTextureSize
}
/**