2
0
Эх сурвалжийг харах

fix missing "defined" in #if defined(STBI_NO_foo);
fix incorrect initialization of alpha channel for RGB PSD

Sean Barrett 10 жил өмнө
parent
commit
d5b8af12cb
2 өөрчлөгдсөн 13 нэмэгдсэн , 4 устгасан
  1. 9 4
      stb_image.h
  2. 4 0
      tests/stb.dsp

+ 9 - 4
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
                                      no warranty implied; use at your own risk
 
 
    Do this:
    Do this:
@@ -146,6 +146,7 @@
 
 
 
 
    Latest revision history:
    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
       2.07  (2015-09-13) partial animated GIF support
                          limited 16-bit PSD support
                          limited 16-bit PSD support
                          minor bugs, code cleanup, and compiler warnings
                          minor bugs, code cleanup, and compiler warnings
@@ -211,6 +212,7 @@
                                                  Phil Jordan
                                                  Phil Jordan
                                                  Nathan Reed
                                                  Nathan Reed
                                                  Michaelangel007@github
                                                  Michaelangel007@github
+                                                 Nick Verigakis
 
 
 LICENSE
 LICENSE
 
 
@@ -1300,7 +1302,8 @@ static stbi__uint32 stbi__get32be(stbi__context *s)
    return (z << 16) + stbi__get16be(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
 #else
 static int stbi__get16le(stbi__context *s)
 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;
          stbi_uc *p;
 
 
          p = out + channel;
          p = out + channel;
-         if (channel > channelCount) {
+         if (channel >= channelCount) {
             // Fill this channel with default data.
             // Fill this channel with default data.
+            stbi_uc val = channel == 3 ? 255 : 0;
             for (i = 0; i < pixelCount; i++, p += 4)
             for (i = 0; i < pixelCount; i++, p += 4)
-               *p = channel == 3 ? 255 : 0;
+               *p = val;
          } else {
          } else {
             // Read the data.
             // Read the data.
             if (bitdepth == 16) {
             if (bitdepth == 16) {
@@ -6355,6 +6359,7 @@ STBIDEF int stbi_info_from_callbacks(stbi_io_callbacks const *c, void *user, int
 
 
 /*
 /*
    revision history:
    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
       2.07  (2015-09-13) fix compiler warnings
                          partial animated GIF support
                          partial animated GIF support
                          limited 16-bit PSD support
                          limited 16-bit PSD support

+ 4 - 0
tests/stb.dsp

@@ -106,6 +106,10 @@ SOURCE=..\stb_dxt.h
 # End Source File
 # End Source File
 # Begin Source File
 # Begin Source File
 
 
+SOURCE=..\stb_easy_font.h
+# End Source File
+# Begin Source File
+
 SOURCE=..\stb_herringbone_wang_tile.h
 SOURCE=..\stb_herringbone_wang_tile.h
 # End Source File
 # End Source File
 # Begin Source File
 # Begin Source File