Skip to content
Myr

update stb_image version & changelog

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Sean Barrett · committed by Sean Barrett · parent f9e593c · Browse files · 2 files+29 added−20 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+29 added−20 removed

  • other:+29 added−20 removed

2 files+29 added−20 removed

modified:README.md+1 added-1 removed
modified:stb_image.h+28 added-19 removed
1/* stb_image - v1.46 - public domain JPEG/PNG reader - http://nothings.org/stb_image.c1/* stb_image - v1.47 - public domain JPEG/PNG reader - http://nothings.org/stb_image.c2 when you control the images you're loading3 no warranty implied; use at your own risk45 Do this:
21 unmodified lines
27 - decode from arbitrary I/O callbacks28 - overridable dequantizing-IDCT, YCbCr-to-RGB conversion (define STBI_SIMD)2930 Latest revisions:31 1.xx (2014-09-26) 1/2/4-bit PNG support (both grayscale and paletted)31 1.47 (2014-12-14) 1/2/4-bit PNG support (both grayscale and paletted)32 optimize PNG33 fix bug in interlaced PNG with user-specified channel count34 1.46 (2014-08-26) fix broken tRNS chunk in non-paletted PNG35 1.45 (2014-08-16) workaround MSVC-ARM internal compiler error by wrapping malloc36 1.44 (2014-08-07) warnings37 1.43 (2014-07-15) fix MSVC-only bug in 1.4238 1.42 (2014-07-09) no _CRT_SECURE_NO_WARNINGS; error-path fixes; STBI_ASSERT39 1.41 (2014-06-25) fix search&replace that messed up comments/error messages38 1.40 (2014-06-22) gcc warning39 1.39 (2014-06-15) TGA optimization bugfix, multiple BMP fixes40 1.38 (2014-06-06) suppress MSVC run-time warnings, fix accidental rename of 'skip'41 1.37 (2014-06-04) remove duplicate typedef42 1.36 (2014-06-03) converted to header file, allow reading incorrect iphoned-images without iphone flag43 1.35 (2014-05-27) warnings, bugfixes, TGA optimization, etc4041 See end of file for full revision history.4243 TODO:
2410 unmodified lines
2454 stbi__uint32 length;2455 stbi__uint32 type;2456} stbi__pngchunk;24572462#define PNG_TYPE(a,b,c,d) (((a) << 24) + ((b) << 16) + ((c) << 8) + (d))24632458static stbi__pngchunk stbi__get_chunk_header(stbi__context *s)2459{2460 stbi__pngchunk c;2461 c.length = stbi__get32be(s);
17 unmodified lines
2479} stbi__png;248024812482enum {2489 STBI__F_none=0, STBI__F_sub=1, STBI__F_up=2, STBI__F_avg=3, STBI__F_paeth=4,2490 STBI__F_avg_first, STBI__F_paeth_first2483 STBI__F_none=0,2484 STBI__F_sub=1,2485 STBI__F_up=2,2486 STBI__F_avg=3,2487 STBI__F_paeth=4,2488 // synthetic filters used for first scanline to avoid needing a dummy row of 0s2489 STBI__F_avg_first,2490 STBI__F_paeth_first2491};24922493static stbi_uc first_row_filter[5] =2494{2495 STBI__F_none, STBI__F_sub, STBI__F_none, STBI__F_avg_first, STBI__F_paeth_first2495 STBI__F_none,2496 STBI__F_sub,2497 STBI__F_none,2498 STBI__F_avg_first,2499 STBI__F_paeth_first2500};25012502static int stbi__paeth(int a, int b, int c)2503{
347 unmodified lines
2851 }2852 }2853}28542855#define STBI__PNG_TYPE(a,b,c,d) (((a) << 24) + ((b) << 16) + ((c) << 8) + (d))28562857static int stbi__parse_png_file(stbi__png *z, int scan, int req_comp)2858{2859 stbi_uc palette[1024], pal_img_n=0;2860 stbi_uc has_trans=0, tc[3];
11 unmodified lines
28722873 for (;;) {2874 stbi__pngchunk c = stbi__get_chunk_header(s);2875 switch (c.type) {2870 case PNG_TYPE('C','g','B','I'):2876 case STBI__PNG_TYPE('C','g','B','I'):2877 is_iphone = 1;2878 stbi__skip(s, c.length);2879 break;2874 case PNG_TYPE('I','H','D','R'): {2880 case STBI__PNG_TYPE('I','H','D','R'): {2881 int comp,filter;2882 if (!first) return stbi__err("multiple IHDR","Corrupt PNG");2883 first = 0;2884 if (c.length != 13) return stbi__err("bad IHDR len","Corrupt PNG");
19 unmodified lines
2904 }2905 break;2906 }29072902 case PNG_TYPE('P','L','T','E'): {2908 case STBI__PNG_TYPE('P','L','T','E'): {2909 if (first) return stbi__err("first not IHDR", "Corrupt PNG");2910 if (c.length > 256*3) return stbi__err("invalid PLTE","Corrupt PNG");2911 pal_len = c.length / 3;2912 if (pal_len * 3 != c.length) return stbi__err("invalid PLTE","Corrupt PNG");
5 unmodified lines
2918 }2919 break;2920 }29212916 case PNG_TYPE('t','R','N','S'): {2922 case STBI__PNG_TYPE('t','R','N','S'): {2923 if (first) return stbi__err("first not IHDR", "Corrupt PNG");2924 if (z->idata) return stbi__err("tRNS after IDAT","Corrupt PNG");2925 if (pal_img_n) {2926 if (scan == SCAN_header) { s->img_n = 4; return 1; }
11 unmodified lines
2938 }2939 break;2940 }29412936 case PNG_TYPE('I','D','A','T'): {2942 case STBI__PNG_TYPE('I','D','A','T'): {2943 if (first) return stbi__err("first not IHDR", "Corrupt PNG");2944 if (pal_img_n && !pal_len) return stbi__err("no PLTE","Corrupt PNG");2945 if (scan == SCAN_header) { s->img_n = pal_img_n; return 1; }2946 if (ioff + c.length > idata_limit) {
8 unmodified lines
2955 ioff += c.length;2956 break;2957 }29582953 case PNG_TYPE('I','E','N','D'): {2959 case STBI__PNG_TYPE('I','E','N','D'): {2960 stbi__uint32 raw_len;2961 if (first) return stbi__err("first not IHDR", "Corrupt PNG");2962 if (scan != SCAN_load) return 1;2963 if (z->idata == NULL) return stbi__err("no IDAT","Corrupt PNG");
1741 unmodified lines
4705#endif // STB_IMAGE_IMPLEMENTATION47064707/*4708 revision history:4709 1.47 (2014-12-14) 1/2/4-bit PNG support, both direct and paletted (Omar Cornut & stb)4710 optimize PNG (ryg)4711 fix bug in interlaced PNG with user-specified channel count (stb)4712 1.46 (2014-08-26)4713 fix broken tRNS chunk (colorkey-style transparency) in non-paletted PNG4714 1.45 (2014-08-16)4715 fix MSVC-ARM internal compiler error by wrapping malloc
116 unmodified lines