From 9e7b10b283f44a0fe7caabf1a835ee0116eae5f6 Mon Sep 17 00:00:00 2001 From: Samuel Gomes Date: Thu, 30 Nov 2023 04:58:41 +0530 Subject: [PATCH] Fix decoder to work correctly with rotating-earth.gif --- InForm/extensions/GIFPlay.bas | 6 ++++-- examples/DuckShoot/ducks.cfg | 2 +- examples/GIFPlaySample/GIFPlaySample.bas | 4 ++-- examples/Pelmanism/pelman.dat | 2 +- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/InForm/extensions/GIFPlay.bas b/InForm/extensions/GIFPlay.bas index 0a2177c..0db1fa1 100644 --- a/InForm/extensions/GIFPlay.bas +++ b/InForm/extensions/GIFPlay.bas @@ -234,7 +234,7 @@ $IF GIFPLAY_BAS = UNDEFINED THEN CLS ' Blit the rendered frame - _PUTIMAGE , renderedFrame + _PUTIMAGE , renderedFrame, , , _SMOOTH DIM idx AS LONG: idx = HashTable_LookupLong(__GIFPlayHashTable(), Id) @@ -419,6 +419,7 @@ $IF GIFPLAY_BAS = UNDEFINED THEN END SUB + ' https://commandlinefanatic.com/cgi-bin/showarticle.cgi?article=art011 FUNCTION __GIF_ReadLZWCode& (sf AS StringFileType, buffer AS STRING, bitPos AS LONG, bitSize AS LONG) DIM AS LONG code, p: p = 1 @@ -449,6 +450,7 @@ $IF GIFPLAY_BAS = UNDEFINED THEN END FUNCTION + ' https://stackoverflow.com/questions/26894809/gif-lzw-decompression FUNCTION __GIF_DecodeLZW%% (sf AS StringFileType, bmpMem AS _MEM) TYPE __LZWCodeType c AS LONG @@ -520,7 +522,7 @@ $IF GIFPLAY_BAS = UNDEFINED THEN END IF ' Except after clear marker, build new code - IF prev <> clearMarker THEN + IF prev <> clearMarker AND n < 4096 THEN codes(n).prefix = prev codes(n).length = codes(prev).length + 1 codes(n).c = codes(c).c diff --git a/examples/DuckShoot/ducks.cfg b/examples/DuckShoot/ducks.cfg index b742e66..bd69e25 100644 --- a/examples/DuckShoot/ducks.cfg +++ b/examples/DuckShoot/ducks.cfg @@ -7,4 +7,4 @@ 108 39 101 - 2 + 1 diff --git a/examples/GIFPlaySample/GIFPlaySample.bas b/examples/GIFPlaySample/GIFPlaySample.bas index 643fca9..d515d35 100644 --- a/examples/GIFPlaySample/GIFPlaySample.bas +++ b/examples/GIFPlaySample/GIFPlaySample.bas @@ -15,8 +15,8 @@ DIM SHARED PlayBT AS LONG ': External modules: --------------------------------------------------------------- '$INCLUDE:'../../InForm/extensions/GIFPlay.bi' -'$INCLUDE:'../../InForm/InForm.bi' '$INCLUDE:'../../InForm/extensions/MessageBox.bi' +'$INCLUDE:'../../InForm/InForm.bi' '$INCLUDE:'GIFPlaySample.frm' ': Event procedures: --------------------------------------------------------------- @@ -103,5 +103,5 @@ END SUB '$INCLUDE:'../../InForm/InForm.ui' '$INCLUDE:'../../InForm/xp.uitheme' -'$INCLUDE:'../../InForm/extensions/GIFPlay.bas' '$INCLUDE:'../../InForm/extensions/MessageBox.bas' +'$INCLUDE:'../../InForm/extensions/GIFPlay.bas' diff --git a/examples/Pelmanism/pelman.dat b/examples/Pelmanism/pelman.dat index 3ffef42..d66c7fd 100644 --- a/examples/Pelmanism/pelman.dat +++ b/examples/Pelmanism/pelman.dat @@ -1,3 +1,3 @@ - 0 + 12 0 0