Skip to content

Commit d3fb090

Browse files
committed
Use Uint64 for pts values
1 parent e273073 commit d3fb090

File tree

3 files changed

+21
-21
lines changed

3 files changed

+21
-21
lines changed

include/SDL3_image/SDL_image.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2656,7 +2656,7 @@ extern SDL_DECLSPEC IMG_AnimationDecoder * SDLCALL IMG_CreateAnimationDecoderWit
26562656
* \sa IMG_ResetAnimationDecoder
26572657
* \sa IMG_CloseAnimationDecoder
26582658
*/
2659-
extern SDL_DECLSPEC bool SDLCALL IMG_GetAnimationDecoderFrame(IMG_AnimationDecoder *decoder, SDL_Surface **frame, Sint64 *pts);
2659+
extern SDL_DECLSPEC bool SDLCALL IMG_GetAnimationDecoderFrame(IMG_AnimationDecoder *decoder, SDL_Surface **frame, Uint64 *pts);
26602660

26612661
/**
26622662
* Reset an animation decoder.

src/IMG_anim_decoder.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -163,10 +163,10 @@ IMG_AnimationDecoder *IMG_CreateAnimationDecoderWithProperties(SDL_PropertiesID
163163
return NULL;
164164
}
165165

166-
bool IMG_GetAnimationDecoderFrame(IMG_AnimationDecoder *decoder, SDL_Surface **frame, Sint64 *pts)
166+
bool IMG_GetAnimationDecoderFrame(IMG_AnimationDecoder *decoder, SDL_Surface **frame, Uint64 *pts)
167167
{
168168
SDL_Surface *temp_frame = NULL;
169-
Sint64 temp_pts;
169+
Uint64 temp_pts;
170170

171171
if (!decoder) {
172172
return SDL_InvalidParamError("decoder");
@@ -239,7 +239,7 @@ IMG_Animation *IMG_DecodeAsAnimation(SDL_IOStream *src, const char *format, int
239239
break;
240240
}
241241

242-
Sint64 pts = 0;
242+
Uint64 pts = 0;
243243
SDL_Surface *nextFrame;
244244
if (!IMG_GetAnimationDecoderFrame(decoder, &nextFrame, &pts)) {
245245
goto error;

src/IMG_gif.c

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -503,33 +503,33 @@ IMG_Animation *IMG_LoadGIFAnimation_IO(SDL_IOStream *src)
503503
struct IMG_AnimationDecoderContext
504504
{
505505
State_t state; /* GIF decoding state */
506-
506+
507507
unsigned char buf[256]; /* Buffer for reading chunks */
508508
char version[4]; /* GIF version */
509-
509+
510510
int width; /* Width of the GIF */
511511
int height; /* Height of the GIF */
512-
512+
513513
SDL_Surface *canvas; /* Canvas for compositing frames */
514514
SDL_Surface *prev_canvas; /* Previous canvas for DISPOSE_PREVIOUS */
515-
515+
516516
int frame_count; /* Total number of frames seen */
517517
int current_frame; /* Current frame index */
518-
518+
519519
bool got_header; /* Whether we've read the GIF header */
520520
bool got_eof; /* Whether we've reached the end of the GIF */
521-
521+
522522
/* Current frame info */
523523
int current_disposal; /* Disposal method for current frame */
524524
int current_delay; /* Delay time for current frame */
525525
int transparent_index; /* Transparent color index for current frame */
526-
526+
527527
/* Global color map */
528528
unsigned char global_colormap[3][MAXCOLORMAPSIZE];
529529
int global_colormap_size;
530530
bool has_global_colormap;
531531
bool global_grayscale;
532-
532+
533533
/* Frame info */
534534
int last_disposal; /* Disposal method from previous frame */
535535
int restore_frame; /* Frame to restore when using DISPOSE_PREVIOUS */
@@ -562,11 +562,11 @@ static bool IMG_AnimationDecoderReset_Internal(IMG_AnimationDecoder* decoder)
562562
if (ctx->canvas) {
563563
SDL_FillSurfaceRect(ctx->canvas, NULL, 0);
564564
}
565-
565+
566566
if (ctx->prev_canvas) {
567567
SDL_FillSurfaceRect(ctx->prev_canvas, NULL, 0);
568568
}
569-
569+
570570
return true;
571571
}
572572

@@ -809,21 +809,21 @@ static bool IMG_AnimationDecoderClose_Internal(IMG_AnimationDecoder* decoder)
809809
if (ctx->canvas) {
810810
SDL_DestroySurface(ctx->canvas);
811811
}
812-
812+
813813
if (ctx->prev_canvas) {
814814
SDL_DestroySurface(ctx->prev_canvas);
815815
}
816816

817817
SDL_free(ctx);
818818
decoder->ctx = NULL;
819-
819+
820820
return true;
821821
}
822822

823823
bool IMG_CreateGIFAnimationDecoder(IMG_AnimationDecoder* decoder, SDL_PropertiesID props)
824824
{
825825
(void)props;
826-
826+
827827
IMG_AnimationDecoderContext* ctx = (IMG_AnimationDecoderContext*)SDL_calloc(1, sizeof(IMG_AnimationDecoderContext));
828828
if (!ctx) {
829829
return SDL_SetError("Out of memory for GIF decoder context");
@@ -833,7 +833,7 @@ bool IMG_CreateGIFAnimationDecoder(IMG_AnimationDecoder* decoder, SDL_Properties
833833
ctx->state.Gif89.delayTime = -1;
834834
ctx->state.Gif89.inputFlag = -1;
835835
ctx->state.Gif89.disposal = GIF_DISPOSE_NA;
836-
836+
837837
ctx->transparent_index = -1;
838838
ctx->got_header = false;
839839
ctx->got_eof = false;
@@ -848,7 +848,7 @@ bool IMG_CreateGIFAnimationDecoder(IMG_AnimationDecoder* decoder, SDL_Properties
848848
decoder->Reset = IMG_AnimationDecoderReset_Internal;
849849
decoder->GetNextFrame = IMG_AnimationDecoderGetNextFrame_Internal;
850850
decoder->Close = IMG_AnimationDecoderClose_Internal;
851-
851+
852852
return true;
853853
}
854854

@@ -906,7 +906,7 @@ SDL_Surface *IMG_LoadGIF_IO(SDL_IOStream *src)
906906
return NULL;
907907
}
908908

909-
Sint64 pts = 0;
909+
Uint64 pts = 0;
910910
SDL_Surface *frame = NULL;
911911
IMG_GetAnimationDecoderFrame(decoder, &frame, &pts);
912912
IMG_CloseAnimationDecoder(decoder);
@@ -2408,7 +2408,7 @@ static bool AnimationEncoder_AddFrame(struct IMG_AnimationEncoder *encoder, SDL_
24082408
surface->w, surface->h, ctx->width, ctx->height);
24092409
goto error;
24102410
}
2411-
2411+
24122412
if (ctx->use_lut) {
24132413
// For subsequent frames, map pixels to the existing global palette using the fast LUT.
24142414
if (mapSurfaceToExistingPalette(surface, ctx->colorMapLUT, indexedPixels, ctx->transparentColorIndex) != 0) {

0 commit comments

Comments
 (0)