From c5f7eff19019eb7e44704277924d554831ba47d4 Mon Sep 17 00:00:00 2001 From: Camilla Berglund Date: Thu, 27 Sep 2012 02:35:19 +0200 Subject: [PATCH] Fixed use of functions missing on VC++. --- src/gamma.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/gamma.c b/src/gamma.c index eed0b66d..51e0ce14 100644 --- a/src/gamma.c +++ b/src/gamma.c @@ -67,8 +67,12 @@ GLFWAPI void glfwSetGamma(float gamma) value = (float) i / (float) (size - 1); // Apply gamma curve value = (float) pow(value, 1.f / gamma) * 65535.f + 0.5f; + // Clamp to value range - value = (float) fmax(fmin(value, 65535.f), 0.f); + if (value < 0.f) + value = 0.f; + else if (value > 65535.f) + value = 65535.f; ramp.red[i] = (unsigned short) value; ramp.green[i] = (unsigned short) value;