Merge branch 'genesys-override-dpi' into 'master'

genesys: Add a way to override logical dpi and physical pixel counts

See merge request sane-project/backends!187
merge-requests/189/head
Povilas Kanapickas 2019-09-28 18:19:58 +00:00
commit 7b66a8f732
3 zmienionych plików z 16 dodań i 3 usunięć

Wyświetl plik

@ -1336,6 +1336,9 @@ void compute_session_pixel_offsets(const Genesys_Device* dev, ScanSession& s,
s.pixel_endx = 0;
}
}
s.pixel_startx *= sensor.pixel_count_multiplier;
s.pixel_endx *= sensor.pixel_count_multiplier;
}
void compute_session(Genesys_Device* dev, ScanSession& s, const Genesys_Sensor& sensor)
@ -1858,8 +1861,8 @@ void sanei_genesys_set_dpihw(Genesys_Register_Set& regs, const Genesys_Sensor& s
const uint8_t REG05_DPIHW_2400 = 0x80;
const uint8_t REG05_DPIHW_4800 = 0xc0;
if (sensor.dpihw_override != 0) {
dpihw = sensor.dpihw_override;
if (sensor.register_dpihw_override != 0) {
dpihw = sensor.register_dpihw_override;
}
uint8_t dpihw_setting;

Wyświetl plik

@ -277,7 +277,11 @@ struct Genesys_Sensor {
// The scanner may be setup to use a custom dpihw that does not correspond to any actual
// resolution. The value zero does not set the override.
unsigned dpihw_override = 0;
unsigned register_dpihw_override = 0;
// The scanner may be setup to use a custom logical dpihw that does not correspond to any actual
// resolution. The value zero does not set the override.
unsigned logical_dpihw_override = 0;
// The scanner may be setup to use a custom dpiset value that does not correspond to any actual
// resolution. The value zero does not set the override.
@ -286,6 +290,9 @@ struct Genesys_Sensor {
// CCD may present itself as half or quarter-size CCD on certain resolutions
int ccd_size_divisor = 1;
// Some scanners need an additional multiplier over the scan coordinates
int pixel_count_multiplier = 1;
int black_pixels = 0;
// value of the dummy register
int dummy_pixel = 0;

Wyświetl plik

@ -47,6 +47,9 @@
inline unsigned default_get_logical_hwdpi(const Genesys_Sensor& sensor, unsigned xres)
{
if (sensor.logical_dpihw_override)
return sensor.logical_dpihw_override;
// can't be below 600 dpi
if (xres <= 600) {
return 600;