Commit Graph

143 Commits

Author SHA1 Message Date
Sean Barrett 1ee679ca2e update version numbers 2021-07-11 17:07:54 -07:00
Fabian Giesen 1e1efbdc75 stb_image_write: Make globals extern "C" in C++
Fixes issue #921
2021-07-08 00:24:00 -07:00
Fabian Giesen b14a80784c stb_image_write: Support writing BMPs with alpha
Fixes issue #1159.
2021-07-07 14:35:46 -07:00
Andrew Kensler db6e91b7d8 Store uncompressed if compression was worse
If the data was uncompressible and this deflate implementation expanded
by more than the overhead of simply storing it uncompressed, fall back
to deflate's uncompressed storage mode.  This bounds the maximum deflated
size at the original size plus an overhead of 6 fixed bytes with another
5 bytes per 32767 byte block.

Fixes issue #948.
2021-07-07 02:32:46 -07:00
Fabian Giesen a5e40739ac stb_image_write: Fix define tested for sprintf_s
Fixes issue 744.
2021-07-04 01:39:10 -07:00
Fabian Giesen ba3ba9b78c stb_image_write: Disable HDR writer completely in NO_STDIO build
Fixes issue #793, hopefully.
2021-07-04 01:39:10 -07:00
Fabian Giesen 76f55ac210 stb_image_write: STBI_WINDOWS_UTF8 -> STBIW_WINDOWS_UTF8
Fixes issue #925.
2021-07-04 01:39:10 -07:00
Fabian Giesen 81bcfa9043 stb_image_write: Remove tabs
Whitespace-only change.
2021-07-04 01:39:10 -07:00
Fabian Giesen 2506215e8a stb_image: Key Win32 UTF-8 support off _WIN32 not _MSC_VER
So that it also works on MinGW.

Fixes issue #729.
2021-07-04 01:39:10 -07:00
Fabian Giesen 991f1f6419 stb_image: Fix wrong buffer sizes passed to MultiByteToWideChar
Fixes issue #772.
2021-07-04 01:39:10 -07:00
Fabian Giesen 6d857933d5 stb_image, stb_image_write: Fix compare sign warnings
For the stb_image fix, also replace the magic 288 with a more
descriptive name while I'm at it.

Fixes #1100
2021-07-04 01:39:09 -07:00
Sean Barrett 314d0a6f9a update version numbers 2020-07-13 04:36:03 -07:00
Sean Barrett 523a14f3e1 stb_image_write: small buffer to avoid calling fwrite on every pixel 2020-07-13 02:20:59 -07:00
Sean Barrett 2bb4a0accd Fix trailing whitespace 2020-02-02 11:30:27 -08:00
Sean Barrett 5e4a0617b7 udpate version numbers 2020-02-02 11:12:13 -08:00
Sean Barrett 24fdc35c90 stb_image_write: fix jpeg to work on non-C99 compilers 2020-02-02 10:02:53 -08:00
Sean Barrett 454da539a2 Merge branch 'stbiw_update_jpeg' of https://github.com/DanielGibson/stb into work2 2020-02-02 10:01:04 -08:00
Sean Barrett cc99be2a9f Merge branch 'quell-clang-wcast-align' of https://github.com/a-e-k/stb into work2 2020-02-02 09:51:34 -08:00
Daniel Gibson 15516199e5 stb_image_write: Update JPEG code to jo_jpeg 1.60
For quality <= 90, it now supports subsampling U and V
so it encodes smaller files.

See https://www.jonolick.com/home/jo_jpeg-release-160 for more info
about jo_jpeg 1.60
2019-12-01 09:41:49 -01:00
Andrew Kensler 57b9ea6510 Quell -Wcast-align warnings from Clang
The stbi__sbraw() macro in stb_image_write.h causes Clang to spew about 24
warnings complaining that "cast from 'unsigned char *' to 'int *' increases
required alignment from 1 to 4" when compiled with the -Wcast-align option.

In practice, this is spurious so long as STBIW_MALLOC() and STBIW_REALLOC()
follow the usual alignment semantics for malloc() and realloc() in that they
align sufficiently for any built-in type.

To quell the warning, we can cast through a void pointer as an intermediary.
2019-11-16 00:17:00 -08:00
Niclas Olmenius da12942957 stb_image_write: fix clang warning
fix -Wmissing-variable-declarations clang warning

`stbi__flip_vertically_on_write` is now static like
`stbi__vertically_flip_on_load` in `stb_image.h`
2019-10-03 12:50:23 +02:00
Sean Barrett 787f1d646a Update version numbers 2019-08-11 05:38:37 -07:00
Sean Barrett 7638200f0b Remove old documentation re: SECURE_CRT 2019-03-04 23:22:06 -08:00
Sean Barrett 2c2908f505 update version numbers 2019-03-04 15:08:53 -08:00
Sean Barrett d940053a01 Merge branch 'master' into working 2019-03-04 14:56:00 -08:00
Sean Barrett a0b521fcf2 no warnings when compiling /W3
compiling all test cases and compilers in test.sbm
   Compilers:
     32-bit:
       VS2015
       VS2013
       VS2008
       VC6 (1998)
       clang-cl 9.0.1
     64-bit
       VS2015
       clang-cl 9.0.1
2019-03-04 14:45:06 -08:00
kroko a2cd79b8ff fix comma warnings when building with -Wcomma 2019-03-03 18:48:32 +02:00
Sean Barrett c963e40972 update version numbers 2019-02-25 11:48:42 -08:00
Fabian Giesen 980add9725 stb_image_write: Fix JPEG writer bug. 2019-02-23 05:17:37 -08:00
Sean Barrett 63b59b46b0 update version numbers 2019-02-07 10:03:00 -08:00
Sean Barrett feb9de355d stb_image_write: add missing 'static' on internal functions 2019-02-07 09:03:27 -08:00
Sean Barrett ddccc72c5b stb_image_write: optimize other PNG loops besides previous merge 2019-02-07 08:13:56 -08:00
Sean Barrett d27796b585 Merge branch 'stb_image_write_optimization' of https://github.com/jarnoh/stb into working 2019-02-07 08:11:38 -08:00
Sean Barrett 79a7719c37 stb_image: fix d1252e1bb9 for building in C 2019-02-07 07:20:58 -08:00
Sean Barrett d1252e1bb9 Merge branch 'master' of https://github.com/ab-cpp/stb into working 2019-02-07 07:17:05 -08:00
Sean Barrett 476c1f89a2 stb_image_write: fix the previous fix (incorrectly labelled as stb_image) 2019-02-07 07:01:23 -08:00
Sean Barrett e5d4d6fcce stb_image; optimize row computation in PR 2019-02-07 06:58:00 -08:00
Sean Barrett b2bde485a2 Merge branch 'stbiw-fix-jpeg-flipping' of https://github.com/DanielGibson/stb into working 2019-02-07 06:48:44 -08:00
Sean Barrett ff1eb8b8d4 Merge branch 'fix_stbi_write_hdr_core' of https://github.com/poppolopoppo/stb into working 2019-02-07 06:03:48 -08:00
Sean Barrett f82dbd638c windows unicode: don't malloc buffers, add explicit STBI_WINDOWS_UTF8 #define 2019-02-07 05:55:03 -08:00
Andrew Beatty eee50c079d Update to STB conventions 2019-02-07 07:30:42 -05:00
Andrew Beatty ccc4b3716a fix compiler warnings and const error 2019-01-22 19:31:46 -05:00
jarnoh 60a5755478 use simple memcpy if png filter=0 2018-07-27 10:25:17 +03:00
jarnoh 7a02732eb3 allow STBIW_CRC32 override default crc32 2018-07-27 10:24:55 +03:00
Daniel Gibson 1ad30e4e77 stb_image_write.h: Fix jpg flipping for non-multiple-of-8 sizes
JPG always encodes 8x8 pixel blocks. If the input image does not have
a width or height that's a multiple of 8, the last column or row is just
used multiple times for the remaining pixels of the block.
The original code first calculated p (the index into the pixel data)
with the "imaginary" row/colum (that might be up to 7 pixels too far
into each direction) and then subtracted the necessary amount of bytes
it if row >= height or col >= width.
That was a bit cryptic (IMHO), and didn't get more readable/obvious when
vertical flipping was added - which introduced a bug, by not taking
stbi__flip_vertically_on_write into account when adjusting p for
row >= height...

The code should be more obvious (and less buggy) now.

This fixes bug #592
2018-04-09 01:24:17 +02:00
PopPoLoPoPpo f685ee4e58 Fix overflow in stbi_write_hdr_core()
b056850ea9 left an additional multiplication by x,
leading to overflow.
2018-02-27 00:08:45 +01:00
JR d0ae424061 Re added unicode filename support for stb_image and stb_image_write with whitespace issues fixed. 2018-02-20 21:38:00 -05:00
Sean Barrett 543ad0c112 stb_image_write: tweak handling of STB_IMAGE_WRITE_STATIC 2018-02-11 11:29:32 -08:00
Sean Barrett aeb2b4b64d tweak handling of STBIWDEF 2018-02-11 11:19:45 -08:00
Sean Barrett dbf0fab1c7 stb_image_write: credits 2018-02-11 11:11:39 -08:00