fix stb image write for ios

This commit is contained in:
xianjimli 2020-08-26 18:27:37 +08:00
parent 56edc93824
commit d410b10e1e

View File

@ -151,7 +151,7 @@ LICENSE
// if STB_IMAGE_WRITE_STATIC causes problems, try defining STBIWDEF to 'inline' or 'static inline'
#ifndef STBIWDEF
#ifdef STB_IMAGE_WRITE_STATIC
#define STBIWDEF static
#define STBIWDEF static inline
#else
#ifdef __cplusplus
#define STBIWDEF extern "C"
@ -552,7 +552,7 @@ STBIWDEF int stbi_write_tga(char const *filename, int x, int y, int comp, const
#define stbiw__max(a, b) ((a) > (b) ? (a) : (b))
void stbiw__linear_to_rgbe(unsigned char *rgbe, float *linear)
static void stbiw__linear_to_rgbe(unsigned char *rgbe, float *linear)
{
int exponent;
float maxcomp = stbiw__max(linear[0], stbiw__max(linear[1], linear[2]));
@ -569,7 +569,7 @@ void stbiw__linear_to_rgbe(unsigned char *rgbe, float *linear)
}
}
void stbiw__write_run_data(stbi__write_context *s, int length, unsigned char databyte)
static void stbiw__write_run_data(stbi__write_context *s, int length, unsigned char databyte)
{
unsigned char lengthbyte = STBIW_UCHAR(length+128);
STBIW_ASSERT(length+128 <= 255);
@ -577,7 +577,7 @@ void stbiw__write_run_data(stbi__write_context *s, int length, unsigned char dat
s->func(s->context, &databyte, 1);
}
void stbiw__write_dump_data(stbi__write_context *s, int length, unsigned char *data)
static void stbiw__write_dump_data(stbi__write_context *s, int length, unsigned char *data)
{
unsigned char lengthbyte = STBIW_UCHAR(length);
STBIW_ASSERT(length <= 128); // inconsistent with spec but consistent with official code
@ -585,7 +585,7 @@ void stbiw__write_dump_data(stbi__write_context *s, int length, unsigned char *d
s->func(s->context, data, length);
}
void stbiw__write_hdr_scanline(stbi__write_context *s, int width, int ncomp, unsigned char *scratch, float *scanline)
static void stbiw__write_hdr_scanline(stbi__write_context *s, int width, int ncomp, unsigned char *scratch, float *scanline)
{
unsigned char scanlineheader[4] = { 2, 2, 0, 0 };
unsigned char rgbe[4];
@ -809,7 +809,7 @@ static unsigned int stbiw__zhash(unsigned char *data)
#endif // STBIW_ZLIB_COMPRESS
unsigned char * stbi_zlib_compress(unsigned char *data, int data_len, int *out_len, int quality)
static unsigned char * stbi_zlib_compress(unsigned char *data, int data_len, int *out_len, int quality)
{
#ifdef STBIW_ZLIB_COMPRESS
// user provided a zlib compress implementation, use that
@ -1018,7 +1018,7 @@ static void stbiw__encode_png_line(unsigned char *pixels, int stride_bytes, int
}
}
unsigned char *stbi_write_png_to_mem(unsigned char *pixels, int stride_bytes, int x, int y, int n, int *out_len)
STBIWDEF unsigned char *stbi_write_png_to_mem(unsigned char *pixels, int stride_bytes, int x, int y, int n, int *out_len)
{
int force_filter = stbi_write_force_png_filter;
int ctype[5] = { -1, 0, 4, 2, 6 };