Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

glide load gif never loop with LOOP_INTRINSIC mode #1724

Closed
Letty-Liang opened this issue Feb 10, 2017 · 1 comment · Fixed by #1875
Closed

glide load gif never loop with LOOP_INTRINSIC mode #1724

Letty-Liang opened this issue Feb 10, 2017 · 1 comment · Fixed by #1875
Labels
Milestone

Comments

@Letty-Liang
Copy link

Letty-Liang commented Feb 10, 2017

here i find a bug, when glide load git with LOOP_INTRINSIC mode, a forever loop gif will never loop at all

=====code====
in third party parse
https://gist.githubusercontent.com/devunwired/4479231/raw/df2725be4ae0f12f5265deaf0a769936ea94950b/GifDecoder.java
protected int loopCount = 1; // iterations; 0 = repeat forever

/**
 * Reads Netscape extension to obtain iteration count.
 */
private void readNetscapeExt() {
    do {
        readBlock();
        if (block[0] == 1) {
            // Loop count sub-block.
            int b1 = ((int) block[1]) & 0xff;
            int b2 = ((int) block[2]) & 0xff;
            header.loopCount = (b2 << 8) | b1;
        }
    } while ((blockSize > 0) && !err());
}

while in glide loopCount = 0 means never loop

@Override
public void setLoopCount(int loopCount) {
    if (loopCount <= 0 && loopCount != LOOP_FOREVER && loopCount != LOOP_INTRINSIC) {
        throw new IllegalArgumentException("Loop count must be greater than 0, or equal to "
                + "GlideDrawable.LOOP_FOREVER, or equal to GlideDrawable.LOOP_INTRINSIC");
    }

    if (loopCount == LOOP_INTRINSIC) {
        maxLoopCount = decoder.getLoopCount();
    } else {
        maxLoopCount = loopCount;
    }
}

hope u will fix it soon or maybe i could create a pr

@TWiStErRob
Copy link
Collaborator

Fixed for 3.8.0 in #1813, you can consume it via https://github.com/bumptech/glide/wiki/Snapshots, thanks @toyama-sumio!

ghost pushed a commit to sumio/glide that referenced this issue Apr 24, 2017
…ix wrong interpretation of the Netscape iteration count in an animated GIF.

Fixed bumptech#1724
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
2 participants