Fixed overbright screenshots with hardware gamma off

When render buffers are used to apply gamma/brightness/contrast screenshots should not use PNG gamma correction
This commit is contained in:
alexey.lysiuk 2017-12-06 10:59:20 +02:00
commit 5162e7162e
13 changed files with 29 additions and 21 deletions

View file

@ -487,7 +487,7 @@ void OpenGLFrameBuffer::FillSimplePoly(FTexture *texture, FVector2 *points, int
//
//===========================================================================
void OpenGLFrameBuffer::GetScreenshotBuffer(const uint8_t *&buffer, int &pitch, ESSType &color_type)
void OpenGLFrameBuffer::GetScreenshotBuffer(const uint8_t *&buffer, int &pitch, ESSType &color_type, float &gamma)
{
const auto &viewport = GLRenderer->mOutputLetterbox;
@ -527,6 +527,10 @@ void OpenGLFrameBuffer::GetScreenshotBuffer(const uint8_t *&buffer, int &pitch,
pitch = -w*3;
color_type = SS_RGB;
buffer = ScreenshotBuffer + w * 3 * (h - 1);
// Screenshot should not use gamma correction if it was already applied to rendered image
EXTERN_CVAR(Bool, fullscreen);
gamma = 1 == vid_hwgamma || (2 == vid_hwgamma && !fullscreen) ? 1.0f : Gamma;
}
//===========================================================================