Bump webgpuviewer, fix animated images background color (#3843)

This commit is contained in:
w
2026-08-23 01:06:12 -07:00
committed by GitHub
parent 270b78ba95
commit e3813028bd
5 changed files with 20 additions and 5 deletions
@@ -259,6 +259,7 @@ class ReaderPreferences(
FADE_WHITE( FADE_WHITE(
MR.strings.transition_animation_fade_white, MR.strings.transition_animation_fade_white,
), ),
NONE(MR.strings.transition_animation_none),
} }
enum class CutoutMode(val titleRes: StringResource) { enum class CutoutMode(val titleRes: StringResource) {
@@ -23,6 +23,7 @@ import ca.mpreg.webgpuviewer.transition.TransitionFade
import ca.mpreg.webgpuviewer.transition.TransitionFadeWhite import ca.mpreg.webgpuviewer.transition.TransitionFadeWhite
import ca.mpreg.webgpuviewer.transition.TransitionFlipLeft import ca.mpreg.webgpuviewer.transition.TransitionFlipLeft
import ca.mpreg.webgpuviewer.transition.TransitionFlipRight import ca.mpreg.webgpuviewer.transition.TransitionFlipRight
import ca.mpreg.webgpuviewer.transition.TransitionNone
import ca.mpreg.webgpuviewer.transition.TransitionSphere import ca.mpreg.webgpuviewer.transition.TransitionSphere
import ca.mpreg.webgpuviewer.transition.TransitionStackDown import ca.mpreg.webgpuviewer.transition.TransitionStackDown
import ca.mpreg.webgpuviewer.transition.TransitionStackLeft import ca.mpreg.webgpuviewer.transition.TransitionStackLeft
@@ -584,6 +585,7 @@ open class WebGpuViewer(
TransitionAnimation.CUBE_OUTSIDE -> TransitionCubeOuter TransitionAnimation.CUBE_OUTSIDE -> TransitionCubeOuter
TransitionAnimation.FADE -> TransitionFade TransitionAnimation.FADE -> TransitionFade
TransitionAnimation.FADE_WHITE -> TransitionFadeWhite TransitionAnimation.FADE_WHITE -> TransitionFadeWhite
TransitionAnimation.NONE -> TransitionNone
} }
when (config.cutoutMode) { when (config.cutoutMode) {
@@ -880,7 +882,7 @@ open class WebGpuViewer(
readerBackgroundColor() readerBackgroundColor()
} }
val firstImage = Image.createWithTrim( val firstImage = Image(
firstFrame.image, firstFrame.image,
firstFrame.width, firstFrame.width,
firstFrame.height, firstFrame.height,
@@ -902,9 +904,20 @@ open class WebGpuViewer(
if (pageCount > 1) { if (pageCount > 1) {
val frames = ArrayList<Pair<Image, Int>>(pageCount) val frames = ArrayList<Pair<Image, Int>>(pageCount)
frames.add(Pair(firstImage, firstFrame.duration)) frames.add(Pair(firstImage, firstFrame.duration))
for (i in 1 until pageCount) { repeat(pageCount - 1) {
val frame = dec.decodeNext() val frame = dec.decodeNext()
frames.add(Pair(Image(frame.image, frame.width, frame.height), frame.duration)) frames.add(
Pair(
Image(
frame.image,
frame.width,
frame.height,
false,
backgroundColor = backgroundColor,
),
frame.duration,
),
)
} }
imagePage.startAnimationLoop(frames) { imagePage.startAnimationLoop(frames) {
if (currentPage === page) pager.state.invalidate() if (currentPage === page) pager.state.invalidate()
@@ -9,7 +9,7 @@ class WebGpuViewerContinuous(activity: ReaderActivity) :
override val isContinuous: Boolean = true override val isContinuous: Boolean = true
override val preloadAhead = 1 override val preloadAhead = 2
override val preloadBehind = 1 override val preloadBehind = 1
private fun scrollByHalfPage(direction: Int) { private fun scrollByHalfPage(direction: Int) {
+1 -1
View File
@@ -76,7 +76,7 @@ swipe = "1.3.0"
tapmoc = "0.4.2" tapmoc = "0.4.2"
unifile = "08f224c8f9" unifile = "08f224c8f9"
voyager = "2.2.21-1.10.3" voyager = "2.2.21-1.10.3"
webgpuviewer = "31" webgpuviewer = "36"
xmlutil = "1.0.2" xmlutil = "1.0.2"
[libraries] [libraries]
@@ -511,6 +511,7 @@
<string name="transition_animation_cube_outside">Cube (Outside)</string> <string name="transition_animation_cube_outside">Cube (Outside)</string>
<string name="transition_animation_fade">Fade</string> <string name="transition_animation_fade">Fade</string>
<string name="transition_animation_fade_white">Fade to white</string> <string name="transition_animation_fade_white">Fade to white</string>
<string name="transition_animation_none">None</string>
<string name="pref_cutout_mode">Display cutout mode</string> <string name="pref_cutout_mode">Display cutout mode</string>
<string name="cutout_mode_ignore">Ignore</string> <string name="cutout_mode_ignore">Ignore</string>
<string name="cutout_mode_avoid">Avoid</string> <string name="cutout_mode_avoid">Avoid</string>