genesys: Simplify lamp warmup setup on gl843

fix-build-obselete-jpeg
Povilas Kanapickas 2020-03-21 00:03:29 +02:00
rodzic 3c8b103d82
commit fe8ffefe1b
2 zmienionych plików z 14 dodań i 7 usunięć

Wyświetl plik

@ -100,6 +100,16 @@ struct MethodResolutions
return *std::min_element(resolutions_x.begin(), resolutions_x.end());
}
unsigned get_nearest_resolution_x(unsigned resolution) const
{
return *std::min_element(resolutions_x.begin(), resolutions_x.end(),
[&](unsigned lhs, unsigned rhs)
{
return std::abs(static_cast<int>(lhs) - static_cast<int>(resolution)) <
std::abs(static_cast<int>(rhs) - static_cast<int>(resolution));
});
}
unsigned get_min_resolution_y() const
{
return *std::min_element(resolutions_y.begin(), resolutions_y.end());

Wyświetl plik

@ -1752,14 +1752,11 @@ void CommandSetGl843::init_regs_for_warmup(Genesys_Device* dev, const Genesys_Se
int* total_size) const
{
DBG_HELPER(dbg);
int dpihw;
int resolution;
(void) sensor;
/* setup scan */
*channels=3;
resolution=600;
dpihw = sensor.get_register_hwdpi(resolution);
resolution=dpihw;
*channels=3;
unsigned resolution = dev->model->get_resolution_settings(dev->settings.scan_method)
.get_nearest_resolution_x(600);
const auto& calib_sensor = sanei_genesys_find_sensor(dev, resolution, *channels,
dev->settings.scan_method);