From 9ddc64826c014638cd3422441c0e70431bf90fa8 Mon Sep 17 00:00:00 2001 From: Povilas Kanapickas Date: Mon, 3 Feb 2020 00:42:01 +0200 Subject: [PATCH] genesys: Remove uses of calib_resolution --- backend/genesys/device.cpp | 1 - backend/genesys/device.h | 1 - backend/genesys/gl124.cpp | 1 - backend/genesys/gl843.cpp | 2 -- backend/genesys/gl846.cpp | 15 +++++++-------- backend/genesys/gl847.cpp | 10 +++++----- 6 files changed, 12 insertions(+), 18 deletions(-) diff --git a/backend/genesys/device.cpp b/backend/genesys/device.cpp index d02de3be8..17d43338f 100644 --- a/backend/genesys/device.cpp +++ b/backend/genesys/device.cpp @@ -241,7 +241,6 @@ std::ostream& operator<<(std::ostream& out, const Genesys_Device& dev) << " average_size: " << dev.average_size << '\n' << " calib_lines: " << dev.calib_lines << '\n' << " calib_channels: " << dev.calib_channels << '\n' - << " calib_resolution: " << dev.calib_resolution << '\n' << " calib_total_bytes_to_read: " << dev.calib_total_bytes_to_read << '\n' << " calib_session: " << format_indent_braced_list(4, dev.calib_session) << '\n' << " gamma_override_tables[0].size(): " << dev.gamma_override_tables[0].size() << '\n' diff --git a/backend/genesys/device.h b/backend/genesys/device.h index c837384ec..80197270b 100644 --- a/backend/genesys/device.h +++ b/backend/genesys/device.h @@ -272,7 +272,6 @@ struct Genesys_Device // number of lines used during shading calibration size_t calib_lines = 0; size_t calib_channels = 0; - size_t calib_resolution = 0; // bytes to read from USB when calibrating. If 0, this is not set size_t calib_total_bytes_to_read = 0; diff --git a/backend/genesys/gl124.cpp b/backend/genesys/gl124.cpp index 8b06b71e9..95bdfe156 100644 --- a/backend/genesys/gl124.cpp +++ b/backend/genesys/gl124.cpp @@ -1195,7 +1195,6 @@ void CommandSetGl124::init_regs_for_shading(Genesys_Device* dev, const Genesys_S const auto& calib_sensor = sanei_genesys_find_sensor(dev, resolution, dev->calib_channels, dev->settings.scan_method); - dev->calib_resolution = resolution; dev->calib_total_bytes_to_read = 0; factor = calib_sensor.optical_res / resolution; diff --git a/backend/genesys/gl843.cpp b/backend/genesys/gl843.cpp index 4602acc95..a75f56da2 100644 --- a/backend/genesys/gl843.cpp +++ b/backend/genesys/gl843.cpp @@ -1734,8 +1734,6 @@ void CommandSetGl843::init_regs_for_shading(Genesys_Device* dev, const Genesys_S calib_pixels = calib_sensor.sensor_pixels / factor; } - dev->calib_resolution = resolution; - ScanFlag flags = ScanFlag::DISABLE_SHADING | ScanFlag::DISABLE_GAMMA | ScanFlag::DISABLE_BUFFER_FULL_MOVE | diff --git a/backend/genesys/gl846.cpp b/backend/genesys/gl846.cpp index 8b45b8a82..d699aacfd 100644 --- a/backend/genesys/gl846.cpp +++ b/backend/genesys/gl846.cpp @@ -960,17 +960,17 @@ void CommandSetGl846::init_regs_for_shading(Genesys_Device* dev, const Genesys_S dev->calib_channels = 3; - dev->calib_resolution = sensor.get_register_hwdpi(dev->settings.xres); + unsigned resolution = sensor.get_register_hwdpi(dev->settings.xres); - const auto& calib_sensor = sanei_genesys_find_sensor(dev, dev->calib_resolution, + const auto& calib_sensor = sanei_genesys_find_sensor(dev, resolution, dev->calib_channels, dev->settings.scan_method); dev->calib_total_bytes_to_read = 0; dev->calib_lines = dev->model->shading_lines; - if (dev->calib_resolution==4800) { + if (resolution == 4800) { dev->calib_lines *= 2; } - unsigned calib_pixels = (calib_sensor.sensor_pixels * dev->calib_resolution) / + unsigned calib_pixels = (calib_sensor.sensor_pixels * resolution) / calib_sensor.optical_res; DBG(DBG_io, "%s: calib_lines = %zu\n", __func__, dev->calib_lines); @@ -979,14 +979,13 @@ void CommandSetGl846::init_regs_for_shading(Genesys_Device* dev, const Genesys_S /* this is aworkaround insufficent distance for slope * motor acceleration TODO special motor slope for shading */ move=1; - if(dev->calib_resolution<1200) - { + if (resolution < 1200) { move=40; } ScanSession session; - session.params.xres = dev->calib_resolution; - session.params.yres = dev->calib_resolution; + session.params.xres = resolution; + session.params.yres = resolution; session.params.startx = 0; session.params.starty = static_cast(move); session.params.pixels = calib_pixels; diff --git a/backend/genesys/gl847.cpp b/backend/genesys/gl847.cpp index 919ebeda8..4a5b9f39e 100644 --- a/backend/genesys/gl847.cpp +++ b/backend/genesys/gl847.cpp @@ -967,25 +967,25 @@ void CommandSetGl847::init_regs_for_shading(Genesys_Device* dev, const Genesys_S dev->calib_channels = 3; - dev->calib_resolution = sensor.get_register_hwdpi(dev->settings.xres); + unsigned resolution = sensor.get_register_hwdpi(dev->settings.xres); - const auto& calib_sensor = sanei_genesys_find_sensor(dev, dev->calib_resolution, + const auto& calib_sensor = sanei_genesys_find_sensor(dev, resolution, dev->calib_channels, dev->settings.scan_method); dev->calib_total_bytes_to_read = 0; dev->calib_lines = dev->model->shading_lines; - if (dev->calib_resolution == 4800) { + if (resolution == 4800) { dev->calib_lines *= 2; } - unsigned calib_pixels = (calib_sensor.sensor_pixels * dev->calib_resolution) / + unsigned calib_pixels = (calib_sensor.sensor_pixels * resolution) / calib_sensor.optical_res; DBG(DBG_io, "%s: calib_lines = %zu\n", __func__, dev->calib_lines); DBG(DBG_io, "%s: calib_pixels = %u\n", __func__, calib_pixels); ScanSession session; - session.params.xres = dev->calib_resolution; + session.params.xres = resolution; session.params.yres = dev->motor.base_ydpi; session.params.startx = 0; session.params.starty = 20;