From f1f077b2722f55e158cba020f0312ee2d13c463a Mon Sep 17 00:00:00 2001 From: Carmelo Fernandez Aguera Date: Thu, 7 Jun 2018 16:18:23 +0100 Subject: [PATCH 1/2] Break a for loop into two parts and get an if out of the loop. --- stb_image.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/stb_image.h b/stb_image.h index d9c21bc..4fee4fb 100644 --- a/stb_image.h +++ b/stb_image.h @@ -1623,7 +1623,11 @@ static float *stbi__ldr_to_hdr(stbi_uc *data, int x, int y, int comp) for (k=0; k < n; ++k) { output[i*comp + k] = (float) (pow(data[i*comp+k]/255.0f, stbi__l2h_gamma) * stbi__l2h_scale); } - if (k < comp) output[i*comp + k] = data[i*comp+k]/255.0f; + } + if (n < comp) { + for (i=0; i < x*y; ++i) { + output[i*comp + n] = data[i*comp + n]/255.0f; + } } STBI_FREE(data); return output; From e64d4f89eb25b9f4fbf3121bb43c0fca225fbdbc Mon Sep 17 00:00:00 2001 From: Carmelo Fernandez Aguera Date: Thu, 7 Jun 2018 17:10:00 +0100 Subject: [PATCH 2/2] Added myself to the list of contributors. --- stb_image.h | 1 + 1 file changed, 1 insertion(+) diff --git a/stb_image.h b/stb_image.h index 4fee4fb..35f2f9f 100644 --- a/stb_image.h +++ b/stb_image.h @@ -84,6 +84,7 @@ RECENT REVISION HISTORY: Fabian "ryg" Giesen Anael Seghezzi (is-16-bit query) Arseny Kapoulkine John-Mark Allen + Carmelo J Fdez-Agüera Bug & warning fixes Marc LeBlanc David Woo Guillaume George Martins Mozeiko