From d5b8af12cbeeb9d7f4734ebfef8af93e0de74451 Mon Sep 17 00:00:00 2001 From: Sean Barrett Date: Sun, 13 Sep 2015 11:08:40 -0700 Subject: [PATCH] fix missing "defined" in #if defined(STBI_NO_foo); fix incorrect initialization of alpha channel for RGB PSD --- stb_image.h | 13 +++++++++---- tests/stb.dsp | 4 ++++ 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/stb_image.h b/stb_image.h index b82de7b..1140865 100644 --- a/stb_image.h +++ b/stb_image.h @@ -1,4 +1,4 @@ -/* stb_image - v2.07 - public domain image loader - http://nothings.org/stb_image.h +/* stb_image - v2.08 - public domain image loader - http://nothings.org/stb_image.h no warranty implied; use at your own risk Do this: @@ -146,6 +146,7 @@ Latest revision history: + 2.08 (2015-09-13) fix to 2.07 cleanup, reading RGB PSD as RGBA 2.07 (2015-09-13) partial animated GIF support limited 16-bit PSD support minor bugs, code cleanup, and compiler warnings @@ -211,6 +212,7 @@ Phil Jordan Nathan Reed Michaelangel007@github + Nick Verigakis LICENSE @@ -1300,7 +1302,8 @@ static stbi__uint32 stbi__get32be(stbi__context *s) return (z << 16) + stbi__get16be(s); } -#if defined (STBI_NO_BMP) && (STBI_NO_TGA) && (STBI_NO_GIF) +#if defined(STBI_NO_BMP) && defined(STBI_NO_TGA) && defined(STBI_NO_GIF) +// nothing #else static int stbi__get16le(stbi__context *s) { @@ -5214,10 +5217,11 @@ static stbi_uc *stbi__psd_load(stbi__context *s, int *x, int *y, int *comp, int stbi_uc *p; p = out + channel; - if (channel > channelCount) { + if (channel >= channelCount) { // Fill this channel with default data. + stbi_uc val = channel == 3 ? 255 : 0; for (i = 0; i < pixelCount; i++, p += 4) - *p = channel == 3 ? 255 : 0; + *p = val; } else { // Read the data. if (bitdepth == 16) { @@ -6355,6 +6359,7 @@ STBIDEF int stbi_info_from_callbacks(stbi_io_callbacks const *c, void *user, int /* revision history: + 2.08 (2015-09-13) fix to 2.07 cleanup, reading RGB PSD as RGBA 2.07 (2015-09-13) fix compiler warnings partial animated GIF support limited 16-bit PSD support diff --git a/tests/stb.dsp b/tests/stb.dsp index 621f5a4..b4e1748 100644 --- a/tests/stb.dsp +++ b/tests/stb.dsp @@ -106,6 +106,10 @@ SOURCE=..\stb_dxt.h # End Source File # Begin Source File +SOURCE=..\stb_easy_font.h +# End Source File +# Begin Source File + SOURCE=..\stb_herringbone_wang_tile.h # End Source File # Begin Source File