mirror of
https://github.com/glfw/glfw.git
synced 2024-11-10 09:01:46 +00:00
Win32: Fix VS static analysis false positive
This way is perhaps also more readable for humans.
(cherry picked from commit cbf23e5615
)
This commit is contained in:
parent
79f4ec6822
commit
71cfafe2f9
@ -477,7 +477,7 @@ void _glfwPlatformGetVideoMode(_GLFWmonitor* monitor, GLFWvidmode* mode)
|
|||||||
GLFWbool _glfwPlatformGetGammaRamp(_GLFWmonitor* monitor, GLFWgammaramp* ramp)
|
GLFWbool _glfwPlatformGetGammaRamp(_GLFWmonitor* monitor, GLFWgammaramp* ramp)
|
||||||
{
|
{
|
||||||
HDC dc;
|
HDC dc;
|
||||||
WORD values[768];
|
WORD values[3][256];
|
||||||
|
|
||||||
dc = CreateDCW(L"DISPLAY", monitor->win32.adapterName, NULL, NULL);
|
dc = CreateDCW(L"DISPLAY", monitor->win32.adapterName, NULL, NULL);
|
||||||
GetDeviceGammaRamp(dc, values);
|
GetDeviceGammaRamp(dc, values);
|
||||||
@ -485,9 +485,9 @@ GLFWbool _glfwPlatformGetGammaRamp(_GLFWmonitor* monitor, GLFWgammaramp* ramp)
|
|||||||
|
|
||||||
_glfwAllocGammaArrays(ramp, 256);
|
_glfwAllocGammaArrays(ramp, 256);
|
||||||
|
|
||||||
memcpy(ramp->red, values + 0, 256 * sizeof(unsigned short));
|
memcpy(ramp->red, values[0], sizeof(values[0]));
|
||||||
memcpy(ramp->green, values + 256, 256 * sizeof(unsigned short));
|
memcpy(ramp->green, values[1], sizeof(values[1]));
|
||||||
memcpy(ramp->blue, values + 512, 256 * sizeof(unsigned short));
|
memcpy(ramp->blue, values[2], sizeof(values[2]));
|
||||||
|
|
||||||
return GLFW_TRUE;
|
return GLFW_TRUE;
|
||||||
}
|
}
|
||||||
@ -495,7 +495,7 @@ GLFWbool _glfwPlatformGetGammaRamp(_GLFWmonitor* monitor, GLFWgammaramp* ramp)
|
|||||||
void _glfwPlatformSetGammaRamp(_GLFWmonitor* monitor, const GLFWgammaramp* ramp)
|
void _glfwPlatformSetGammaRamp(_GLFWmonitor* monitor, const GLFWgammaramp* ramp)
|
||||||
{
|
{
|
||||||
HDC dc;
|
HDC dc;
|
||||||
WORD values[768];
|
WORD values[3][256];
|
||||||
|
|
||||||
if (ramp->size != 256)
|
if (ramp->size != 256)
|
||||||
{
|
{
|
||||||
@ -504,9 +504,9 @@ void _glfwPlatformSetGammaRamp(_GLFWmonitor* monitor, const GLFWgammaramp* ramp)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
memcpy(values + 0, ramp->red, 256 * sizeof(unsigned short));
|
memcpy(values[0], ramp->red, sizeof(values[0]));
|
||||||
memcpy(values + 256, ramp->green, 256 * sizeof(unsigned short));
|
memcpy(values[1], ramp->green, sizeof(values[1]));
|
||||||
memcpy(values + 512, ramp->blue, 256 * sizeof(unsigned short));
|
memcpy(values[2], ramp->blue, sizeof(values[2]));
|
||||||
|
|
||||||
dc = CreateDCW(L"DISPLAY", monitor->win32.adapterName, NULL, NULL);
|
dc = CreateDCW(L"DISPLAY", monitor->win32.adapterName, NULL, NULL);
|
||||||
SetDeviceGammaRamp(dc, values);
|
SetDeviceGammaRamp(dc, values);
|
||||||
|
Loading…
Reference in New Issue
Block a user