genesys: Store available resolutions into proper array

merge-requests/103/head
Povilas Kanapickas 2019-07-20 09:16:35 +03:00
rodzic 341061f3df
commit bca1ab1d99
7 zmienionych plików z 114 dodań i 159 usunięć

Wyświetl plik

@ -5087,7 +5087,7 @@ static SANE_Status
init_options (Genesys_Scanner * s)
{
DBG_HELPER(dbg);
SANE_Int option, count, min_dpi;
SANE_Int option;
SANE_Status status = SANE_STATUS_GOOD;
SANE_Word *dpi_list;
Genesys_Model *model = s->dev->model;
@ -5170,20 +5170,15 @@ init_options (Genesys_Scanner * s)
DISABLE (OPT_BIT_DEPTH);
/* resolution */
min_dpi=200000;
for (count = 0; model->xdpi_values[count] != 0; count++)
{
if(model->xdpi_values[count]<min_dpi)
{
min_dpi=model->xdpi_values[count];
}
unsigned min_dpi = *std::min_element(model->xdpi_values.begin(), model->xdpi_values.end());
dpi_list = (SANE_Word*) malloc((model->xdpi_values.size() + 1) * sizeof(SANE_Word));
if (!dpi_list) {
return SANE_STATUS_NO_MEM;
}
dpi_list = (SANE_Word*) malloc((count + 1) * sizeof(SANE_Word));
if (!dpi_list)
return SANE_STATUS_NO_MEM;
dpi_list[0] = count;
for (count = 0; model->xdpi_values[count] != 0; count++)
dpi_list[count + 1] = model->xdpi_values[count];
dpi_list[0] = model->xdpi_values.size();
std::copy(model->xdpi_values.begin(), model->xdpi_values.end(), dpi_list + 1);
s->opt[OPT_RESOLUTION].name = SANE_NAME_SCAN_RESOLUTION;
s->opt[OPT_RESOLUTION].title = SANE_TITLE_SCAN_RESOLUTION;
s->opt[OPT_RESOLUTION].desc = SANE_DESC_SCAN_RESOLUTION;

Wyświetl plik

@ -2928,8 +2928,8 @@ void genesys_init_usb_device_tables()
GENESYS_GL646,
NULL,
{1200, 600, 300, 150, 75, 0}, /* possible x-resolutions */
{2400, 1200, 600, 300, 150, 75, 0}, /* possible y-resolutions */
{1200, 600, 300, 150, 75}, /* possible x-resolutions */
{2400, 1200, 600, 300, 150, 75}, /* possible y-resolutions */
{16, 8, 0}, /* possible depths in gray mode */
{16, 8, 0}, /* possible depths in color mode */
@ -2982,8 +2982,8 @@ void genesys_init_usb_device_tables()
GENESYS_GL841,
NULL,
{ 1200, 600, 400, 300, 240, 200, 150, 75, 0}, /* possible x-resolutions */
{2400, 1200, 600, 400, 300, 240, 200, 150, 75, 0}, /* possible y-resolutions */
{ 1200, 600, 400, 300, 240, 200, 150, 75}, /* possible x-resolutions */
{2400, 1200, 600, 400, 300, 240, 200, 150, 75}, /* possible y-resolutions */
{16, 8, 0}, /* possible depths in gray mode */
{16, 8, 0}, /* possible depths in color mode */
@ -3042,8 +3042,8 @@ void genesys_init_usb_device_tables()
GENESYS_GL843,
NULL,
{ 600, /* 500, 400,*/ 300, 200, 150, 100, 75, 0}, /* possible x-resolutions */
{ 1200, 600, /* 500, 400, */ 300, 200, 150, 100, 75, 0}, /* possible y-resolutions */
{ 600, /* 500, 400,*/ 300, 200, 150, 100, 75}, /* possible x-resolutions */
{ 1200, 600, /* 500, 400, */ 300, 200, 150, 100, 75}, /* possible y-resolutions */
{16, 8, 0}, /* possible depths in gray mode */
{16, 8, 0}, /* possible depths in color mode */
@ -3098,8 +3098,8 @@ void genesys_init_usb_device_tables()
GENESYS_GL843,
NULL,
{2400, 1200, 600, 400, 300, 200, 150, 100, 0},
{2400, 1200, 600, 400, 300, 200, 150, 100, 0},
{2400, 1200, 600, 400, 300, 200, 150, 100},
{2400, 1200, 600, 400, 300, 200, 150, 100},
{16, 8, 0}, /* possible depths in gray mode */
{16, 8, 0}, /* possible depths in color mode */
@ -3158,8 +3158,8 @@ void genesys_init_usb_device_tables()
GENESYS_GL843,
NULL,
{ 2400, 1200, 600, 400, 300, 200, 150, 100, 0},
{ 2400, 1200, 600, 400, 300, 200, 150, 100, 0},
{ 2400, 1200, 600, 400, 300, 200, 150, 100},
{ 2400, 1200, 600, 400, 300, 200, 150, 100},
{16, 8, 0}, /* possible depths in gray mode */
{16, 8, 0}, /* possible depths in color mode */
@ -3218,8 +3218,8 @@ void genesys_init_usb_device_tables()
GENESYS_GL843,
NULL,
{ 2400, 1200, 600, 400, 300, 200, 150, 100, 0},
{ 2400, 1200, 600, 400, 300, 200, 150, 100, 0},
{ 2400, 1200, 600, 400, 300, 200, 150, 100},
{ 2400, 1200, 600, 400, 300, 200, 150, 100},
{16, 8, 0}, /* possible depths in gray mode */
{16, 8, 0}, /* possible depths in color mode */
@ -3278,8 +3278,8 @@ void genesys_init_usb_device_tables()
GENESYS_GL843,
NULL,
{ 4800, 2400, 1200, 600, 400, 300, 200, 150, 100, 0},
{ 4800, 2400, 1200, 600, 400, 300, 200, 150, 100, 0},
{ 4800, 2400, 1200, 600, 400, 300, 200, 150, 100},
{ 4800, 2400, 1200, 600, 400, 300, 200, 150, 100},
{16, 8, 0}, /* possible depths in gray mode */
{16, 8, 0}, /* possible depths in color mode */
@ -3340,8 +3340,8 @@ void genesys_init_usb_device_tables()
GENESYS_GL843,
NULL,
{ 4800, 2400, 1200, 600, 400, 300, 200, 150, 100, 0},
{ 4800, 2400, 1200, 600, 400, 300, 200, 150, 100, 0},
{ 4800, 2400, 1200, 600, 400, 300, 200, 150, 100 },
{ 4800, 2400, 1200, 600, 400, 300, 200, 150, 100 },
{16, 8, 0}, /* possible depths in gray mode */
{16, 8, 0}, /* possible depths in color mode */
@ -3404,8 +3404,8 @@ void genesys_init_usb_device_tables()
GENESYS_GL843, // ASIC type
NULL,
{ 4800, 2400, 1200, 600, 400, 300, 0}, // TODO: resolutions for non-XPA mode
{ 4800, 2400, 1200, 600, 400, 300, 0}, // TODO: resolutions for non-XPA mode
{ 4800, 2400, 1200, 600, 400, 300 }, // TODO: resolutions for non-XPA mode
{ 4800, 2400, 1200, 600, 400, 300 }, // TODO: resolutions for non-XPA mode
{ 16, 8, 0 }, // possible depths in gray mode
{ 16, 8, 0 }, // possible depths in color mode
@ -3466,8 +3466,8 @@ void genesys_init_usb_device_tables()
GENESYS_GL847,
NULL,
{4800, 2400, 1200, 600, 300, 200, 150, 100, 75, 0}, /* possible x-resolutions */
{4800, 2400, 1200, 600, 300, 200, 150, 100, 75, 0}, /* possible y-resolutions */
{4800, 2400, 1200, 600, 300, 200, 150, 100, 75 }, /* possible x-resolutions */
{4800, 2400, 1200, 600, 300, 200, 150, 100, 75 }, /* possible y-resolutions */
{16, 8, 0}, /* possible depths in gray mode */
{16, 8, 0}, /* possible depths in color mode */
@ -3525,8 +3525,8 @@ void genesys_init_usb_device_tables()
GENESYS_GL124,
NULL,
{4800, 2400, 1200, 600, /* 400,*/ 300, 150, 100, 75, 0}, /* possible x-resolutions */
{4800, 2400, 1200, 600, /* 400,*/ 300, 150, 100, 75, 0}, /* possible y-resolutions */
{4800, 2400, 1200, 600, /* 400,*/ 300, 150, 100, 75 }, /* possible x-resolutions */
{4800, 2400, 1200, 600, /* 400,*/ 300, 150, 100, 75 }, /* possible y-resolutions */
{16, 8, 0}, /* possible depths in gray mode */
{16, 8, 0}, /* possible depths in color mode */
@ -3582,8 +3582,8 @@ void genesys_init_usb_device_tables()
GENESYS_GL124,
NULL,
{4800, 2400, 1200, 600, 300, 150, 100, 75, 0}, /* possible x-resolutions */
{4800, 2400, 1200, 600, 300, 150, 100, 75, 0}, /* possible y-resolutions */
{4800, 2400, 1200, 600, 300, 150, 100, 75 }, /* possible x-resolutions */
{4800, 2400, 1200, 600, 300, 150, 100, 75 }, /* possible y-resolutions */
{16, 8, 0}, /* possible depths in gray mode */
{16, 8, 0}, /* possible depths in color mode */
@ -3639,8 +3639,8 @@ void genesys_init_usb_device_tables()
GENESYS_GL124,
NULL,
{4800, 2400, 1200, 600, /* 400,*/ 300, 150, 100, 75, 0}, /* possible x-resolutions */
{4800, 2400, 1200, 600, /* 400,*/ 300, 150, 100, 75, 0}, /* possible y-resolutions */
{4800, 2400, 1200, 600, /* 400,*/ 300, 150, 100, 75 }, /* possible x-resolutions */
{4800, 2400, 1200, 600, /* 400,*/ 300, 150, 100, 75 }, /* possible y-resolutions */
{16, 8, 0}, /* possible depths in gray mode */
{16, 8, 0}, /* possible depths in color mode */
@ -3696,8 +3696,8 @@ void genesys_init_usb_device_tables()
GENESYS_GL124, /* or a compatible one */
NULL,
{4800, 2400, 1200, 600, 300, 150, 100, 75, 0}, /* possible x-resolutions */
{4800, 2400, 1200, 600, 300, 150, 100, 75, 0}, /* possible y-resolutions */
{4800, 2400, 1200, 600, 300, 150, 100, 75}, /* possible x-resolutions */
{4800, 2400, 1200, 600, 300, 150, 100, 75}, /* possible y-resolutions */
{16, 8, 0}, /* possible depths in gray mode */
{16, 8, 0}, /* possible depths in color mode */
@ -3753,8 +3753,8 @@ void genesys_init_usb_device_tables()
GENESYS_GL847,
NULL,
{1200, 600, 400, 300, 200, 150, 100, 75, 0}, /* possible x-resolutions */
{1200, 600, 400, 300, 200, 150, 100, 75, 0}, /* possible y-resolutions */
{1200, 600, 400, 300, 200, 150, 100, 75}, /* possible x-resolutions */
{1200, 600, 400, 300, 200, 150, 100, 75}, /* possible y-resolutions */
{16, 8, 0}, /* possible depths in gray mode */
{16, 8, 0}, /* possible depths in color mode */
@ -3811,8 +3811,8 @@ void genesys_init_usb_device_tables()
GENESYS_GL847,
NULL,
{4800, 2400, 1200, 600, 300, 200, 150, 100, 75, 0}, /* possible x-resolutions */
{4800, 2400, 1200, 600, 300, 200, 150, 100, 75, 0}, /* possible y-resolutions */
{4800, 2400, 1200, 600, 300, 200, 150, 100, 75}, /* possible x-resolutions */
{4800, 2400, 1200, 600, 300, 200, 150, 100, 75}, /* possible y-resolutions */
{16, 8, 0}, /* possible depths in gray mode */
{16, 8, 0}, /* possible depths in color mode */
@ -3869,8 +3869,8 @@ void genesys_init_usb_device_tables()
GENESYS_GL847,
NULL,
{4800, 2400, 1200, 600, 300, 200, 150, 100, 75, 0}, /* possible x-resolutions */
{4800, 2400, 1200, 600, 300, 200, 150, 100, 75, 0}, /* possible y-resolutions */
{4800, 2400, 1200, 600, 300, 200, 150, 100, 75}, /* possible x-resolutions */
{4800, 2400, 1200, 600, 300, 200, 150, 100, 75}, /* possible y-resolutions */
{16, 8, 0}, /* possible depths in gray mode */
{16, 8, 0}, /* possible depths in color mode */
@ -3927,8 +3927,8 @@ void genesys_init_usb_device_tables()
GENESYS_GL841,
NULL,
{1200, 600, 300, 150, 75, 0}, /* possible x-resolutions */
{2400, 1200, 600, 300, 150, 75, 0}, /* possible y-resolutions */
{1200, 600, 300, 150, 75}, /* possible x-resolutions */
{2400, 1200, 600, 300, 150, 75}, /* possible y-resolutions */
{16, 8, 0}, /* possible depths in gray mode */
{16, 8, 0}, /* possible depths in color mode */
@ -3989,8 +3989,8 @@ void genesys_init_usb_device_tables()
GENESYS_GL841,
NULL,
{ 1200, 600, 400, 300, 240, 150, 100, 75, 0}, /* possible x-resolutions */
{2400, 1200, 600, 400, 300, 240, 150, 100, 75, 0}, /* possible y-resolutions */
{ 1200, 600, 400, 300, 240, 150, 100, 75}, /* possible x-resolutions */
{2400, 1200, 600, 400, 300, 240, 150, 100, 75}, /* possible y-resolutions */
{16, 8, 0}, /* possible depths in gray mode */
{16, 8, 0}, /* possible depths in color mode */
SANE_FIX (0.42), /* Start of scan area in mm (x) 0.42 */
@ -4048,8 +4048,8 @@ void genesys_init_usb_device_tables()
GENESYS_GL646,
NULL,
{600, 300, 150, 75, 0}, /* possible x-resolutions */
{1200, 600, 300, 150, 75, 0}, /* possible y-resolutions, motor can go up to 1200 dpi */
{600, 300, 150, 75}, /* possible x-resolutions */
{1200, 600, 300, 150, 75}, /* possible y-resolutions, motor can go up to 1200 dpi */
{16, 8, 0}, /* possible depths in gray mode */
{16, 8, 0}, /* possible depths in color mode */
@ -4107,8 +4107,8 @@ void genesys_init_usb_device_tables()
GENESYS_GL646,
NULL,
{1200, 600, 300, 150, 100, 50, 0}, /* possible x-resolutions */
{1200, 600, 300, 150, 100, 50, 0}, /* possible y-resolutions */
{1200, 600, 300, 150, 100, 50}, /* possible x-resolutions */
{1200, 600, 300, 150, 100, 50}, /* possible y-resolutions */
{16, 8, 0}, /* possible depths in gray mode */
{16, 8, 0}, /* possible depths in color mode */
@ -4166,8 +4166,8 @@ void genesys_init_usb_device_tables()
GENESYS_GL646,
NULL,
{600, 300, 200, 100, 75, 0}, /* possible x-resolutions */
{600, 300, 200, 100, 75, 0}, /* possible y-resolutions */
{600, 300, 200, 100, 75 }, /* possible x-resolutions */
{600, 300, 200, 100, 75 }, /* possible y-resolutions */
{16, 8, 0}, /* possible depths in gray mode */
{16, 8, 0}, /* possible depths in color mode */
@ -4224,8 +4224,8 @@ void genesys_init_usb_device_tables()
GENESYS_GL646,
NULL,
{1200, 600, 300, 150, 100, 75, 0}, /* possible x-resolutions */
{1200, 600, 300, 150, 100, 75, 0}, /* possible y-resolutions */
{1200, 600, 300, 150, 100, 75}, /* possible x-resolutions */
{1200, 600, 300, 150, 100, 75}, /* possible y-resolutions */
{16, 8, 0}, /* possible depths in gray mode */
{16, 8, 0}, /* possible depths in color mode */
@ -4283,8 +4283,8 @@ void genesys_init_usb_device_tables()
GENESYS_GL646,
NULL,
{600, 300, 150, 75, 0}, /* possible x-resolutions */
{1200, 600, 300, 150, 75, 0}, /* possible y-resolutions */
{600, 300, 150, 75}, /* possible x-resolutions */
{1200, 600, 300, 150, 75}, /* possible y-resolutions */
{16, 8, 0}, /* possible depths in gray mode */
{16, 8, 0}, /* possible depths in color mode */
@ -4335,8 +4335,8 @@ void genesys_init_usb_device_tables()
GENESYS_GL646,
NULL,
{1200, 600, 300, 150, 75, 0}, /* possible x-resolutions */
{2400, 1200, 600, 300, 150, 75, 0}, /* possible y-resolutions */
{1200, 600, 300, 150, 75}, /* possible x-resolutions */
{2400, 1200, 600, 300, 150, 75}, /* possible y-resolutions */
{16, 8, 0}, /* possible depths in gray mode */
{16, 8, 0}, /* possible depths in color mode */
@ -4392,8 +4392,8 @@ void genesys_init_usb_device_tables()
GENESYS_GL646,
NULL,
{1200, 600, 400, 300, 200, 150, 100, 75, 50, 0}, /* possible x-resolutions */
{2400, 1200, 600, 400, 300, 200, 150, 100, 75, 50, 0}, /* possible y-resolutions */
{1200, 600, 400, 300, 200, 150, 100, 75, 50}, /* possible x-resolutions */
{2400, 1200, 600, 400, 300, 200, 150, 100, 75, 50}, /* possible y-resolutions */
{16, 8, 0}, /* possible depths in gray mode */
{16, 8, 0}, /* possible depths in color mode */
@ -4450,8 +4450,8 @@ void genesys_init_usb_device_tables()
GENESYS_GL841,
NULL,
{600, 300, 150, 75, 0}, /* possible x-resolutions */
{600, 300, 150, 75, 0}, /* possible y-resolutions */
{600, 300, 150, 75}, /* possible x-resolutions */
{600, 300, 150, 75}, /* possible y-resolutions */
{16, 8, 0}, /* possible depths in gray mode */
{16, 8, 0}, /* possible depths in color mode */
@ -4507,8 +4507,8 @@ void genesys_init_usb_device_tables()
GENESYS_GL841,
NULL,
{600, 300, 150, 75, 0}, /* possible x-resolutions */
{1200, 600, 300, 150, 75, 0}, /* possible y-resolutions */
{600, 300, 150, 75}, /* possible x-resolutions */
{1200, 600, 300, 150, 75}, /* possible y-resolutions */
{16, 8, 0}, /* possible depths in gray mode */
{16, 8, 0}, /* possible depths in color mode */
@ -4563,8 +4563,8 @@ void genesys_init_usb_device_tables()
GENESYS_GL841,
NULL,
{600, 300, 150, 75, 0}, /* possible x-resolutions */
{1200, 600, 300, 150, 75, 0}, /* possible y-resolutions */
{600, 300, 150, 75}, /* possible x-resolutions */
{1200, 600, 300, 150, 75}, /* possible y-resolutions */
{16, 8, 0}, /* possible depths in gray mode */
{16, 8, 0}, /* possible depths in color mode */
@ -4619,8 +4619,8 @@ void genesys_init_usb_device_tables()
GENESYS_GL841,
NULL,
{600, 300, 150, 75, 0}, /* possible x-resolutions */
{1200, 600, 300, 150, 75, 0}, /* possible y-resolutions */
{600, 300, 150, 75}, /* possible x-resolutions */
{1200, 600, 300, 150, 75}, /* possible y-resolutions */
{16, 8, 0}, /* possible depths in gray mode */
{16, 8, 0}, /* possible depths in color mode */
@ -4676,8 +4676,8 @@ void genesys_init_usb_device_tables()
GENESYS_GL841,
NULL,
{600, 300, 150, 75, 0}, /* possible x-resolutions */
{1200, 600, 300, 150, 75, 0}, /* possible y-resolutions */
{600, 300, 150, 75}, /* possible x-resolutions */
{1200, 600, 300, 150, 75}, /* possible y-resolutions */
{16, 8, 0}, /* possible depths in gray mode */
{16, 8, 0}, /* possible depths in color mode */
@ -4732,8 +4732,8 @@ void genesys_init_usb_device_tables()
GENESYS_GL841,
NULL,
{600, 300, 150, 75, 0}, /* possible x-resolutions */
{1200, 600, 300, 150, 75, 0}, /* possible y-resolutions */
{600, 300, 150, 75}, /* possible x-resolutions */
{1200, 600, 300, 150, 75}, /* possible y-resolutions */
{16, 8, 0}, /* possible depths in gray mode */
{16, 8, 0}, /* possible depths in color mode */
@ -4790,8 +4790,8 @@ void genesys_init_usb_device_tables()
GENESYS_GL841,
NULL,
{600, 300, 150, 75, 0}, /* possible x-resolutions */
{1200, 600, 300, 150, 75, 0}, /* possible y-resolutions */
{600, 300, 150, 75}, /* possible x-resolutions */
{1200, 600, 300, 150, 75}, /* possible y-resolutions */
{16, 8, 0}, /* possible depths in gray mode */
{16, 8, 0}, /* possible depths in color mode */
@ -4846,8 +4846,8 @@ void genesys_init_usb_device_tables()
GENESYS_GL841,
NULL,
{600, 300, 150, 75, 0}, /* possible x-resolutions */
{600, 300, 150, 75, 0}, /* possible y-resolutions */
{600, 300, 150, 75}, /* possible x-resolutions */
{600, 300, 150, 75}, /* possible y-resolutions */
{16, 8, 0}, /* possible depths in gray mode */
{16, 8, 0}, /* possible depths in color mode */
@ -4905,8 +4905,8 @@ void genesys_init_usb_device_tables()
GENESYS_GL841,
NULL,
{600, 300, 150, 75, 0}, /* possible x-resolutions */
{600, 300, 150, 75, 0}, /* possible y-resolutions */
{600, 300, 150, 75}, /* possible x-resolutions */
{600, 300, 150, 75}, /* possible y-resolutions */
{16, 8, 0}, /* possible depths in gray mode */
{16, 8, 0}, /* possible depths in color mode */
@ -4963,8 +4963,8 @@ void genesys_init_usb_device_tables()
GENESYS_GL841,
NULL,
{600, 300, 150, 75, 0}, /* possible x-resolutions */
{600, 300, 150, 75, 0}, /* possible y-resolutions */
{600, 300, 150, 75}, /* possible x-resolutions */
{600, 300, 150, 75}, /* possible y-resolutions */
{16, 8, 0}, /* possible depths in gray mode */
{16, 8, 0}, /* possible depths in color mode */
@ -5022,8 +5022,8 @@ void genesys_init_usb_device_tables()
GENESYS_GL646,
NULL,
{1200, 600, 400, 300, 200, 150, 100, 75, 50, 0}, /* possible x-resolutions */
{2400, 1200, 600, 400, 300, 200, 150, 100, 75, 50, 0}, /* possible y-resolutions */
{1200, 600, 400, 300, 200, 150, 100, 75, 50}, /* possible x-resolutions */
{2400, 1200, 600, 400, 300, 200, 150, 100, 75, 50}, /* possible y-resolutions */
{16, 8, 0}, /* possible depths in gray mode */
{16, 8, 0}, /* possible depths in color mode */
@ -5081,8 +5081,8 @@ void genesys_init_usb_device_tables()
GENESYS_GL646,
NULL,
{1200, 600, 400, 300, 200, 150, 100, 75, 50, 0}, /* possible x-resolutions */
{2400, 1200, 600, 400, 300, 200, 150, 100, 75, 50, 0}, /* possible y-resolutions */
{1200, 600, 400, 300, 200, 150, 100, 75, 50}, /* possible x-resolutions */
{2400, 1200, 600, 400, 300, 200, 150, 100, 75, 50}, /* possible y-resolutions */
{16, 8, 0}, /* possible depths in gray mode */
{16, 8, 0}, /* possible depths in color mode */
@ -5140,8 +5140,8 @@ void genesys_init_usb_device_tables()
GENESYS_GL841,
NULL,
{600, 300, 150, 75, 0}, /* possible x-resolutions */
{1200, 600, 300, 150, 75, 0}, /* possible y-resolutions */
{600, 300, 150, 75}, /* possible x-resolutions */
{1200, 600, 300, 150, 75}, /* possible y-resolutions */
{16, 8, 0}, /* possible depths in gray mode */
{16, 8, 0}, /* possible depths in color mode */
@ -5196,8 +5196,8 @@ void genesys_init_usb_device_tables()
MODEL_PLUSTEK_OPTICPRO_3600,
GENESYS_GL841,
NULL,
{/*1200,*/ 600, 400, 300, 200, 150, 100, 75, 0}, /* possible x-resolutions */
{/*2400,*/ 1200, 600, 400, 300, 200, 150, 100, 75, 0}, /* possible y-resolutions */
{/*1200,*/ 600, 400, 300, 200, 150, 100, 75}, /* possible x-resolutions */
{/*2400,*/ 1200, 600, 400, 300, 200, 150, 100, 75}, /* possible y-resolutions */
{16, 8, 0}, /* possible depths in gray mode */
{16, 8, 0}, /* possible depths in color mode */
@ -5255,8 +5255,8 @@ void genesys_init_usb_device_tables()
GENESYS_GL847,
NULL,
{ 2400, 1200, 600, 400, 300, 200, 150, 100, 75, 0},
{ 2400, 1200, 600, 400, 300, 200, 150, 100, 75, 0},
{ 2400, 1200, 600, 400, 300, 200, 150, 100, 75},
{ 2400, 1200, 600, 400, 300, 200, 150, 100, 75},
{16, 8, 0}, /* possible depths in gray mode */
{16, 8, 0}, /* possible depths in color mode */
@ -5317,8 +5317,8 @@ void genesys_init_usb_device_tables()
GENESYS_GL845,
NULL,
{1200, 600, 300, 150, 100, 75, 0}, /* possible x-resolutions */
{1200, 600, 300, 150, 100, 75, 0}, /* possible y-resolutions */
{1200, 600, 300, 150, 100, 75}, /* possible x-resolutions */
{1200, 600, 300, 150, 100, 75}, /* possible y-resolutions */
{16, 8, 0}, /* possible depths in gray mode */
{16, 8, 0}, /* possible depths in color mode */
@ -5373,8 +5373,8 @@ void genesys_init_usb_device_tables()
GENESYS_GL846,
NULL,
{1200, 600, 300, 150, 100, 75, 0}, /* possible x-resolutions */
{1200, 600, 300, 150, 100, 75, 0}, /* possible y-resolutions */
{1200, 600, 300, 150, 100, 75}, /* possible x-resolutions */
{1200, 600, 300, 150, 100, 75}, /* possible y-resolutions */
{16, 8, 0}, /* possible depths in gray mode */
{16, 8, 0}, /* possible depths in color mode */

Wyświetl plik

@ -4670,7 +4670,7 @@ gl841_search_strip(Genesys_Device * dev, const Genesys_Sensor& sensor,
SANE_Status status = SANE_STATUS_GOOD;
Genesys_Register_Set local_reg;
size_t size;
int steps, depth, dpi;
int steps, depth;
unsigned int pass, count, found, x, y, length;
char title[80];
GenesysRegister *r;
@ -4694,13 +4694,9 @@ gl841_search_strip(Genesys_Device * dev, const Genesys_Sensor& sensor,
return status;
}
/* set up for a gray scan at lowest dpi */
dpi = 9600;
for (x = 0; x < MAX_RESOLUTIONS; x++)
{
if (dev->model->xdpi_values[x] > 0 && dev->model->xdpi_values[x] < dpi)
dpi = dev->model->xdpi_values[x];
}
// set up for a gray scan at lowest dpi
unsigned dpi = *std::min_element(dev->model->xdpi_values.begin(),
dev->model->xdpi_values.end());
channels = 1;
/* shading calibation is done with dev->motor.base_ydpi */

Wyświetl plik

@ -2548,7 +2548,7 @@ gl846_search_strip(Genesys_Device * dev, const Genesys_Sensor& sensor,
SANE_Status status = SANE_STATUS_GOOD;
Genesys_Register_Set local_reg;
size_t size;
int steps, depth, dpi;
int steps, depth;
unsigned int pass, count, found, x, y;
char title[80];
GenesysRegister *r;
@ -2562,13 +2562,9 @@ gl846_search_strip(Genesys_Device * dev, const Genesys_Sensor& sensor,
return status;
}
/* set up for a gray scan at lowest dpi */
dpi = 9600;
for (x = 0; x < MAX_RESOLUTIONS; x++)
{
if (dev->model->xdpi_values[x] > 0 && dev->model->xdpi_values[x] < dpi)
dpi = dev->model->xdpi_values[x];
}
// set up for a gray scan at lowest dpi
unsigned dpi = *std::min_element(dev->model->xdpi_values.begin(),
dev->model->xdpi_values.end());
channels = 1;
/* 10 MM */
/* lines = (10 * dpi) / MM_PER_INCH; */

Wyświetl plik

@ -2642,7 +2642,7 @@ gl847_search_strip (Genesys_Device * dev, const Genesys_Sensor& sensor,
SANE_Status status = SANE_STATUS_GOOD;
Genesys_Register_Set local_reg;
size_t size;
int steps, depth, dpi;
int steps, depth;
unsigned int pass, count, found, x, y;
char title[80];
GenesysRegister *r;
@ -2655,13 +2655,9 @@ gl847_search_strip (Genesys_Device * dev, const Genesys_Sensor& sensor,
return status;
}
/* set up for a gray scan at lowest dpi */
dpi = 9600;
for (x = 0; x < MAX_RESOLUTIONS; x++)
{
if (dev->model->xdpi_values[x] > 0 && dev->model->xdpi_values[x] < dpi)
dpi = dev->model->xdpi_values[x];
}
// set up for a gray scan at lowest dpi
unsigned dpi = *std::min_element(dev->model->xdpi_values.begin(),
dev->model->xdpi_values.end());
channels = 1;
/* 10 MM */
/* lines = (10 * dpi) / MM_PER_INCH; */

Wyświetl plik

@ -1566,18 +1566,7 @@ Motor_Profile *profile;
*/
int sanei_genesys_get_lowest_ydpi(Genesys_Device *dev)
{
int min=20000;
int i=0;
while(dev->model->ydpi_values[i]!=0)
{
if(dev->model->ydpi_values[i]<min)
{
min=dev->model->ydpi_values[i];
}
i++;
}
return min;
return *std::min_element(dev->model->ydpi_values.begin(), dev->model->ydpi_values.end());
}
/** @brief returns the lowest possible dpi for the device
@ -1587,27 +1576,10 @@ int sanei_genesys_get_lowest_ydpi(Genesys_Device *dev)
*/
int sanei_genesys_get_lowest_dpi(Genesys_Device *dev)
{
int min=20000;
int i=0;
while(dev->model->ydpi_values[i]!=0)
{
if(dev->model->ydpi_values[i]<min)
{
min=dev->model->ydpi_values[i];
}
i++;
}
i=0;
while(dev->model->xdpi_values[i]!=0)
{
if(dev->model->xdpi_values[i]<min)
{
min=dev->model->xdpi_values[i];
}
i++;
}
return min;
return std::min(*std::min_element(dev->model->xdpi_values.begin(),
dev->model->xdpi_values.end()),
*std::min_element(dev->model->ydpi_values.begin(),
dev->model->ydpi_values.end()));
}
/** @brief check is a cache entry may be used

Wyświetl plik

@ -1169,9 +1169,9 @@ struct Genesys_Model
Genesys_Command_Set* cmd_set = nullptr;
// possible x resolutions
SANE_Int xdpi_values[MAX_RESOLUTIONS] = {};
std::vector<unsigned> xdpi_values;
// possible y resolutions
SANE_Int ydpi_values[MAX_RESOLUTIONS] = {};
std::vector<unsigned> ydpi_values;
// possible depths in gray mode
SANE_Int bpp_gray_values[MAX_DPI] = {};