@@ -503,33 +503,33 @@ IMG_Animation *IMG_LoadGIFAnimation_IO(SDL_IOStream *src)
503
503
struct IMG_AnimationDecoderContext
504
504
{
505
505
State_t state ; /* GIF decoding state */
506
-
506
+
507
507
unsigned char buf [256 ]; /* Buffer for reading chunks */
508
508
char version [4 ]; /* GIF version */
509
-
509
+
510
510
int width ; /* Width of the GIF */
511
511
int height ; /* Height of the GIF */
512
-
512
+
513
513
SDL_Surface * canvas ; /* Canvas for compositing frames */
514
514
SDL_Surface * prev_canvas ; /* Previous canvas for DISPOSE_PREVIOUS */
515
-
515
+
516
516
int frame_count ; /* Total number of frames seen */
517
517
int current_frame ; /* Current frame index */
518
-
518
+
519
519
bool got_header ; /* Whether we've read the GIF header */
520
520
bool got_eof ; /* Whether we've reached the end of the GIF */
521
-
521
+
522
522
/* Current frame info */
523
523
int current_disposal ; /* Disposal method for current frame */
524
524
int current_delay ; /* Delay time for current frame */
525
525
int transparent_index ; /* Transparent color index for current frame */
526
-
526
+
527
527
/* Global color map */
528
528
unsigned char global_colormap [3 ][MAXCOLORMAPSIZE ];
529
529
int global_colormap_size ;
530
530
bool has_global_colormap ;
531
531
bool global_grayscale ;
532
-
532
+
533
533
/* Frame info */
534
534
int last_disposal ; /* Disposal method from previous frame */
535
535
int restore_frame ; /* Frame to restore when using DISPOSE_PREVIOUS */
@@ -562,11 +562,11 @@ static bool IMG_AnimationDecoderReset_Internal(IMG_AnimationDecoder* decoder)
562
562
if (ctx -> canvas ) {
563
563
SDL_FillSurfaceRect (ctx -> canvas , NULL , 0 );
564
564
}
565
-
565
+
566
566
if (ctx -> prev_canvas ) {
567
567
SDL_FillSurfaceRect (ctx -> prev_canvas , NULL , 0 );
568
568
}
569
-
569
+
570
570
return true;
571
571
}
572
572
@@ -809,21 +809,21 @@ static bool IMG_AnimationDecoderClose_Internal(IMG_AnimationDecoder* decoder)
809
809
if (ctx -> canvas ) {
810
810
SDL_DestroySurface (ctx -> canvas );
811
811
}
812
-
812
+
813
813
if (ctx -> prev_canvas ) {
814
814
SDL_DestroySurface (ctx -> prev_canvas );
815
815
}
816
816
817
817
SDL_free (ctx );
818
818
decoder -> ctx = NULL ;
819
-
819
+
820
820
return true;
821
821
}
822
822
823
823
bool IMG_CreateGIFAnimationDecoder (IMG_AnimationDecoder * decoder , SDL_PropertiesID props )
824
824
{
825
825
(void )props ;
826
-
826
+
827
827
IMG_AnimationDecoderContext * ctx = (IMG_AnimationDecoderContext * )SDL_calloc (1 , sizeof (IMG_AnimationDecoderContext ));
828
828
if (!ctx ) {
829
829
return SDL_SetError ("Out of memory for GIF decoder context" );
@@ -833,7 +833,7 @@ bool IMG_CreateGIFAnimationDecoder(IMG_AnimationDecoder* decoder, SDL_Properties
833
833
ctx -> state .Gif89 .delayTime = -1 ;
834
834
ctx -> state .Gif89 .inputFlag = -1 ;
835
835
ctx -> state .Gif89 .disposal = GIF_DISPOSE_NA ;
836
-
836
+
837
837
ctx -> transparent_index = -1 ;
838
838
ctx -> got_header = false;
839
839
ctx -> got_eof = false;
@@ -848,7 +848,7 @@ bool IMG_CreateGIFAnimationDecoder(IMG_AnimationDecoder* decoder, SDL_Properties
848
848
decoder -> Reset = IMG_AnimationDecoderReset_Internal ;
849
849
decoder -> GetNextFrame = IMG_AnimationDecoderGetNextFrame_Internal ;
850
850
decoder -> Close = IMG_AnimationDecoderClose_Internal ;
851
-
851
+
852
852
return true;
853
853
}
854
854
@@ -906,7 +906,7 @@ SDL_Surface *IMG_LoadGIF_IO(SDL_IOStream *src)
906
906
return NULL ;
907
907
}
908
908
909
- Sint64 pts = 0 ;
909
+ Uint64 pts = 0 ;
910
910
SDL_Surface * frame = NULL ;
911
911
IMG_GetAnimationDecoderFrame (decoder , & frame , & pts );
912
912
IMG_CloseAnimationDecoder (decoder );
@@ -2408,7 +2408,7 @@ static bool AnimationEncoder_AddFrame(struct IMG_AnimationEncoder *encoder, SDL_
2408
2408
surface -> w , surface -> h , ctx -> width , ctx -> height );
2409
2409
goto error ;
2410
2410
}
2411
-
2411
+
2412
2412
if (ctx -> use_lut ) {
2413
2413
// For subsequent frames, map pixels to the existing global palette using the fast LUT.
2414
2414
if (mapSurfaceToExistingPalette (surface , ctx -> colorMapLUT , indexedPixels , ctx -> transparentColorIndex ) != 0 ) {
0 commit comments