kopia lustrzana https://gitlab.com/sane-project/backends
Added option invert-endianess to test 16 bit modes.
Henning Meier-Geinitz <henning@meier-geinitz.de>DEVEL_2_0_BRANCH-1
rodzic
df8b2a8460
commit
2c16e3308b
|
@ -57,6 +57,9 @@ init_picture_buffer (Test_Device * test_device, SANE_Byte ** buffer,
|
|||
SANE_Byte *b;
|
||||
SANE_Bool is_little_endian = little_endian ();
|
||||
|
||||
if (test_device->val[opt_invert_endianess].w)
|
||||
is_little_endian ^= 1;
|
||||
|
||||
DBG (2, "(child) init_picture_buffer test_device=%p, buffer=%p, "
|
||||
"buffer_size=%p\n", test_device, buffer, buffer_size);
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
This backend is for testing frontends.
|
||||
*/
|
||||
|
||||
#define BUILD 16
|
||||
#define BUILD 17
|
||||
|
||||
#include "../include/sane/config.h"
|
||||
|
||||
|
@ -194,6 +194,7 @@ static SANE_Bool init_hand_scanner = SANE_FALSE;
|
|||
static SANE_Bool init_three_pass = SANE_FALSE;
|
||||
static SANE_String init_three_pass_order = "RGB";
|
||||
static SANE_String init_test_picture = "Solid black";
|
||||
static SANE_Bool init_invert_endianess = SANE_FALSE;
|
||||
static SANE_Bool init_read_limit = SANE_FALSE;
|
||||
static SANE_Word init_read_limit_size = 1;
|
||||
static SANE_Bool init_read_delay = SANE_FALSE;
|
||||
|
@ -427,6 +428,23 @@ init_options (Test_Device * test_device)
|
|||
return SANE_STATUS_NO_MEM;
|
||||
strcpy (test_device->val[opt_test_picture].s, init_test_picture);
|
||||
|
||||
/* opt_invert_endianess */
|
||||
od = &test_device->opt[opt_invert_endianess];
|
||||
od->name = "invert-endianess";
|
||||
od->title = SANE_I18N ("Invert endianess");
|
||||
od->desc = SANE_I18N ("Exchange upper and lower byte of image data in 16 "
|
||||
"bit modes. This option can be used to test the 16 "
|
||||
"bit modes of frontends, e.g. if the frontend uses "
|
||||
"the correct endianess.");
|
||||
od->type = SANE_TYPE_BOOL;
|
||||
od->unit = SANE_UNIT_NONE;
|
||||
od->size = sizeof (SANE_Word);
|
||||
od->cap = SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT;
|
||||
od->cap |= SANE_CAP_INACTIVE;
|
||||
od->constraint_type = SANE_CONSTRAINT_NONE;
|
||||
od->constraint.range = 0;
|
||||
test_device->val[opt_invert_endianess].w = init_invert_endianess;
|
||||
|
||||
/* opt_read_limit */
|
||||
od = &test_device->opt[opt_read_limit];
|
||||
od->name = "read-limit";
|
||||
|
@ -1433,6 +1451,9 @@ sane_init (SANE_Int * version_code, SANE_Auth_Callback authorize)
|
|||
if (read_option (line, "test-picture", param_string,
|
||||
&init_test_picture) == SANE_STATUS_GOOD)
|
||||
continue;
|
||||
if (read_option (line, "invert-endianess", param_bool,
|
||||
&init_invert_endianess) == SANE_STATUS_GOOD)
|
||||
continue;
|
||||
if (read_option (line, "read-limit", param_bool,
|
||||
&init_read_limit) == SANE_STATUS_GOOD)
|
||||
continue;
|
||||
|
@ -1869,7 +1890,8 @@ sane_control_option (SANE_Handle handle, SANE_Int option, SANE_Action action,
|
|||
option, test_device->opt[option].name,
|
||||
*(SANE_Bool *) value == SANE_TRUE ? "true" : "false");
|
||||
break;
|
||||
case opt_non_blocking: /* Bool */
|
||||
case opt_invert_endianess: /* Bool */
|
||||
case opt_non_blocking:
|
||||
case opt_select_fd:
|
||||
case opt_bool_soft_select_soft_detect:
|
||||
case opt_bool_soft_select_soft_detect_auto:
|
||||
|
@ -1885,7 +1907,7 @@ sane_control_option (SANE_Handle handle, SANE_Int option, SANE_Action action,
|
|||
option, test_device->opt[option].name,
|
||||
*(SANE_Bool *) value == SANE_TRUE ? "true" : "false");
|
||||
break;
|
||||
case opt_depth: /* Word list with parameter reloading */
|
||||
case opt_depth: /* Word list with parameter and options reloading */
|
||||
if (test_device->val[option].w == *(SANE_Int *) value)
|
||||
{
|
||||
DBG (4, "sane_control_option: option %d (%s) not changed\n",
|
||||
|
@ -1893,11 +1915,17 @@ sane_control_option (SANE_Handle handle, SANE_Int option, SANE_Action action,
|
|||
break;
|
||||
}
|
||||
test_device->val[option].w = *(SANE_Int *) value;
|
||||
if (test_device->val[option].w == 16)
|
||||
test_device->opt[opt_invert_endianess].cap &= ~ SANE_CAP_INACTIVE;
|
||||
else
|
||||
test_device->opt[opt_invert_endianess].cap |= SANE_CAP_INACTIVE;
|
||||
|
||||
myinfo |= SANE_INFO_RELOAD_PARAMS;
|
||||
myinfo |= SANE_INFO_RELOAD_OPTIONS;
|
||||
DBG (4, "sane_control_option: set option %d (%s) to %d\n",
|
||||
option, test_device->opt[option].name, *(SANE_Int *) value);
|
||||
break;
|
||||
case opt_three_pass_order: /* String list with parameter reloading */
|
||||
case opt_three_pass_order: /* String list with parameter reload */
|
||||
if (strcmp (test_device->val[option].s, value) == 0)
|
||||
{
|
||||
DBG (4, "sane_control_option: option %d (%s) not changed\n",
|
||||
|
@ -2122,6 +2150,7 @@ sane_control_option (SANE_Handle handle, SANE_Int option, SANE_Action action,
|
|||
}
|
||||
case opt_hand_scanner: /* Bool options */
|
||||
case opt_three_pass:
|
||||
case opt_invert_endianess:
|
||||
case opt_read_limit:
|
||||
case opt_read_delay:
|
||||
case opt_fuzzy_parameters:
|
||||
|
|
|
@ -31,6 +31,9 @@ resolution 50.0
|
|||
# Draw test picture ("Solid black", "Solid white", "Color pattern", "Grid")
|
||||
test-picture "Solid black"
|
||||
|
||||
# Invert upper and lower byte in 16 bit modes
|
||||
invert-endianess false
|
||||
|
||||
# Read-limit (true, false)
|
||||
read-limit false
|
||||
|
||||
|
|
|
@ -25,7 +25,8 @@ typedef enum
|
|||
opt_resolution,
|
||||
opt_special_group,
|
||||
opt_test_picture,
|
||||
opt_read_limit, /* 10 */
|
||||
opt_invert_endianess,
|
||||
opt_read_limit,
|
||||
opt_read_limit_size,
|
||||
opt_read_delay,
|
||||
opt_read_delay_duration,
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
;
|
||||
|
||||
:backend "test" ; name of backend
|
||||
:version "1.0-16" ; version of backend
|
||||
:version "1.0-17" ; version of backend
|
||||
:status :stable ; :alpha, :beta, :stable, :new
|
||||
:manpage "sane-test" ; name of manpage (if it exists)
|
||||
:url "http://www.meier-geinitz.de/sane/test-backend/" ; backend's web page
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
.TH sane-test 5 "9 Jun 2002"
|
||||
.TH sane-test 5 "24 Jul 2002"
|
||||
.IX sane-test
|
||||
.SH NAME
|
||||
sane-test - SANE backend for testing frontends
|
||||
|
@ -70,6 +70,12 @@ same in every mode and resolution. A table of all the test pictures can be
|
|||
found at: http://www.meier-geinitz.de/sane/test-backend/test-pictures.html.
|
||||
.PP
|
||||
If option
|
||||
.B invert-endianess
|
||||
is set, the upper and lower bytes of image data in 16 bit modes are exchanged.
|
||||
This option can be used to test the 16 bit modes of frontends, e.g. if the
|
||||
frontend uses the correct endianess.
|
||||
.PP
|
||||
If option
|
||||
.B read-limit
|
||||
is set, the maximum amount of data tranferred with each call to sane_read() is
|
||||
limited.
|
||||
|
|
Ładowanie…
Reference in New Issue