From 763ec6cbcbf73a87b3ff99cf2969733d3e269bfa Mon Sep 17 00:00:00 2001 From: siavash Date: Fri, 5 Jul 2013 14:26:02 +0200 Subject: [PATCH] Cleanup. --- src/gamma.c | 12 +++++------- src/glx_context.c | 14 ++++++-------- 2 files changed, 11 insertions(+), 15 deletions(-) diff --git a/src/gamma.c b/src/gamma.c index c538b590..499267a2 100644 --- a/src/gamma.c +++ b/src/gamma.c @@ -81,18 +81,16 @@ GLFWAPI void glfwSetGamma(GLFWmonitor* handle, float gamma) for (i = 0; i < 256; i++) { - float value; + double value; // Calculate intensity - value = i / 255.f; + value = i / 255.0; // Apply gamma curve - value = (float) pow(value, 1.f / gamma) * 65535.f + 0.5f; + value = pow(value, 1.0 / gamma) * 65535.0 + 0.5; // Clamp to value range - if (value < 0.f) - value = 0.f; - else if (value > 65535.f) - value = 65535.f; + if (value > 65535.0) + value = 65535.0; values[i] = (unsigned short) value; } diff --git a/src/glx_context.c b/src/glx_context.c index d8989dff..724037f4 100644 --- a/src/glx_context.c +++ b/src/glx_context.c @@ -191,14 +191,12 @@ static GLXContext createLegacyContext(_GLFWwindow* window, share, True); } - else - { - return glXCreateNewContext(_glfw.x11.display, - fbconfig, - GLX_RGBA_TYPE, - share, - True); - } + + return glXCreateNewContext(_glfw.x11.display, + fbconfig, + GLX_RGBA_TYPE, + share, + True); }