From a694002364761f179db8d0694b46afe5a3509750 Mon Sep 17 00:00:00 2001 From: Povilas Kanapickas Date: Sun, 13 Oct 2019 06:18:48 +0300 Subject: [PATCH] genesys: Switch session startx and starty to unsigned The sources and destinations are integer in most cases for these variables. --- backend/genesys/gl843.cpp | 10 +++------- backend/genesys/low.cpp | 2 +- backend/genesys/settings.h | 6 +++--- 3 files changed, 7 insertions(+), 11 deletions(-) diff --git a/backend/genesys/gl843.cpp b/backend/genesys/gl843.cpp index b4df5fe72..55a5c42b9 100644 --- a/backend/genesys/gl843.cpp +++ b/backend/genesys/gl843.cpp @@ -1043,11 +1043,7 @@ static void gl843_init_optical_regs_scan(Genesys_Device* dev, const Genesys_Sens Genesys_Register_Set* reg, unsigned int exposure, const ScanSession& session) { - DBG_HELPER_ARGS(dbg, "exposure=%d, used_res=%d, start=%f, pixels=%d, channels=%d, depth=%d, " - "ccd_size_divisor=%d", - exposure, session.output_resolution, session.params.startx, - session.optical_pixels, session.params.channels, session.params.depth, - session.ccd_size_divisor); + DBG_HELPER_ARGS(dbg, "exposure=%d", exposure); unsigned int dpihw; unsigned int tgtime; /**> exposure time multiplier */ GenesysRegister *r; @@ -2370,8 +2366,8 @@ void CommandSetGl843::init_regs_for_scan(Genesys_Device* dev, const Genesys_Sens ScanSession session; session.params.xres = dev->settings.xres; session.params.yres = dev->settings.yres; - session.params.startx = start; - session.params.starty = move; + session.params.startx = static_cast(start); + session.params.starty = static_cast(move); session.params.pixels = dev->settings.pixels; session.params.requested_pixels = dev->settings.requested_pixels; session.params.lines = dev->settings.lines; diff --git a/backend/genesys/low.cpp b/backend/genesys/low.cpp index f4825b3fe..d757141ab 100644 --- a/backend/genesys/low.cpp +++ b/backend/genesys/low.cpp @@ -2517,7 +2517,7 @@ void debug_dump(unsigned level, const SetupParams& params) "Pixels per line (requested) : %u\n" "Depth : %u\n" "Channels : %u\n" - "Start position X/Y : %g / %g\n" + "Start position X/Y : %u / %u\n" "Scan mode : %d\n" "Color filter : %d\n" "Flags : %x\n", diff --git a/backend/genesys/settings.h b/backend/genesys/settings.h index 5dc335489..3c00b8c36 100644 --- a/backend/genesys/settings.h +++ b/backend/genesys/settings.h @@ -114,9 +114,9 @@ struct SetupParams { // resolution in y direction unsigned yres = NOT_SET; // start pixel in X direction, from dummy_pixel + 1 - float startx = -1; + unsigned startx = NOT_SET; // start pixel in Y direction, counted according to base_ydpi - float starty = -1; + unsigned starty = NOT_SET; // the number of pixels in X direction. Note that each logical pixel may correspond to more // than one CCD pixel, see CKSEL and GenesysSensor::ccd_pixels_per_system_pixel() unsigned pixels = NOT_SET; @@ -153,7 +153,7 @@ struct SetupParams { void assert_valid() const { - if (xres == NOT_SET || yres == NOT_SET || startx < 0 || starty < 0 || + if (xres == NOT_SET || yres == NOT_SET || startx == NOT_SET || starty == NOT_SET || pixels == NOT_SET || lines == NOT_SET ||depth == NOT_SET || channels == NOT_SET || scan_method == static_cast(NOT_SET) || scan_mode == static_cast(NOT_SET) ||