summaryrefslogtreecommitdiff
path: root/indra/llwindow/llwindowwin32.cpp
diff options
context:
space:
mode:
authorAndreyL ProductEngine <alihatskiy@productengine.com>2019-06-22 03:16:39 +0300
committerAndreyL ProductEngine <alihatskiy@productengine.com>2019-06-22 03:16:39 +0300
commit13580377c40dc6fe52281a2139442641a57f7e4b (patch)
tree2dbd805f8ea3b17a02b690b86d97bed99e4898ce /indra/llwindow/llwindowwin32.cpp
parent6700f2907aa63b1a5b683518b9fe9c4b4e6bc02e (diff)
parent6f95100f7e33e6cd6e5bc462b1577c3a45fd964c (diff)
Merged in lindenlab/viewer-release
Diffstat (limited to 'indra/llwindow/llwindowwin32.cpp')
-rw-r--r--indra/llwindow/llwindowwin32.cpp32
1 files changed, 28 insertions, 4 deletions
diff --git a/indra/llwindow/llwindowwin32.cpp b/indra/llwindow/llwindowwin32.cpp
index a24f168ab1..66b8bf8aee 100644
--- a/indra/llwindow/llwindowwin32.cpp
+++ b/indra/llwindow/llwindowwin32.cpp
@@ -425,6 +425,9 @@ LLWindowWin32::LLWindowWin32(LLWindowCallbacks* callbacks,
mKeyVirtualKey = 0;
mhDC = NULL;
mhRC = NULL;
+ memset(mCurrentGammaRamp, 0, sizeof(mCurrentGammaRamp));
+ memset(mPrevGammaRamp, 0, sizeof(mPrevGammaRamp));
+ mCustomGammaSet = FALSE;
if (!SystemParametersInfo(SPI_GETMOUSEVANISH, 0, &mMouseVanish, 0))
{
@@ -3000,13 +3003,34 @@ F32 LLWindowWin32::getGamma()
BOOL LLWindowWin32::restoreGamma()
{
- return SetDeviceGammaRamp(mhDC, mPrevGammaRamp);
+ if (mCustomGammaSet != FALSE)
+ {
+ LL_DEBUGS("Window") << "Restoring gamma" << LL_ENDL;
+ 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 (!gGLManager.mIsIntel) // skip for Intel GPUs (see SL-11341)
+ {
+ LL_DEBUGS("Window") << "Getting the previous gamma ramp to restore later" << LL_ENDL;
+ if(GetDeviceGammaRamp(mhDC, mPrevGammaRamp) == FALSE)
+ {
+ LL_WARNS("Window") << "Failed to get the previous gamma ramp" << LL_ENDL;
+ return FALSE;
+ }
+ }
+ mCustomGammaSet = TRUE;
+ }
+
LL_DEBUGS("Window") << "Setting gamma to " << gamma << LL_ENDL;
for ( int i = 0; i < 256; ++i )
@@ -3018,9 +3042,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 );