redwarp / gifdecoder

An implementation of a gif decoder written 100% in Kotlin, plus an associated Drawable for Android
Apache License 2.0
47 stars 6 forks source link

the modifiable loopCount should ignore the gif file's loop count for only one frame #24

Closed vince-styling closed 1 year ago

vince-styling commented 1 year ago

or it may dead loop decode and refresh the one frame

class GifDrawable {
    var loopCount: LoopCount
        get() = state.loopCount ?: state.gif.loopCount
}

I change to :

get() = if (gif.isAnimated) gifState.loopCount ?: gif.loopCount else LoopCount.Fixed(1)
redwarp commented 1 year ago

I'll look into it 👍

redwarp commented 1 year ago

The shouldAnimate function actually already checks that the gif is animated, so I think it would not happen that we loop decode the one frame.