mirror of
https://github.com/null2264/yokai.git
synced 2025-06-21 10:44:42 +00:00
feat: Use coil pipeline if bitmap did not exceed texture max size
This commit is contained in:
parent
9b5130f2d2
commit
f851c585a7
1 changed files with 11 additions and 1 deletions
|
@ -2,6 +2,7 @@ package eu.kanade.tachiyomi.ui.reader.viewer
|
||||||
|
|
||||||
import android.app.Activity
|
import android.app.Activity
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
|
import android.graphics.BitmapFactory
|
||||||
import android.graphics.PointF
|
import android.graphics.PointF
|
||||||
import android.graphics.drawable.Animatable
|
import android.graphics.drawable.Animatable
|
||||||
import android.graphics.drawable.BitmapDrawable
|
import android.graphics.drawable.BitmapDrawable
|
||||||
|
@ -224,7 +225,16 @@ open class ReaderPageImageView @JvmOverloads constructor(
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
val useCoilPipeline = false // FIXME: "Bitmap too large to be uploaded into a texture"
|
var useCoilPipeline = false
|
||||||
|
|
||||||
|
if (isWebtoon && data is InputStream) {
|
||||||
|
val opts = BitmapFactory.Options()
|
||||||
|
opts.inJustDecodeBounds = true
|
||||||
|
val bitmap = BitmapFactory.decodeStream(data, null, opts)
|
||||||
|
if (bitmap != null)
|
||||||
|
useCoilPipeline = bitmap.width <= GLUtil.maxTextureSize && bitmap.height <= GLUtil.maxTextureSize
|
||||||
|
}
|
||||||
|
|
||||||
if (isWebtoon && useCoilPipeline) {
|
if (isWebtoon && useCoilPipeline) {
|
||||||
val request = ImageRequest.Builder(context)
|
val request = ImageRequest.Builder(context)
|
||||||
.data(data)
|
.data(data)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue