|
|
|
@ -602,7 +602,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])); |
|
|
|
@ -619,7 +619,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); |
|
|
|
@ -627,7 +627,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
|
|
|
|
@ -635,7 +635,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]; |
|
|
|
@ -859,7 +859,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) |
|
|
|
|
STBIWDEF 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
|
|
|
|
@ -1075,7 +1075,7 @@ static void stbiw__encode_png_line(unsigned char *pixels, int stride_bytes, int |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
unsigned char *stbi_write_png_to_mem(const unsigned char *pixels, int stride_bytes, int x, int y, int n, int *out_len) |
|
|
|
|
STBIWDEF unsigned char *stbi_write_png_to_mem(const 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 }; |
|
|
|
|