genesys: Enable gamma setting when contrast or brightness is adjusted

Brightness and contrast adjustments are handled via gamma tables and
thus gamma functionality is required for these settings to have any
effect.

Previously if the device has a sensor with identity gamma
(gamma = {1, 1, 1}), then gamma tables were turned off, consequently
brightness and contrast settings had no effect.

The underlying issue was identified by Gunnar Hjalmarsson
<gunnarhj@ubuntu.com> and STK.
release-1.1.x
Povilas Kanapickas 2021-12-26 14:53:15 +02:00
rodzic 2cc2f8a26b
commit c6df5fd69a
1 zmienionych plików z 7 dodań i 2 usunięć

Wyświetl plik

@ -638,11 +638,16 @@ bool should_enable_gamma(const ScanSession& session, const Genesys_Sensor& senso
if ((session.params.flags & ScanFlag::DISABLE_GAMMA) != ScanFlag::NONE) {
return false;
}
if (session.params.depth == 16) {
return false;
}
if (session.params.brightness_adjustment != 0 || session.params.contrast_adjustment != 0) {
return true;
}
if (sensor.gamma[0] == 1.0f || sensor.gamma[1] == 1.0f || sensor.gamma[2] == 1.0f) {
return false;
}
if (session.params.depth == 16)
return false;
return true;
}