This commit is contained in:
Shyotl
2018-08-07 21:46:07 -05:00
59 changed files with 5058 additions and 7807 deletions

View File

@@ -28,9 +28,7 @@
#include "linden_common.h"
#define WIN32_LEAN_AND_MEAN
#include <winsock2.h>
#include <windows.h>
#include "llwin32headerslean.h"
#include "llkeyboardwin32.h"

View File

@@ -422,6 +422,10 @@ LLWindowWin32::LLWindowWin32(LLWindowCallbacks* callbacks,
LL_INFOS() << "Desired FSAA Samples = " << mFSAASamples << LL_ENDL;
memset(mCurrentGammaRamp, 0, sizeof(mCurrentGammaRamp));
memset(mPrevGammaRamp, 0, sizeof(mPrevGammaRamp));
mCustomGammaSet = FALSE;
// Initialize the keyboard
gKeyboard = new LLKeyboardWin32();
gKeyboard->setCallbacks(callbacks);
@@ -3020,13 +3024,26 @@ F32 LLWindowWin32::getGamma()
BOOL LLWindowWin32::restoreGamma()
{
return SetDeviceGammaRamp(mhDC, mPrevGammaRamp);
if (mCustomGammaSet != FALSE)
{
mCustomGammaSet = FALSE;
return SetDeviceGammaRamp(mhDC, mPrevGammaRamp);
}
return TRUE;
}
BOOL LLWindowWin32::setGamma(const F32 gamma)
{
mCurrentGamma = gamma;
//Get the previous gamma ramp to restore later.
if (mCustomGammaSet == FALSE)
{
if (GetDeviceGammaRamp(mhDC, mPrevGammaRamp) == FALSE)
return FALSE;
mCustomGammaSet = TRUE;
}
LL_DEBUGS("Window") << "Setting gamma to " << gamma << LL_ENDL;
for ( int i = 0; i < 256; ++i )
@@ -3038,9 +3055,9 @@ BOOL LLWindowWin32::setGamma(const F32 gamma)
if ( value > 0xffff )
value = 0xffff;
mCurrentGammaRamp [ 0 * 256 + i ] =
mCurrentGammaRamp [ 1 * 256 + i ] =
mCurrentGammaRamp [ 2 * 256 + i ] = ( WORD )value;
mCurrentGammaRamp[0][i] =
mCurrentGammaRamp[1][i] =
mCurrentGammaRamp[2][i] = (WORD) value;
};
return SetDeviceGammaRamp ( mhDC, mCurrentGammaRamp );

View File

@@ -27,10 +27,7 @@
#ifndef LL_LLWINDOWWIN32_H
#define LL_LLWINDOWWIN32_H
// Limit Windows API to small and manageable set.
#define WIN32_LEAN_AND_MEAN
#include <winsock2.h>
#include <windows.h>
#include "llwin32headerslean.h"
#include "llwindow.h"
#include "llwindowcallbacks.h"
@@ -192,8 +189,9 @@ protected:
F32 mCurrentGamma;
U32 mFSAASamples;
S32 mVsyncMode;
WORD mPrevGammaRamp[256*3];
WORD mCurrentGammaRamp[256*3];
WORD mPrevGammaRamp[3][256];
WORD mCurrentGammaRamp[3][256];
BOOL mCustomGammaSet;
LPWSTR mIconResource;
BOOL mMousePositionModified;