diff options
author | AndreyL ProductEngine <alihatskiy@productengine.com> | 2019-08-22 23:22:46 +0300 |
---|---|---|
committer | AndreyL ProductEngine <alihatskiy@productengine.com> | 2019-08-22 23:22:46 +0300 |
commit | 7d9b7e93ed0a157320ccc86d65f16e7fdfc8fbf1 (patch) | |
tree | 3e2209066cda28b08606050202e64246b95c416e /indra/llwindow | |
parent | 42dcb38a2daf456913802bd6c37cc6f2a141975b (diff) | |
parent | e9ead7cc2ee9970b468ef6de0ba57726bb203ef4 (diff) |
Merged in lindenlab/viewer-release
Diffstat (limited to 'indra/llwindow')
-rw-r--r-- | indra/llwindow/llwindowwin32.cpp | 34 | ||||
-rw-r--r-- | indra/llwindow/llwindowwin32.h | 5 |
2 files changed, 32 insertions, 7 deletions
diff --git a/indra/llwindow/llwindowwin32.cpp b/indra/llwindow/llwindowwin32.cpp index 504c1589b0..985bd79d13 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)) { @@ -2989,13 +2992,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 ) @@ -3007,9 +3031,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 ); @@ -4012,7 +4036,7 @@ void LLWindowWin32::setDPIAwareness() F32 LLWindowWin32::getSystemUISize() { - float scale_value = 0; + F32 scale_value = 1.f; HWND hWnd = (HWND)getPlatformWindow(); HDC hdc = GetDC(hWnd); HMONITOR hMonitor; diff --git a/indra/llwindow/llwindowwin32.h b/indra/llwindow/llwindowwin32.h index d72623a6f4..9cd16eb993 100644 --- a/indra/llwindow/llwindowwin32.h +++ b/indra/llwindow/llwindowwin32.h @@ -184,8 +184,9 @@ protected: F32 mCurrentGamma; U32 mFSAASamples; - WORD mPrevGammaRamp[256*3]; - WORD mCurrentGammaRamp[256*3]; + WORD mPrevGammaRamp[3][256]; + WORD mCurrentGammaRamp[3][256]; + BOOL mCustomGammaSet; LPWSTR mIconResource; BOOL mMousePositionModified; |