mirror of
https://github.com/glfw/glfw.git
synced 2025-10-04 13:46:37 +00:00
Monitor: simplify gamma range check
Assertions and tests in glfwSetGamma verify that user-supplied gamma is a positive finite value, but tests for error reporting are redundant given the preceding asserts (however asserts allow gamma == 0, which is probably not intended). Remove the asserts and simplify the range check. Alternatively, it may be spelled as 'isfinite(gamma) && gamma > 0'.
This commit is contained in:
parent
bb2ca1da13
commit
2bd0a24107
@ -431,13 +431,10 @@ GLFWAPI void glfwSetGamma(GLFWmonitor* handle, float gamma)
|
|||||||
unsigned short values[256];
|
unsigned short values[256];
|
||||||
GLFWgammaramp ramp;
|
GLFWgammaramp ramp;
|
||||||
assert(handle != NULL);
|
assert(handle != NULL);
|
||||||
assert(gamma == gamma);
|
|
||||||
assert(gamma >= 0.f);
|
|
||||||
assert(gamma <= FLT_MAX);
|
|
||||||
|
|
||||||
_GLFW_REQUIRE_INIT();
|
_GLFW_REQUIRE_INIT();
|
||||||
|
|
||||||
if (gamma != gamma || gamma <= 0.f || gamma > FLT_MAX)
|
if (!(gamma > 0.f && 1.f / gamma != 0.f))
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_INVALID_VALUE, "Invalid gamma value %f", gamma);
|
_glfwInputError(GLFW_INVALID_VALUE, "Invalid gamma value %f", gamma);
|
||||||
return;
|
return;
|
||||||
|
Loading…
Reference in New Issue
Block a user