Changes to the contrast/brightness/gamma formula for both hardware and shader gamma correction. Mainly makes a correction with the shader version where contrast/brightness being negative values would clip them inappropriately.

This commit is contained in:
raa-eruanna 2016-09-21 15:08:53 -04:00 committed by Christoph Oelckers
commit 72491049e0
2 changed files with 3 additions and 3 deletions

View file

@ -250,8 +250,8 @@ void OpenGLFrameBuffer::DoSetGamma()
for (int i = 0; i < 256; i++)
{
double val = i * contrast - (contrast - 1) * 127;
if(gamma != 1) val = pow(val, invgamma) / norm;
val += bright * 128;
if(gamma != 1) val = pow(val, invgamma) / norm;
gammaTable[i] = gammaTable[i + 256] = gammaTable[i + 512] = (WORD)clamp<double>(val*256, 0, 0xffff);
}