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
adc513bbd9
commit
ff0f46d6a3
3 changed files with 10 additions and 3 deletions
|
@ -24,5 +24,5 @@
|
||||||
- Update dependency com.github.tachiyomiorg:image-decoder to e08e9be535
|
- Update dependency com.github.tachiyomiorg:image-decoder to e08e9be535
|
||||||
- Update dependency com.github.null2264:subsampling-scale-image-view to 338caedb5f
|
- Update dependency com.github.null2264:subsampling-scale-image-view to 338caedb5f
|
||||||
- Added Unit Test for version checker
|
- Added Unit Test for version checker
|
||||||
- Use Coil pipeline instead of SSIV for image decode (disabled due to a bug)
|
- Use Coil pipeline instead of SSIV for image decode whenever possible, might improve webtoon performance
|
||||||
- Migrated from Coil2 to Coil3
|
- Migrated from Coil2 to Coil3
|
||||||
|
|
|
@ -36,6 +36,7 @@ import eu.kanade.tachiyomi.ui.reader.viewer.pager.PagerConfig
|
||||||
import eu.kanade.tachiyomi.ui.reader.viewer.webtoon.WebtoonSubsamplingImageView
|
import eu.kanade.tachiyomi.ui.reader.viewer.webtoon.WebtoonSubsamplingImageView
|
||||||
import eu.kanade.tachiyomi.util.system.DeviceUtil
|
import eu.kanade.tachiyomi.util.system.DeviceUtil
|
||||||
import eu.kanade.tachiyomi.util.system.GLUtil
|
import eu.kanade.tachiyomi.util.system.GLUtil
|
||||||
|
import eu.kanade.tachiyomi.util.system.ImageUtil
|
||||||
import eu.kanade.tachiyomi.util.system.animatorDurationScale
|
import eu.kanade.tachiyomi.util.system.animatorDurationScale
|
||||||
import java.io.InputStream
|
import java.io.InputStream
|
||||||
import java.nio.ByteBuffer
|
import java.nio.ByteBuffer
|
||||||
|
@ -224,7 +225,8 @@ open class ReaderPageImageView @JvmOverloads constructor(
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
val useCoilPipeline = false // FIXME: "Bitmap too large to be uploaded into a texture"
|
val useCoilPipeline = isWebtoon && data is InputStream && ImageUtil.isMaxTextureSizeExceeded(data)
|
||||||
|
|
||||||
if (isWebtoon && useCoilPipeline) {
|
if (isWebtoon && useCoilPipeline) {
|
||||||
val request = ImageRequest.Builder(context)
|
val request = ImageRequest.Builder(context)
|
||||||
.data(data)
|
.data(data)
|
||||||
|
@ -232,7 +234,7 @@ open class ReaderPageImageView @JvmOverloads constructor(
|
||||||
.diskCachePolicy(CachePolicy.DISABLED)
|
.diskCachePolicy(CachePolicy.DISABLED)
|
||||||
.target(
|
.target(
|
||||||
onSuccess = { result ->
|
onSuccess = { result ->
|
||||||
val image = result as BitmapDrawable
|
val image = result.asDrawable(context.resources) as BitmapDrawable
|
||||||
setImage(ImageSource.bitmap(image.bitmap))
|
setImage(ImageSource.bitmap(image.bitmap))
|
||||||
isVisible = true
|
isVisible = true
|
||||||
},
|
},
|
||||||
|
|
|
@ -791,4 +791,9 @@ object ImageUtil {
|
||||||
// https://issuetracker.google.com/issues/182703810
|
// https://issuetracker.google.com/issues/182703810
|
||||||
"image/jxl" to "jxl",
|
"image/jxl" to "jxl",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
fun isMaxTextureSizeExceeded(imageStream: InputStream): Boolean {
|
||||||
|
val opts = extractImageOptions(imageStream)
|
||||||
|
return opts.outWidth >= GLUtil.maxTextureSize || opts.outHeight >= GLUtil.maxTextureSize
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue