Skip to content

Commit

Permalink
Removed functions not used by SDL
Browse files Browse the repository at this point in the history
  • Loading branch information
slouken committed Feb 10, 2025
1 parent 80000cd commit 9bb0641
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions src/video/stb_image.h
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,9 @@ typedef struct
//

STBIDEF stbi_uc *stbi_load_from_memory (stbi_uc const *buffer, int len , int *x, int *y, int *channels_in_file, int desired_channels);
#ifndef STB_INTERNAL_SDL
STBIDEF stbi_uc *stbi_load_from_callbacks(stbi_io_callbacks const *clbk , void *user, int *x, int *y, int *channels_in_file, int desired_channels);
#endif

#ifndef STBI_NO_STDIO
STBIDEF stbi_uc *stbi_load (char const *filename, int *x, int *y, int *channels_in_file, int desired_channels);
Expand All @@ -442,8 +444,10 @@ STBIDEF int stbi_convert_wchar_to_utf8(char *buffer, size_t bufferlen, const wch
// 16-bits-per-channel interface
//

#ifndef STB_INTERNAL_SDL
STBIDEF stbi_us *stbi_load_16_from_memory (stbi_uc const *buffer, int len, int *x, int *y, int *channels_in_file, int desired_channels);
STBIDEF stbi_us *stbi_load_16_from_callbacks(stbi_io_callbacks const *clbk, void *user, int *x, int *y, int *channels_in_file, int desired_channels);
#endif

#ifndef STBI_NO_STDIO
STBIDEF stbi_us *stbi_load_16 (char const *filename, int *x, int *y, int *channels_in_file, int desired_channels);
Expand Down Expand Up @@ -474,9 +478,11 @@ STBIDEF stbi_us *stbi_load_from_file_16(FILE *f, int *x, int *y, int *channels_i
STBIDEF void stbi_ldr_to_hdr_scale(float scale);
#endif // STBI_NO_LINEAR

#ifndef STB_INTERNAL_SDL
// stbi_is_hdr is always defined, but always returns false if STBI_NO_HDR
STBIDEF int stbi_is_hdr_from_callbacks(stbi_io_callbacks const *clbk, void *user);
STBIDEF int stbi_is_hdr_from_memory(stbi_uc const *buffer, int len);
#endif
#ifndef STBI_NO_STDIO
STBIDEF int stbi_is_hdr (char const *filename);
STBIDEF int stbi_is_hdr_from_file(FILE *f);
Expand All @@ -491,10 +497,12 @@ STBIDEF const char *stbi_failure_reason (void);
STBIDEF void stbi_image_free (void *retval_from_stbi_load);

// get image dimensions & components without fully decoding
#ifndef STB_INTERNAL_SDL
STBIDEF int stbi_info_from_memory(stbi_uc const *buffer, int len, int *x, int *y, int *comp);
STBIDEF int stbi_info_from_callbacks(stbi_io_callbacks const *clbk, void *user, int *x, int *y, int *comp);
STBIDEF int stbi_is_16_bit_from_memory(stbi_uc const *buffer, int len);
STBIDEF int stbi_is_16_bit_from_callbacks(stbi_io_callbacks const *clbk, void *user);
#endif

#ifndef STBI_NO_STDIO
STBIDEF int stbi_info (char const *filename, int *x, int *y, int *comp);
Expand Down Expand Up @@ -837,6 +845,7 @@ static void stbi__start_mem(stbi__context *s, stbi_uc const *buffer, int len)
}

// initialize a callback-based context
#ifndef STB_INTERNAL_SDL
static void stbi__start_callbacks(stbi__context *s, stbi_io_callbacks *c, void *user)
{
s->io = *c;
Expand All @@ -848,6 +857,7 @@ static void stbi__start_callbacks(stbi__context *s, stbi_io_callbacks *c, void *
stbi__refill_buffer(s);
s->img_buffer_original_end = s->img_buffer_end;
}
#endif // !STB_INTERNAL_SDL

#ifndef STBI_NO_STDIO

Expand Down Expand Up @@ -912,8 +922,10 @@ typedef struct
#ifndef STBI_NO_JPEG
static int stbi__jpeg_test(stbi__context *s);
static void *stbi__jpeg_load(stbi__context *s, int *x, int *y, int *comp, int req_comp, stbi__result_info *ri);
#ifndef STB_INTERNAL_SDL
static int stbi__jpeg_info(stbi__context *s, int *x, int *y, int *comp);
#endif
#endif

#ifndef STBI_NO_PNG
static int stbi__png_test(stbi__context *s);
Expand Down Expand Up @@ -1211,6 +1223,7 @@ static stbi_uc *stbi__convert_16_to_8(stbi__uint16 *orig, int w, int h, int chan
return reduced;
}

#ifndef STB_INTERNAL_SDL
static stbi__uint16 *stbi__convert_8_to_16(stbi_uc *orig, int w, int h, int channels)
{
int i;
Expand All @@ -1226,6 +1239,7 @@ static stbi__uint16 *stbi__convert_8_to_16(stbi_uc *orig, int w, int h, int chan
STBI_FREE(orig);
return enlarged;
}
#endif // !STB_INTERNAL_SDL

static void stbi__vertical_flip(void *image, int w, int h, int bytes_per_pixel)
{
Expand Down Expand Up @@ -1291,6 +1305,7 @@ static unsigned char *stbi__load_and_postprocess_8bit(stbi__context *s, int *x,
return (unsigned char *) result;
}

#ifndef STB_INTERNAL_SDL
static stbi__uint16 *stbi__load_and_postprocess_16bit(stbi__context *s, int *x, int *y, int *comp, int req_comp)
{
stbi__result_info ri;
Expand All @@ -1317,6 +1332,7 @@ static stbi__uint16 *stbi__load_and_postprocess_16bit(stbi__context *s, int *x,

return (stbi__uint16 *) result;
}
#endif // !STB_INTERNAL_SDL

#if !defined(STBI_NO_HDR) && !defined(STBI_NO_LINEAR)
static void stbi__float_postprocess(float *result, int *x, int *y, int *comp, int req_comp)
Expand Down Expand Up @@ -1420,6 +1436,7 @@ STBIDEF stbi_us *stbi_load_16(char const *filename, int *x, int *y, int *comp, i

#endif //!STBI_NO_STDIO

#ifndef STB_INTERNAL_SDL
STBIDEF stbi_us *stbi_load_16_from_memory(stbi_uc const *buffer, int len, int *x, int *y, int *channels_in_file, int desired_channels)
{
stbi__context s;
Expand All @@ -1433,6 +1450,7 @@ STBIDEF stbi_us *stbi_load_16_from_callbacks(stbi_io_callbacks const *clbk, void
stbi__start_callbacks(&s, (stbi_io_callbacks *)clbk, user);
return stbi__load_and_postprocess_16bit(&s,x,y,channels_in_file,desired_channels);
}
#endif

STBIDEF stbi_uc *stbi_load_from_memory(stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp)
{
Expand All @@ -1441,12 +1459,14 @@ STBIDEF stbi_uc *stbi_load_from_memory(stbi_uc const *buffer, int len, int *x, i
return stbi__load_and_postprocess_8bit(&s,x,y,comp,req_comp);
}

#ifndef STB_INTERNAL_SDL
STBIDEF stbi_uc *stbi_load_from_callbacks(stbi_io_callbacks const *clbk, void *user, int *x, int *y, int *comp, int req_comp)
{
stbi__context s;
stbi__start_callbacks(&s, (stbi_io_callbacks *) clbk, user);
return stbi__load_and_postprocess_8bit(&s,x,y,comp,req_comp);
}
#endif

#ifndef STBI_NO_GIF
STBIDEF stbi_uc *stbi_load_gif_from_memory(stbi_uc const *buffer, int len, int **delays, int *x, int *y, int *z, int *comp, int req_comp)
Expand Down Expand Up @@ -1522,6 +1542,7 @@ STBIDEF float *stbi_loadf_from_file(FILE *f, int *x, int *y, int *comp, int req_
// defined, for API simplicity; if STBI_NO_LINEAR is defined, it always
// reports false!

#ifndef STB_INTERNAL_SDL
STBIDEF int stbi_is_hdr_from_memory(stbi_uc const *buffer, int len)
{
#ifndef STBI_NO_HDR
Expand All @@ -1534,6 +1555,7 @@ STBIDEF int stbi_is_hdr_from_memory(stbi_uc const *buffer, int len)
return 0;
#endif
}
#endif // !STB_INTERNAL_SDL

#ifndef STBI_NO_STDIO
STBIDEF int stbi_is_hdr (char const *filename)
Expand Down Expand Up @@ -1564,6 +1586,7 @@ STBIDEF int stbi_is_hdr_from_file(FILE *f)
}
#endif // !STBI_NO_STDIO

#ifndef STB_INTERNAL_SDL
STBIDEF int stbi_is_hdr_from_callbacks(stbi_io_callbacks const *clbk, void *user)
{
#ifndef STBI_NO_HDR
Expand All @@ -1576,6 +1599,7 @@ STBIDEF int stbi_is_hdr_from_callbacks(stbi_io_callbacks const *clbk, void
return 0;
#endif
}
#endif // !STB_INTERNAL_SDL

#ifndef STBI_NO_LINEAR
static float stbi__l2h_gamma=2.2f, stbi__l2h_scale=1.0f;
Expand Down Expand Up @@ -4063,6 +4087,7 @@ static int stbi__jpeg_test(stbi__context *s)
return r;
}

#ifndef STB_INTERNAL_SDL
static int stbi__jpeg_info_raw(stbi__jpeg *j, int *x, int *y, int *comp)
{
if (!stbi__decode_jpeg_header(j, STBI__SCAN_header)) {
Expand All @@ -4086,6 +4111,7 @@ static int stbi__jpeg_info(stbi__context *s, int *x, int *y, int *comp)
STBI_FREE(j);
return result;
}
#endif // !STB_INTERNAL_SDL
#endif

// public domain zlib decode v0.2 Sean Barrett 2006-11-18
Expand Down Expand Up @@ -7639,6 +7665,7 @@ static int stbi__pnm_is16(stbi__context *s)
}
#endif

#ifndef STB_INTERNAL_SDL
static int stbi__info_main(stbi__context *s, int *x, int *y, int *comp)
{
#ifndef STBI_NO_JPEG
Expand Down Expand Up @@ -7680,7 +7707,9 @@ static int stbi__info_main(stbi__context *s, int *x, int *y, int *comp)
#endif
return stbi__err("unknown image type", "Image not of any known type, or corrupt");
}
#endif // !STB_INTERNAL_SDL

#ifndef STB_INTERNAL_SDL
static int stbi__is_16_main(stbi__context *s)
{
#ifndef STBI_NO_PNG
Expand All @@ -7696,6 +7725,7 @@ static int stbi__is_16_main(stbi__context *s)
#endif
return 0;
}
#endif // !STB_INTERNAL_SDL

#ifndef STBI_NO_STDIO
STBIDEF int stbi_info(char const *filename, int *x, int *y, int *comp)
Expand Down Expand Up @@ -7741,6 +7771,7 @@ STBIDEF int stbi_is_16_bit_from_file(FILE *f)
}
#endif // !STBI_NO_STDIO

#ifndef STB_INTERNAL_SDL
STBIDEF int stbi_info_from_memory(stbi_uc const *buffer, int len, int *x, int *y, int *comp)
{
stbi__context s;
Expand Down Expand Up @@ -7768,6 +7799,7 @@ STBIDEF int stbi_is_16_bit_from_callbacks(stbi_io_callbacks const *c, void *user
stbi__start_callbacks(&s, (stbi_io_callbacks *) c, user);
return stbi__is_16_main(&s);
}
#endif // !STB_INTERNAL_SDL

#endif // STB_IMAGE_IMPLEMENTATION

Expand Down

0 comments on commit 9bb0641

Please sign in to comment.