mirror of
https://github.com/null2264/yokai.git
synced 2025-06-21 10:44:42 +00:00
fix: Make it so bitmap also use coil pipeline if possible
This commit is contained in:
parent
70230fa16d
commit
b4317f8f3b
2 changed files with 13 additions and 1 deletions
|
@ -224,7 +224,15 @@ open class ReaderPageImageView @JvmOverloads constructor(
|
|||
},
|
||||
)
|
||||
|
||||
val useCoilPipeline = if (isWebtoon && data is BufferedSource) !ImageUtil.isMaxTextureSizeExceeded(data) else false
|
||||
val useCoilPipeline = if (isWebtoon) {
|
||||
when (data) {
|
||||
is BitmapDrawable -> !ImageUtil.isMaxTextureSizeExceeded(data.bitmap)
|
||||
is BufferedSource -> !ImageUtil.isMaxTextureSizeExceeded(data)
|
||||
else -> false
|
||||
}
|
||||
} else {
|
||||
false
|
||||
}
|
||||
|
||||
if (useCoilPipeline) {
|
||||
val request = ImageRequest.Builder(context)
|
||||
|
|
|
@ -783,6 +783,10 @@ object ImageUtil {
|
|||
"image/jxl" to "jxl",
|
||||
)
|
||||
|
||||
fun isMaxTextureSizeExceeded(bitmap: Bitmap): Boolean {
|
||||
return maxOf(bitmap.width, bitmap.height) > GLUtil.maxTextureSize
|
||||
}
|
||||
|
||||
fun isMaxTextureSizeExceeded(imageSource: BufferedSource): Boolean {
|
||||
val opts = extractImageOptions(imageSource)
|
||||
return maxOf(opts.outWidth, opts.outHeight) > GLUtil.maxTextureSize
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue