From 7ee775e983911577b74a64db40809933284e44f8 Mon Sep 17 00:00:00 2001 From: Povilas Kanapickas Date: Sun, 2 Feb 2020 15:23:20 +0200 Subject: [PATCH] genesys: Remove the FixedFloat class --- backend/genesys/device.h | 48 ++++++++++++------------------------- backend/genesys/fwd.h | 1 - backend/genesys/genesys.cpp | 6 ++--- 3 files changed, 18 insertions(+), 37 deletions(-) diff --git a/backend/genesys/device.h b/backend/genesys/device.h index 37a79fe41..479c2be79 100644 --- a/backend/genesys/device.h +++ b/backend/genesys/device.h @@ -78,24 +78,6 @@ struct Genesys_Gpo GenesysRegisterSettingSet regs; }; -/// Stores a SANE_Fixed value which is automatically converted from and to floating-point values -class FixedFloat -{ -public: - FixedFloat() = default; - FixedFloat(const FixedFloat&) = default; - FixedFloat(double number) : value_{double_to_fixed(number)} {} - FixedFloat& operator=(const FixedFloat&) = default; - FixedFloat& operator=(double number) { value_ = double_to_fixed(number); return *this; } - - operator double() const { return value(); } - - double value() const { return fixed_to_double(value_); } - -private: - SANE_Fixed value_ = 0; -}; - struct MethodResolutions { std::vector methods; @@ -144,49 +126,49 @@ struct Genesys_Model // All offsets below are with respect to the sensor home position // Start of scan area in mm - FixedFloat x_offset = 0; + float x_offset = 0; // Start of scan area in mm (Amount of feeding needed to get to the medium) - FixedFloat y_offset = 0; + float y_offset = 0; // Size of scan area in mm - FixedFloat x_size = 0; + float x_size = 0; // Size of scan area in mm - FixedFloat y_size = 0; + float y_size = 0; // Start of white strip in mm - FixedFloat y_offset_calib_white = 0; + float y_offset_calib_white = 0; // Start of black mark in mm - FixedFloat x_offset_calib_black = 0; + float x_offset_calib_black = 0; // Start of scan area in transparency mode in mm - FixedFloat x_offset_ta = 0; + float x_offset_ta = 0; // Start of scan area in transparency mode in mm - FixedFloat y_offset_ta = 0; + float y_offset_ta = 0; // Size of scan area in transparency mode in mm - FixedFloat x_size_ta = 0; + float x_size_ta = 0; // Size of scan area in transparency mode in mm - FixedFloat y_size_ta = 0; + float y_size_ta = 0; // The position of the sensor when it's aligned with the lamp for transparency scanning - FixedFloat y_offset_sensor_to_ta = 0; + float y_offset_sensor_to_ta = 0; // Start of white strip in transparency mode in mm - FixedFloat y_offset_calib_white_ta = 0; + float y_offset_calib_white_ta = 0; // Start of black strip in transparency mode in mm - FixedFloat y_offset_calib_black_ta = 0; + float y_offset_calib_black_ta = 0; // Size of scan area after paper sensor stop sensing document in mm - FixedFloat post_scan = 0; + float post_scan = 0; // Amount of feeding needed to eject document after finishing scanning in mm - FixedFloat eject_feed = 0; + float eject_feed = 0; // Line-distance correction (in pixel at optical_ydpi) for CCD scanners SANE_Int ld_shift_r = 0; diff --git a/backend/genesys/fwd.h b/backend/genesys/fwd.h index 80bb452c0..6665ba6be 100644 --- a/backend/genesys/fwd.h +++ b/backend/genesys/fwd.h @@ -56,7 +56,6 @@ struct Genesys_Calibration_Cache; class CommandSet; // device.h -class FixedFloat; struct Genesys_Gpo; struct MethodResolutions; struct Genesys_Model; diff --git a/backend/genesys/genesys.cpp b/backend/genesys/genesys.cpp index e1dd7d953..4f2a2011a 100644 --- a/backend/genesys/genesys.cpp +++ b/backend/genesys/genesys.cpp @@ -690,7 +690,7 @@ void sanei_genesys_search_reference_point(Genesys_Device* dev, Genesys_Sensor& s top += 10; dev->model->y_offset_calib_white = (top * MM_PER_INCH) / dpi; DBG(DBG_info, "%s: black stripe y_offset = %f mm \n", __func__, - dev->model->y_offset_calib_white.value()); + dev->model->y_offset_calib_white); } /* find white corner in dark area : TODO yet another flag */ @@ -711,7 +711,7 @@ void sanei_genesys_search_reference_point(Genesys_Device* dev, Genesys_Sensor& s top = top / count; dev->model->y_offset_calib_white = (top * MM_PER_INCH) / dpi; DBG(DBG_info, "%s: white corner y_offset = %f mm\n", __func__, - dev->model->y_offset_calib_white.value()); + dev->model->y_offset_calib_white); } DBG(DBG_proc, "%s: ccd_start_xoffset = %d, left = %d, top = %d\n", __func__, @@ -1464,7 +1464,7 @@ static void genesys_coarse_calibration(Genesys_Device* dev, Genesys_Sensor& sens unsigned channels = dev->settings.get_channels(); - DBG(DBG_info, "channels %d y_size %f xres %d\n", channels, dev->model->y_size.value(), + DBG(DBG_info, "channels %d y_size %f xres %d\n", channels, dev->model->y_size, dev->settings.xres); unsigned size = static_cast(channels * 2 * dev->model->y_size * dev->settings.xres / MM_PER_INCH);