1
0
Fork 0
mirror of https://github.com/gwm17/glfw.git synced 2024-11-23 02:38:52 -05:00

Merge branch 'master' of ssh://glfw.git.sourceforge.net/gitroot/glfw/glfw

This commit is contained in:
Camilla Berglund 2010-10-24 18:34:24 +02:00
commit 7e2b014d81
5 changed files with 18 additions and 42 deletions

View File

@ -82,7 +82,7 @@ GLFWAPI void glfwSetGammaFormula(float gamma, float blacklevel, float gain)
//========================================================================
// Return the currently set gamma ramp
// Return the cached currently set gamma ramp
//========================================================================
GLFWAPI void glfwGetGammaRamp(GLFWgammaramp* ramp)

View File

@ -270,7 +270,6 @@ typedef struct _GLFWlibraryWin32
ATOM classAtom; // Window class atom
HHOOK keyboardHook; // Keyboard hook handle
DWORD foregroundLockTimeout;
HDC desktopDC;
// Default monitor
struct {

View File

@ -1,11 +1,10 @@
//========================================================================
// GLFW - An OpenGL framework
// Platform: Win32/WGL
// API version: 2.7
// API version: 3.0
// WWW: http://www.glfw.org/
//------------------------------------------------------------------------
// Copyright (c) 2002-2006 Marcus Geelnard
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
// Copyright (c) 2010 Camilla Berglund <elmindreda@elmindreda.org>
//
// This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages
@ -33,35 +32,26 @@
#include <limits.h>
//************************************************************************
//**** GLFW internal functions ****
//************************************************************************
//////////////////////////////////////////////////////////////////////////
////// GLFW platform API //////
//////////////////////////////////////////////////////////////////////////
//========================================================================
// Save the gamma ramp to our internal copy
// Retrieve the currently set gamma ramp
//========================================================================
void _glfwPlatformSaveGammaRamp(int ramp)
void _glfwPlatformGetGammaRamp(GLFWgammaramp* ramp)
{
if (!_glfwLibrary.gammaSize)
{
return;
}
_glfw_GetDeviceGammaRamp(_glfwLibrary.Win32.desktopDC,
_glfwLibrary.gammaRamp[ramp]);
_glfw_GetDeviceGammaRamp(GetDC(GetDesktopWindow()), (WORD*) ramp);
}
//========================================================================
// Restore the gamma ramp to our internal copy of the gamma ramp
// Push the specified gamma ramp to the monitor
//========================================================================
void _glfwPlatformRestoreGammaRamp(int ramp)
void _glfwPlatformSetGammaRamp(const GLFWgammaramp* ramp)
{
if (!_glfwLibrary.gammaSize)
{
return;
}
_glfw_SetDeviceGammaRamp(_glfwLibrary.Win32.desktopDC,
_glfwLibrary.gammaRamp[ramp]);
_glfw_SetDeviceGammaRamp(GetDC(GetDesktopWindow()), (WORD*) ramp);
}

View File

@ -160,18 +160,9 @@ int _glfwPlatformInit(void)
_glfwLibrary.Win32.instance = GetModuleHandle(NULL);
// Initialise the internal gamma ramp
_glfwLibrary.gammaSize = 256;
_glfwLibrary.gammaRamp[GLFW_GAMMA_ORIG] =
malloc(256 * sizeof(unsigned short) * 3);
_glfwLibrary.gammaRamp[GLFW_GAMMA_CURR] =
malloc(256 * sizeof(unsigned short) * 3);
// Get the desktop DC
_glfwLibrary.Win32.desktopDC = GetDC(GetDesktopWindow());
// Save the original gamma ramp
_glfwPlatformSaveGammaRamp(GLFW_GAMMA_ORIG);
_glfwLibrary.originalRampSize = 256;
_glfwPlatformGetGammaRamp(&_glfwLibrary.originalRamp);
_glfwInitTimer();
@ -186,11 +177,7 @@ int _glfwPlatformInit(void)
int _glfwPlatformTerminate(void)
{
// Restore the original gamma ramp
_glfwPlatformRestoreGammaRamp(GLFW_GAMMA_ORIG);
// Free the gamma ramps
free(_glfwLibrary.gammaRamp[GLFW_GAMMA_ORIG]);
free(_glfwLibrary.gammaRamp[GLFW_GAMMA_CURR]);
_glfwPlatformSetGammaRamp(&_glfwLibrary.originalRamp);
if (_glfwLibrary.Win32.classAtom)
{

View File

@ -38,7 +38,7 @@
//////////////////////////////////////////////////////////////////////////
//========================================================================
// Save the original gamma ramp so that we can restore it later
// Retrieve the currently set gamma ramp
//========================================================================
void _glfwPlatformGetGammaRamp(GLFWgammaramp* ramp)
@ -80,7 +80,7 @@ void _glfwPlatformGetGammaRamp(GLFWgammaramp* ramp)
//========================================================================
// Make the specified gamma ramp current
// Push the specified gamma ramp to the monitor
//========================================================================
void _glfwPlatformSetGammaRamp(const GLFWgammaramp* ramp)