From 553dcc64e131367586d36d59be0d731cbfa689fc Mon Sep 17 00:00:00 2001 From: Jonathan Thomas Date: Fri, 18 Nov 2022 00:24:43 -0600 Subject: [PATCH] Fixing regression with mask effect caused by contrast being adjusted after we modulate the brightness (sort error) --- src/effects/Mask.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/effects/Mask.cpp b/src/effects/Mask.cpp index 69f6e63f..bf720c0b 100644 --- a/src/effects/Mask.cpp +++ b/src/effects/Mask.cpp @@ -110,13 +110,13 @@ std::shared_ptr Mask::GetFrame(std::shared_ptr // Get the average luminosity int gray_value = qGray(R, G, B); + // Adjust the brightness + gray_value += (255 * brightness_value); + // Adjust the contrast float factor = (259 * (contrast_value + 255)) / (255 * (259 - contrast_value)); gray_value = constrain((factor * (gray_value - 128)) + 128); - // Adjust the brightness - gray_value += (255 * brightness_value); - // Constrain the value from 0 to 255 gray_value = constrain(gray_value);