mirror of
https://github.com/mihonapp/mihon.git
synced 2025-06-29 12:37:50 +02:00
Switch to hardware bitmap in reader only if device can handle it
Closes #1460
This commit is contained in:
@ -310,9 +310,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
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user