Browse Source

Fixed negative values appearing when resizing HDR images.

Branimir Karadžić 7 years ago
parent
commit
2303a218c6
3 changed files with 10 additions and 7 deletions
  1. 8 5
      3rdparty/stb/stb_image_resize.h
  2. 1 1
      src/image_encode.cpp
  3. 1 1
      tools/texturec/texturec.cpp

+ 8 - 5
3rdparty/stb/stb_image_resize.h

@@ -1,4 +1,4 @@
-/* stb_image_resize - v0.94 - public domain image resizing
+/* stb_image_resize - v0.95 - public domain image resizing
    by Jorge L Rodriguez (@VinoBS) - 2014
    http://github.com/nothings/stb
 
@@ -156,8 +156,10 @@
       Jorge L Rodriguez: Implementation
       Sean Barrett: API design, optimizations
       Aras Pranckevicius: bugfix
-         
+      Nathan Reed: warning fixes
+
    REVISIONS
+      0.95 (2017-07-23) fixed warnings
       0.94 (2017-03-18) fixed warnings
       0.93 (2017-03-03) fixed bug with certain combinations of heights
       0.92 (2017-01-02) fix integer overflow on large (>2GB) images
@@ -393,8 +395,9 @@ STBIRDEF int stbir_resize_region(  const void *input_pixels , int input_w , int
 
 #ifndef STBIR_MALLOC
 #include <stdlib.h>
-#define STBIR_MALLOC(size,c) malloc(size)
-#define STBIR_FREE(ptr,c)    free(ptr)
+// use comma operator to evaluate c, to avoid "unused parameter" warnings
+#define STBIR_MALLOC(size,c) ((void)(c), malloc(size))
+#define STBIR_FREE(ptr,c)    ((void)(c), free(ptr))
 #endif
 
 #ifndef _MSC_VER
@@ -983,7 +986,7 @@ static int stbir__edge_wrap_slow(stbir_edge edge, int n, int max)
 
             return (m);
         }
-        return n;  // NOTREACHED
+        // NOTREACHED
 
     default:
         STBIR_ASSERT(!"Unimplemented edge type");

+ 1 - 1
src/image_encode.cpp

@@ -426,7 +426,7 @@ namespace bimg
 				, 4, 3
 				, STBIR_FLAG_ALPHA_PREMULTIPLIED
 				, STBIR_EDGE_CLAMP
-				, STBIR_FILTER_DEFAULT
+				, STBIR_FILTER_CUBICBSPLINE
 				, STBIR_COLORSPACE_LINEAR
 				, NULL
 				);

+ 1 - 1
tools/texturec/texturec.cpp

@@ -26,7 +26,7 @@
 #include <string>
 
 #define BIMG_TEXTUREC_VERSION_MAJOR 1
-#define BIMG_TEXTUREC_VERSION_MINOR 10
+#define BIMG_TEXTUREC_VERSION_MINOR 11
 
 struct Options
 {