nothings / stb

stb single-file public domain libraries for C/C++
https://twitter.com/nothings
Other
26.31k stars 7.69k forks source link

stb_image.h needs "#if defined(STBI_NO_PNG) && defined(STBI_NO_PSD) && defined(STBI_NO_PNM)" #1469

Closed ghesketh closed 4 months ago

ghesketh commented 1 year ago

Describe the bug build fails if STBI_NO_PNG and STBI_NO_PSD are defined but STBI_NO_PNM is not defined

lines 1798 and 1807 of stb_image.h:

if defined(STBI_NO_PNG) && defined(STBI_NO_PSD)

stbipnm_load() uses stbi__convert_format16() and stbiconvert_format16() uses stbi__compute_y_16()

To Reproduce

ifndef STBI_NO_PNG

define STBI_NO_PNG

endif

ifdef STBI_NO_PNM

undef STBI_NO_PNM

endif

ifndef STBI_NO_PSD

define STBI_NO_PSD

endif

Expected behavior allow PNM support without PNG and PSD support

Screenshots n/a

agouguai commented 10 months ago

Maybe you can try the following code;

if defined(STBI_NO_PNG) && defined(STBI_NO_PSD) && !defined(STBI_NO_PNM) replace #if defined(STBI_NO_PNG) && defined(STBI_NO_PSD