forked from Green-Sky/tomato
update stb to latest master Merge commit 'ac7437c89bbd8a6626c9f05548bbddfc1a961793'
This commit is contained in:
commit
ca037b6bad
10
external/stb/stb/README.md
vendored
10
external/stb/stb/README.md
vendored
@ -24,10 +24,10 @@ library | lastest version | category | LoC | description
|
|||||||
--------------------- | ---- | -------- | --- | --------------------------------
|
--------------------- | ---- | -------- | --- | --------------------------------
|
||||||
**[stb_vorbis.c](stb_vorbis.c)** | 1.22 | audio | 5584 | decode ogg vorbis files from file/memory to float/16-bit signed output
|
**[stb_vorbis.c](stb_vorbis.c)** | 1.22 | audio | 5584 | decode ogg vorbis files from file/memory to float/16-bit signed output
|
||||||
**[stb_hexwave.h](stb_hexwave.h)** | 0.5 | audio | 680 | audio waveform synthesizer
|
**[stb_hexwave.h](stb_hexwave.h)** | 0.5 | audio | 680 | audio waveform synthesizer
|
||||||
**[stb_image.h](stb_image.h)** | 2.29 | graphics | 7985 | image loading/decoding from file/memory: JPG, PNG, TGA, BMP, PSD, GIF, HDR, PIC
|
**[stb_image.h](stb_image.h)** | 2.30 | graphics | 7988 | image loading/decoding from file/memory: JPG, PNG, TGA, BMP, PSD, GIF, HDR, PIC
|
||||||
**[stb_truetype.h](stb_truetype.h)** | 1.26 | graphics | 5077 | parse, decode, and rasterize characters from truetype fonts
|
**[stb_truetype.h](stb_truetype.h)** | 1.26 | graphics | 5079 | parse, decode, and rasterize characters from truetype fonts
|
||||||
**[stb_image_write.h](stb_image_write.h)** | 1.16 | graphics | 1724 | image writing to disk: PNG, TGA, BMP
|
**[stb_image_write.h](stb_image_write.h)** | 1.16 | graphics | 1724 | image writing to disk: PNG, TGA, BMP
|
||||||
**[stb_image_resize2.h](stb_image_resize2.h)** | 2.04 | graphics | 10325 | resize images larger/smaller with good quality
|
**[stb_image_resize2.h](stb_image_resize2.h)** | 2.09 | graphics | 10561 | resize images larger/smaller with good quality
|
||||||
**[stb_rect_pack.h](stb_rect_pack.h)** | 1.01 | graphics | 623 | simple 2D rectangle packer with decent quality
|
**[stb_rect_pack.h](stb_rect_pack.h)** | 1.01 | graphics | 623 | simple 2D rectangle packer with decent quality
|
||||||
**[stb_perlin.h](stb_perlin.h)** | 0.5 | graphics | 428 | perlin's revised simplex noise w/ different seeds
|
**[stb_perlin.h](stb_perlin.h)** | 0.5 | graphics | 428 | perlin's revised simplex noise w/ different seeds
|
||||||
**[stb_ds.h](stb_ds.h)** | 0.67 | utility | 1895 | typesafe dynamic array and hash tables for C, will compile in C++
|
**[stb_ds.h](stb_ds.h)** | 0.67 | utility | 1895 | typesafe dynamic array and hash tables for C, will compile in C++
|
||||||
@ -38,14 +38,14 @@ library | lastest version | category | LoC | description
|
|||||||
**[stb_easy_font.h](stb_easy_font.h)** | 1.1 | 3D graphics | 305 | quick-and-dirty easy-to-deploy bitmap font for printing frame rate, etc
|
**[stb_easy_font.h](stb_easy_font.h)** | 1.1 | 3D graphics | 305 | quick-and-dirty easy-to-deploy bitmap font for printing frame rate, etc
|
||||||
**[stb_tilemap_editor.h](stb_tilemap_editor.h)** | 0.42 | game dev | 4187 | embeddable tilemap editor
|
**[stb_tilemap_editor.h](stb_tilemap_editor.h)** | 0.42 | game dev | 4187 | embeddable tilemap editor
|
||||||
**[stb_herringbone_wa...](stb_herringbone_wang_tile.h)** | 0.7 | game dev | 1221 | herringbone Wang tile map generator
|
**[stb_herringbone_wa...](stb_herringbone_wang_tile.h)** | 0.7 | game dev | 1221 | herringbone Wang tile map generator
|
||||||
**[stb_c_lexer.h](stb_c_lexer.h)** | 0.12 | parsing | 940 | simplify writing parsers for C-like languages
|
**[stb_c_lexer.h](stb_c_lexer.h)** | 0.12 | parsing | 941 | simplify writing parsers for C-like languages
|
||||||
**[stb_divide.h](stb_divide.h)** | 0.94 | math | 433 | more useful 32-bit modulus e.g. "euclidean divide"
|
**[stb_divide.h](stb_divide.h)** | 0.94 | math | 433 | more useful 32-bit modulus e.g. "euclidean divide"
|
||||||
**[stb_connected_comp...](stb_connected_components.h)** | 0.96 | misc | 1049 | incrementally compute reachability on grids
|
**[stb_connected_comp...](stb_connected_components.h)** | 0.96 | misc | 1049 | incrementally compute reachability on grids
|
||||||
**[stb_leakcheck.h](stb_leakcheck.h)** | 0.6 | misc | 194 | quick-and-dirty malloc/free leak-checking
|
**[stb_leakcheck.h](stb_leakcheck.h)** | 0.6 | misc | 194 | quick-and-dirty malloc/free leak-checking
|
||||||
**[stb_include.h](stb_include.h)** | 0.02 | misc | 295 | implement recursive #include support, particularly for GLSL
|
**[stb_include.h](stb_include.h)** | 0.02 | misc | 295 | implement recursive #include support, particularly for GLSL
|
||||||
|
|
||||||
Total libraries: 21
|
Total libraries: 21
|
||||||
Total lines of C code: 50806
|
Total lines of C code: 51048
|
||||||
|
|
||||||
|
|
||||||
FAQ
|
FAQ
|
||||||
|
3
external/stb/stb/stb_c_lexer.h
vendored
3
external/stb/stb/stb_c_lexer.h
vendored
@ -38,6 +38,7 @@
|
|||||||
// Contributors:
|
// Contributors:
|
||||||
// Arpad Goretity (bugfix)
|
// Arpad Goretity (bugfix)
|
||||||
// Alan Hickman (hex floats)
|
// Alan Hickman (hex floats)
|
||||||
|
// github:mundusnine (bugfix)
|
||||||
//
|
//
|
||||||
// LICENSE
|
// LICENSE
|
||||||
//
|
//
|
||||||
@ -562,7 +563,6 @@ int stb_c_lexer_get_token(stb_lexer *lexer)
|
|||||||
{
|
{
|
||||||
int n = 0;
|
int n = 0;
|
||||||
lexer->string = lexer->string_storage;
|
lexer->string = lexer->string_storage;
|
||||||
lexer->string_len = n;
|
|
||||||
do {
|
do {
|
||||||
if (n+1 >= lexer->string_storage_len)
|
if (n+1 >= lexer->string_storage_len)
|
||||||
return stb__clex_token(lexer, CLEX_parse_error, p, p+n);
|
return stb__clex_token(lexer, CLEX_parse_error, p, p+n);
|
||||||
@ -576,6 +576,7 @@ int stb_c_lexer_get_token(stb_lexer *lexer)
|
|||||||
STB_C_LEX_DOLLAR_IDENTIFIER( || p[n] == '$' )
|
STB_C_LEX_DOLLAR_IDENTIFIER( || p[n] == '$' )
|
||||||
);
|
);
|
||||||
lexer->string[n] = 0;
|
lexer->string[n] = 0;
|
||||||
|
lexer->string_len = n;
|
||||||
return stb__clex_token(lexer, CLEX_id, p, p+n-1);
|
return stb__clex_token(lexer, CLEX_id, p, p+n-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
9
external/stb/stb/stb_image.h
vendored
9
external/stb/stb/stb_image.h
vendored
@ -1,4 +1,4 @@
|
|||||||
/* stb_image - v2.29 - public domain image loader - http://nothings.org/stb
|
/* stb_image - v2.30 - public domain image loader - http://nothings.org/stb
|
||||||
no warranty implied; use at your own risk
|
no warranty implied; use at your own risk
|
||||||
|
|
||||||
Do this:
|
Do this:
|
||||||
@ -48,6 +48,7 @@ LICENSE
|
|||||||
|
|
||||||
RECENT REVISION HISTORY:
|
RECENT REVISION HISTORY:
|
||||||
|
|
||||||
|
2.30 (2024-05-31) avoid erroneous gcc warning
|
||||||
2.29 (2023-05-xx) optimizations
|
2.29 (2023-05-xx) optimizations
|
||||||
2.28 (2023-01-29) many error fixes, security errors, just tons of stuff
|
2.28 (2023-01-29) many error fixes, security errors, just tons of stuff
|
||||||
2.27 (2021-07-11) document stbi_info better, 16-bit PNM support, bug fixes
|
2.27 (2021-07-11) document stbi_info better, 16-bit PNM support, bug fixes
|
||||||
@ -5159,9 +5160,11 @@ static int stbi__parse_png_file(stbi__png *z, int scan, int req_comp)
|
|||||||
// non-paletted with tRNS = constant alpha. if header-scanning, we can stop now.
|
// non-paletted with tRNS = constant alpha. if header-scanning, we can stop now.
|
||||||
if (scan == STBI__SCAN_header) { ++s->img_n; return 1; }
|
if (scan == STBI__SCAN_header) { ++s->img_n; return 1; }
|
||||||
if (z->depth == 16) {
|
if (z->depth == 16) {
|
||||||
for (k = 0; k < s->img_n; ++k) tc16[k] = (stbi__uint16)stbi__get16be(s); // copy the values as-is
|
for (k = 0; k < s->img_n && k < 3; ++k) // extra loop test to suppress false GCC warning
|
||||||
|
tc16[k] = (stbi__uint16)stbi__get16be(s); // copy the values as-is
|
||||||
} else {
|
} else {
|
||||||
for (k = 0; k < s->img_n; ++k) tc[k] = (stbi_uc)(stbi__get16be(s) & 255) * stbi__depth_scale_table[z->depth]; // non 8-bit images will be larger
|
for (k = 0; k < s->img_n && k < 3; ++k)
|
||||||
|
tc[k] = (stbi_uc)(stbi__get16be(s) & 255) * stbi__depth_scale_table[z->depth]; // non 8-bit images will be larger
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
398
external/stb/stb/stb_image_resize2.h
vendored
398
external/stb/stb/stb_image_resize2.h
vendored
File diff suppressed because it is too large
Load Diff
14
external/stb/stb/stb_truetype.h
vendored
14
external/stb/stb/stb_truetype.h
vendored
@ -54,7 +54,7 @@
|
|||||||
// Hou Qiming Derek Vinyard
|
// Hou Qiming Derek Vinyard
|
||||||
// Rob Loach Cort Stratton
|
// Rob Loach Cort Stratton
|
||||||
// Kenney Phillis Jr. Brian Costabile
|
// Kenney Phillis Jr. Brian Costabile
|
||||||
// Ken Voskuil (kaesve)
|
// Ken Voskuil (kaesve) Yakov Galka
|
||||||
//
|
//
|
||||||
// VERSION HISTORY
|
// VERSION HISTORY
|
||||||
//
|
//
|
||||||
@ -4604,6 +4604,8 @@ STBTT_DEF unsigned char * stbtt_GetGlyphSDF(const stbtt_fontinfo *info, float sc
|
|||||||
scale_y = -scale_y;
|
scale_y = -scale_y;
|
||||||
|
|
||||||
{
|
{
|
||||||
|
// distance from singular values (in the same units as the pixel grid)
|
||||||
|
const float eps = 1./1024, eps2 = eps*eps;
|
||||||
int x,y,i,j;
|
int x,y,i,j;
|
||||||
float *precompute;
|
float *precompute;
|
||||||
stbtt_vertex *verts;
|
stbtt_vertex *verts;
|
||||||
@ -4616,15 +4618,15 @@ STBTT_DEF unsigned char * stbtt_GetGlyphSDF(const stbtt_fontinfo *info, float sc
|
|||||||
float x0 = verts[i].x*scale_x, y0 = verts[i].y*scale_y;
|
float x0 = verts[i].x*scale_x, y0 = verts[i].y*scale_y;
|
||||||
float x1 = verts[j].x*scale_x, y1 = verts[j].y*scale_y;
|
float x1 = verts[j].x*scale_x, y1 = verts[j].y*scale_y;
|
||||||
float dist = (float) STBTT_sqrt((x1-x0)*(x1-x0) + (y1-y0)*(y1-y0));
|
float dist = (float) STBTT_sqrt((x1-x0)*(x1-x0) + (y1-y0)*(y1-y0));
|
||||||
precompute[i] = (dist == 0) ? 0.0f : 1.0f / dist;
|
precompute[i] = (dist < eps) ? 0.0f : 1.0f / dist;
|
||||||
} else if (verts[i].type == STBTT_vcurve) {
|
} else if (verts[i].type == STBTT_vcurve) {
|
||||||
float x2 = verts[j].x *scale_x, y2 = verts[j].y *scale_y;
|
float x2 = verts[j].x *scale_x, y2 = verts[j].y *scale_y;
|
||||||
float x1 = verts[i].cx*scale_x, y1 = verts[i].cy*scale_y;
|
float x1 = verts[i].cx*scale_x, y1 = verts[i].cy*scale_y;
|
||||||
float x0 = verts[i].x *scale_x, y0 = verts[i].y *scale_y;
|
float x0 = verts[i].x *scale_x, y0 = verts[i].y *scale_y;
|
||||||
float bx = x0 - 2*x1 + x2, by = y0 - 2*y1 + y2;
|
float bx = x0 - 2*x1 + x2, by = y0 - 2*y1 + y2;
|
||||||
float len2 = bx*bx + by*by;
|
float len2 = bx*bx + by*by;
|
||||||
if (len2 != 0.0f)
|
if (len2 >= eps2)
|
||||||
precompute[i] = 1.0f / (bx*bx + by*by);
|
precompute[i] = 1.0f / len2;
|
||||||
else
|
else
|
||||||
precompute[i] = 0.0f;
|
precompute[i] = 0.0f;
|
||||||
} else
|
} else
|
||||||
@ -4689,8 +4691,8 @@ STBTT_DEF unsigned char * stbtt_GetGlyphSDF(const stbtt_fontinfo *info, float sc
|
|||||||
float a = 3*(ax*bx + ay*by);
|
float a = 3*(ax*bx + ay*by);
|
||||||
float b = 2*(ax*ax + ay*ay) + (mx*bx+my*by);
|
float b = 2*(ax*ax + ay*ay) + (mx*bx+my*by);
|
||||||
float c = mx*ax+my*ay;
|
float c = mx*ax+my*ay;
|
||||||
if (a == 0.0) { // if a is 0, it's linear
|
if (STBTT_fabs(a) < eps2) { // if a is 0, it's linear
|
||||||
if (b != 0.0) {
|
if (STBTT_fabs(b) >= eps2) {
|
||||||
res[num++] = -c/b;
|
res[num++] = -c/b;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
4
external/stb/stb/tests/stb.dsp
vendored
4
external/stb/stb/tests/stb.dsp
vendored
@ -130,6 +130,10 @@ SOURCE=..\stb_image.h
|
|||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=..\stb_image_resize2.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
SOURCE=..\stb_image_write.h
|
SOURCE=..\stb_image_write.h
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
2
external/stb/stb/tests/test_vorbis.c
vendored
2
external/stb/stb/tests/test_vorbis.c
vendored
@ -8,7 +8,7 @@ extern void stb_vorbis_dumpmem(void);
|
|||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
size_t memlen;
|
size_t memlen;
|
||||||
unsigned char *mem = stb_fileu("c:/x/sketch008.ogg", &memlen);
|
unsigned char *mem = stb_fileu("../../lib/vorbis/sample/sketch008.ogg", &memlen);
|
||||||
int chan, samplerate;
|
int chan, samplerate;
|
||||||
short *output;
|
short *output;
|
||||||
int samples = stb_vorbis_decode_memory(mem, memlen, &chan, &samplerate, &output);
|
int samples = stb_vorbis_decode_memory(mem, memlen, &chan, &samplerate, &output);
|
||||||
|
Loading…
Reference in New Issue
Block a user