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:
@@ -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
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user