mirror of
https://github.com/glfw/glfw.git
synced 2024-11-10 00:51:47 +00:00
Added and documented glfwSetGamma value checks.
This commit is contained in:
parent
76fff4d042
commit
5bbc2b4949
@ -1424,7 +1424,8 @@ GLFWAPI const GLFWvidmode* glfwGetVideoMode(GLFWmonitor* monitor);
|
|||||||
/*! @brief Generates a gamma ramp and sets it for the specified monitor.
|
/*! @brief Generates a gamma ramp and sets it for the specified monitor.
|
||||||
*
|
*
|
||||||
* This function generates a 256-element gamma ramp from the specified exponent
|
* This function generates a 256-element gamma ramp from the specified exponent
|
||||||
* and then calls @ref glfwSetGammaRamp with it.
|
* and then calls @ref glfwSetGammaRamp with it. The value must be a finite
|
||||||
|
* number greater than zero.
|
||||||
*
|
*
|
||||||
* @param[in] monitor The monitor whose gamma ramp to set.
|
* @param[in] monitor The monitor whose gamma ramp to set.
|
||||||
* @param[in] gamma The desired exponent.
|
* @param[in] gamma The desired exponent.
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
#include "internal.h"
|
#include "internal.h"
|
||||||
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
#include <float.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
@ -385,10 +386,9 @@ GLFWAPI void glfwSetGamma(GLFWmonitor* handle, float gamma)
|
|||||||
|
|
||||||
_GLFW_REQUIRE_INIT();
|
_GLFW_REQUIRE_INIT();
|
||||||
|
|
||||||
if (gamma <= 0.f)
|
if (gamma != gamma || gamma <= 0.f || gamma > FLT_MAX)
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_INVALID_VALUE,
|
_glfwInputError(GLFW_INVALID_VALUE, "Invalid gamma value");
|
||||||
"Gamma value must be greater than zero");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user