Commit Graph

123 Commits

Author SHA1 Message Date
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
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
Sean Barrett
2886b67f7f Merge branch 'stb_image_write_png_filters_fix' of https://github.com/kosua20/stb into working 2018-02-11 11:09:07 -08:00
Sean Barrett
6382814b8c Merge branch 'image_write_variable_typos' of https://github.com/cap/stb into working 2018-02-11 11:05:58 -08:00
Sean Barrett
4eef034d52 stb_write_image: fix typos 2018-02-11 11:05:20 -08:00
Cap Petschulat
6ab920bb6a stb_image_write: fix png compression level typos 2018-02-05 15:48:17 +09:00
Simon Rodriguez
34f087ce4c stb_image_write: fix indexing error when computing PNG filters with the stbi__flip_vertically_on_write on.
The PNG filters of the pixels row N are computed using row N-1 of the final image. If the image should be flipped when saving, this corresponds to row N+1 of the initial image.
2018-02-04 20:12:20 +01:00
Sean Barrett
445473bdb5 stb_image_write: handle malloc failure in zlib 2018-01-29 08:03:56 -08:00
Sean Barrett
b969dc38f3 stb_image_write: fix for fopen_s failure case 2018-01-29 06:06:29 -08:00
Sean Barrett
094cb31ec8 stb_image: compile as C; stb_image_write: credits 2018-01-29 04:03:18 -08:00
Sean Barrett
faf08e0018 Merge branch 'stb_image_write_mscrt_errors' of https://github.com/xeekworx/stb 2018-01-29 04:01:29 -08:00
Sean Barrett
3d7b4251f9 Merge branch 'png-ext-write' of https://github.com/akx/stb
Conflicts:
	stb_image_write.h
2018-01-29 03:14:31 -08:00
Sean Barrett
b48101c971 Merge branch 'update_stbi_jpg_dcoumentation' of https://github.com/Benjins/stb 2018-01-29 02:57:46 -08:00
Sean Barrett
35a3bf41e8 Integrate ZLIB changed from Daniel Gibson, fixup credits 2018-01-29 02:55:56 -08:00
Sean Barrett
9de22e5a70 Merge branch 'stbiw-png-compr' of https://github.com/DanielGibson/stb 2018-01-29 02:53:25 -08:00
Sean Barrett
b056850ea9 stb_image_write can flip images vertically 2018-01-29 02:52:49 -08:00
John Tullos
841862a622 Fixed grammar, spelling issues in comments
issue #533
2018-01-01 18:59:06 -06:00
John Tullos
32a7d5ab68 Added STBI_MSC_SECURE_CRT to support newer MSVC compilers as optional
For issue #533
2018-01-01 18:54:26 -06:00
John Tullos
5e844ffe70 Using secure versions of CRT calls to avoid Microsoft Visual C/C++ compiler errors/warnings. 2018-01-01 18:08:30 -06:00
Aarni Koskela
2c7b00ac21 Add force_filter and compression_level parameters to (new) stbi_write_png_to_mem_ex
* `force_filter` being < 0 means the original behavior (i.e. figure out
  the best-performing filter per scanline); any other values 0 <= x <= 4 correspond
  to PNG filters (0 = none, 1 = sub, 2 = up, 3 = average, 4 = Paeth).
* `compression_level` being < 0 equals `compression_level` 8 (the previous value).
  The higher this is, the better the compression should be (though it will use
  more memory).

These new parameters are not (yet) exposed for the higher-level API functions.
2017-08-07 14:52:53 +03:00
Benji Smith
923c9c3deb Correct function signature in stbi_write_jpg usage documentation. 2017-07-31 22:22:56 -07:00
Sean Barrett
961923b5a3 fix documentation 2017-07-24 03:32:20 -07:00