From 2303a218c6746957501787edb73d3634e544eb07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Branimir=20Karad=C5=BEi=C4=87?= Date: Mon, 12 Feb 2018 17:39:11 -0800 Subject: [PATCH] Fixed negative values appearing when resizing HDR images. --- 3rdparty/stb/stb_image_resize.h | 13 ++++++++----- src/image_encode.cpp | 2 +- tools/texturec/texturec.cpp | 2 +- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/3rdparty/stb/stb_image_resize.h b/3rdparty/stb/stb_image_resize.h index b507e04..031ca99 100644 --- a/3rdparty/stb/stb_image_resize.h +++ b/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 -#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"); diff --git a/src/image_encode.cpp b/src/image_encode.cpp index 7f53289..022a344 100644 --- a/src/image_encode.cpp +++ b/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 ); diff --git a/tools/texturec/texturec.cpp b/tools/texturec/texturec.cpp index 8beecc2..9038b55 100644 --- a/tools/texturec/texturec.cpp +++ b/tools/texturec/texturec.cpp @@ -26,7 +26,7 @@ #include #define BIMG_TEXTUREC_VERSION_MAJOR 1 -#define BIMG_TEXTUREC_VERSION_MINOR 10 +#define BIMG_TEXTUREC_VERSION_MINOR 11 struct Options {