genesys: Remove the FixedFloat class

merge-requests/340/head
Povilas Kanapickas 2020-02-02 15:23:20 +02:00
rodzic 62c6959df4
commit 7ee775e983
3 zmienionych plików z 18 dodań i 37 usunięć

Wyświetl plik

@ -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<ScanMethod> 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;

Wyświetl plik

@ -56,7 +56,6 @@ struct Genesys_Calibration_Cache;
class CommandSet;
// device.h
class FixedFloat;
struct Genesys_Gpo;
struct MethodResolutions;
struct Genesys_Model;

Wyświetl plik

@ -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<unsigned>(channels * 2 * dev->model->y_size * dev->settings.xres /
MM_PER_INCH);