mirror of
https://github.com/glfw/glfw.git
synced 2024-11-23 02:25:10 +00:00
Initial implementation of gamma through Cocoa.
This commit is contained in:
parent
bca0283fdd
commit
688772111d
@ -43,6 +43,18 @@
|
||||
|
||||
void _glfwPlatformGetGammaRamp(GLFWgammaramp* ramp)
|
||||
{
|
||||
uint32_t sampleCount;
|
||||
int i;
|
||||
CGGammaValue red[GLFW_GAMMA_RAMP_SIZE];
|
||||
CGGammaValue green[GLFW_GAMMA_RAMP_SIZE];
|
||||
CGGammaValue blue[GLFW_GAMMA_RAMP_SIZE];
|
||||
CGGetDisplayTransferByTable(0, GLFW_GAMMA_RAMP_SIZE, red, green, blue, &sampleCount);
|
||||
for (i = 0; i < GLFW_GAMMA_RAMP_SIZE; i++)
|
||||
{
|
||||
_glfwLibrary.currentRamp.red[i] = red[i] * 65535;
|
||||
_glfwLibrary.currentRamp.green[i] = green[i] * 65535;
|
||||
_glfwLibrary.currentRamp.blue[i] = blue[i] * 65535;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -52,5 +64,16 @@ void _glfwPlatformGetGammaRamp(GLFWgammaramp* ramp)
|
||||
|
||||
void _glfwPlatformSetGammaRamp(const GLFWgammaramp* ramp)
|
||||
{
|
||||
int i;
|
||||
CGGammaValue red[GLFW_GAMMA_RAMP_SIZE];
|
||||
CGGammaValue green[GLFW_GAMMA_RAMP_SIZE];
|
||||
CGGammaValue blue[GLFW_GAMMA_RAMP_SIZE];
|
||||
for (i = 0; i < GLFW_GAMMA_RAMP_SIZE; i++)
|
||||
{
|
||||
red[i] = ((float)_glfwLibrary.currentRamp.red[i]) / 65535.0f;
|
||||
blue[i] = ((float)_glfwLibrary.currentRamp.green[i]) / 65535.0f;
|
||||
green[i] = ((float)_glfwLibrary.currentRamp.blue[i]) / 65535.0f;
|
||||
}
|
||||
CGSetDisplayTransferByTable(0, GLFW_GAMMA_RAMP_SIZE, red, green, blue);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user