kopia lustrzana https://gitlab.com/sane-project/backends
genesys: Simplify segment count calculation
rodzic
a4729cff19
commit
ae784d9927
|
@ -710,12 +710,7 @@ static void gl846_init_optical_regs_scan(Genesys_Device* dev, const Genesys_Sens
|
||||||
unsigned startx = start / ccd_pixels_per_system_pixel + sensor.CCD_start_xoffset;
|
unsigned startx = start / ccd_pixels_per_system_pixel + sensor.CCD_start_xoffset;
|
||||||
unsigned endx = startx + session.optical_pixels / ccd_pixels_per_system_pixel;
|
unsigned endx = startx + session.optical_pixels / ccd_pixels_per_system_pixel;
|
||||||
|
|
||||||
/* sensors are built from 600 dpi segments for LiDE 100/200
|
unsigned segment_count = sensor_profile.get_segment_count();
|
||||||
* and 1200 dpi for the 700F */
|
|
||||||
unsigned segment_count = 1;
|
|
||||||
if (dev->model->flags & GENESYS_FLAG_SIS_SENSOR) {
|
|
||||||
segment_count = dpihw / 600;
|
|
||||||
}
|
|
||||||
|
|
||||||
// compute pixel coordinate in the given dpihw space, taking segments into account
|
// compute pixel coordinate in the given dpihw space, taking segments into account
|
||||||
startx /= session.hwdpi_divisor * segment_count;
|
startx /= session.hwdpi_divisor * segment_count;
|
||||||
|
@ -726,7 +721,7 @@ static void gl846_init_optical_regs_scan(Genesys_Device* dev, const Genesys_Sens
|
||||||
|
|
||||||
/* in cas of multi-segments sensor, we have to add the witdh
|
/* in cas of multi-segments sensor, we have to add the witdh
|
||||||
* of the sensor crossed by the scan area */
|
* of the sensor crossed by the scan area */
|
||||||
if (dev->model->flags & GENESYS_FLAG_SIS_SENSOR && segment_count > 1) {
|
if (segment_count > 1) {
|
||||||
dev->deseg.conseq_pixel_dist_bytes = sensor_profile.segment_size;
|
dev->deseg.conseq_pixel_dist_bytes = sensor_profile.segment_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -729,10 +729,7 @@ static void gl847_init_optical_regs_scan(Genesys_Device* dev, const Genesys_Sens
|
||||||
|
|
||||||
/* sensors are built from 600 dpi segments for LiDE 100/200
|
/* sensors are built from 600 dpi segments for LiDE 100/200
|
||||||
* and 1200 dpi for the 700F */
|
* and 1200 dpi for the 700F */
|
||||||
unsigned segment_count = 1;
|
unsigned segment_count = sensor_profile.get_segment_count();
|
||||||
if (dev->model->flags & GENESYS_FLAG_SIS_SENSOR) {
|
|
||||||
segment_count = dpihw/600;
|
|
||||||
}
|
|
||||||
|
|
||||||
// compute pixel coordinate in the given dpihw space, taking segments into account
|
// compute pixel coordinate in the given dpihw space, taking segments into account
|
||||||
startx /= session.hwdpi_divisor * segment_count;
|
startx /= session.hwdpi_divisor * segment_count;
|
||||||
|
@ -743,7 +740,7 @@ static void gl847_init_optical_regs_scan(Genesys_Device* dev, const Genesys_Sens
|
||||||
|
|
||||||
/* in cas of multi-segments sensor, we have to add the witdh
|
/* in cas of multi-segments sensor, we have to add the witdh
|
||||||
* of the sensor crossed by the scan area */
|
* of the sensor crossed by the scan area */
|
||||||
if (dev->model->flags & GENESYS_FLAG_SIS_SENSOR && segment_count > 1) {
|
if (segment_count > 1) {
|
||||||
dev->deseg.conseq_pixel_dist_bytes = sensor_profile.segment_size;
|
dev->deseg.conseq_pixel_dist_bytes = sensor_profile.segment_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -166,9 +166,20 @@ struct SensorProfile
|
||||||
unsigned exposure_lperiod = 0;
|
unsigned exposure_lperiod = 0;
|
||||||
SensorExposure exposure;
|
SensorExposure exposure;
|
||||||
unsigned segment_size = 0; // only on GL846, GL847
|
unsigned segment_size = 0; // only on GL846, GL847
|
||||||
|
|
||||||
|
// the order of the segments, if any, for the profile. If the sensor is not segmented or uses
|
||||||
|
// only single segment, this array can be empty
|
||||||
std::vector<unsigned> segment_order;
|
std::vector<unsigned> segment_order;
|
||||||
|
|
||||||
GenesysRegisterSettingSet custom_regs;
|
GenesysRegisterSettingSet custom_regs;
|
||||||
|
|
||||||
|
unsigned get_segment_count() const
|
||||||
|
{
|
||||||
|
if (segment_order.size() < 2)
|
||||||
|
return 1;
|
||||||
|
return segment_order.size();
|
||||||
|
}
|
||||||
|
|
||||||
bool operator==(const SensorProfile& other) const
|
bool operator==(const SensorProfile& other) const
|
||||||
{
|
{
|
||||||
return dpi == other.dpi &&
|
return dpi == other.dpi &&
|
||||||
|
|
Ładowanie…
Reference in New Issue