From eeea24ebfb3b8c937bce39933d0e2c37d35aac0f Mon Sep 17 00:00:00 2001 From: Geoffrey McRae Date: Tue, 24 Oct 2023 13:46:51 +1100 Subject: [PATCH] [client] egl: invalidate the window when HDR settings are changed --- client/renderers/EGL/desktop.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/client/renderers/EGL/desktop.c b/client/renderers/EGL/desktop.c index 940fea13..c4dd1c59 100644 --- a/client/renderers/EGL/desktop.c +++ b/client/renderers/EGL/desktop.c @@ -288,13 +288,27 @@ void egl_desktopConfigUI(EGL_Desktop * desktop) igSliderInt("##nvgain", &desktop->nvGain, 0, desktop->nvMax, format, 0); igPopItemWidth(); + bool mapHDRtoSDR = desktop->mapHDRtoSDR; + int peakLuminance = desktop->peakLuminance; + int maxCLL = desktop->maxCLL; + igSeparator(); - igCheckbox("Map HDR content to SDR", &desktop->mapHDRtoSDR); - igSliderInt("Peak Luminance", &desktop->peakLuminance, 1, 10000, + igCheckbox("Map HDR content to SDR", &mapHDRtoSDR); + igSliderInt("Peak Luminance", &peakLuminance, 1, 10000, "%d nits", ImGuiInputTextFlags_CharsDecimal); - igSliderInt("Max content light level", &desktop->maxCLL, 1, 10000, + igSliderInt("Max content light level", &maxCLL, 1, 10000, "%d nits", ImGuiInputTextFlags_CharsDecimal); + + if (mapHDRtoSDR != desktop->mapHDRtoSDR || + peakLuminance != desktop->peakLuminance || + maxCLL != desktop->maxCLL) + { + desktop->mapHDRtoSDR = mapHDRtoSDR; + desktop->peakLuminance = max(1, peakLuminance); + desktop->maxCLL = max(1, maxCLL); + app_invalidateWindow(true); + } } bool egl_desktopSetup(EGL_Desktop * desktop, const LG_RendererFormat format)