|
|
|
@ -393,7 +393,7 @@ static void stbiw__putc(stbi__write_context *s, unsigned char c) |
|
|
|
|
static void stbiw__write3(stbi__write_context *s, unsigned char a, unsigned char b, unsigned char c) |
|
|
|
|
{ |
|
|
|
|
unsigned char arr[3]; |
|
|
|
|
arr[0] = a, arr[1] = b, arr[2] = c; |
|
|
|
|
arr[0] = a; arr[1] = b; arr[2] = c; |
|
|
|
|
s->func(s->context, arr, 3); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -441,10 +441,11 @@ static void stbiw__write_pixels(stbi__write_context *s, int rgb_dir, int vdir, i |
|
|
|
|
if (stbi__flip_vertically_on_write) |
|
|
|
|
vdir *= -1; |
|
|
|
|
|
|
|
|
|
if (vdir < 0) |
|
|
|
|
j_end = -1, j = y-1; |
|
|
|
|
else |
|
|
|
|
j_end = y, j = 0; |
|
|
|
|
if (vdir < 0) { |
|
|
|
|
j_end = -1; j = y-1; |
|
|
|
|
} else { |
|
|
|
|
j_end = y; j = 0; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
for (; j != j_end; j += vdir) { |
|
|
|
|
for (i=0; i < x; ++i) { |
|
|
|
@ -895,7 +896,7 @@ STBIWDEF unsigned char * stbi_zlib_compress(unsigned char *data, int data_len, i |
|
|
|
|
for (j=0; j < n; ++j) { |
|
|
|
|
if (hlist[j]-data > i-32768) { // if entry lies within window
|
|
|
|
|
int d = stbiw__zlib_countm(hlist[j], data+i, data_len-i); |
|
|
|
|
if (d >= best) best=d,bestloc=hlist[j]; |
|
|
|
|
if (d >= best) { best=d; bestloc=hlist[j]; } |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
// when hash table entry is too long, delete half the entries
|
|
|
|
@ -954,8 +955,8 @@ STBIWDEF unsigned char * stbi_zlib_compress(unsigned char *data, int data_len, i |
|
|
|
|
int blocklen = (int) (data_len % 5552); |
|
|
|
|
j=0; |
|
|
|
|
while (j < data_len) { |
|
|
|
|
for (i=0; i < blocklen; ++i) s1 += data[j+i], s2 += s1; |
|
|
|
|
s1 %= 65521, s2 %= 65521; |
|
|
|
|
for (i=0; i < blocklen; ++i) { s1 += data[j+i]; s2 += s1; } |
|
|
|
|
s1 %= 65521; s2 %= 65521; |
|
|
|
|
j += blocklen; |
|
|
|
|
blocklen = 5552; |
|
|
|
|
} |
|
|
|
|