sane.ds: Add support for ICAP_BITDEPTH.

This commit is contained in:
Jeremy White 2009-02-25 20:58:25 -06:00 committed by Alexandre Julliard
parent 8e4aff7a4d
commit 982482e7e8
2 changed files with 42 additions and 2 deletions

View File

@ -154,7 +154,7 @@ static TW_UINT16 TWAIN_GetSupportedCaps(pTW_CAPABILITY pCapability)
{
TW_ARRAY *a;
static const UINT16 supported_caps[] = { CAP_SUPPORTEDCAPS, CAP_XFERCOUNT, CAP_UICONTROLLABLE,
ICAP_XFERMECH, ICAP_PIXELTYPE, ICAP_COMPRESSION, ICAP_PIXELFLAVOR,
ICAP_XFERMECH, ICAP_PIXELTYPE, ICAP_BITDEPTH, ICAP_COMPRESSION, ICAP_PIXELFLAVOR,
ICAP_XRESOLUTION, ICAP_YRESOLUTION };
pCapability->hContainer = GlobalAlloc (0, FIELD_OFFSET( TW_ARRAY, ItemList[sizeof(supported_caps)] ));
@ -311,6 +311,40 @@ static TW_UINT16 SANE_ICAPPixelType (pTW_CAPABILITY pCapability, TW_UINT16 actio
return twCC;
}
/* ICAP_BITDEPTH */
static TW_UINT16 SANE_ICAPBitDepth(pTW_CAPABILITY pCapability, TW_UINT16 action)
{
TW_UINT16 twCC = TWCC_BADCAP;
#ifdef SONAME_LIBSANE
TW_UINT32 possible_values[1];
TRACE("ICAP_BITDEPTH\n");
possible_values[0] = activeDS.sane_param.depth;
switch (action)
{
case MSG_QUERYSUPPORT:
twCC = set_onevalue(pCapability, TWTY_INT32,
TWQC_GET | TWQC_GETDEFAULT | TWQC_GETCURRENT );
break;
case MSG_GET:
twCC = msg_get_enum(pCapability, possible_values, sizeof(possible_values) / sizeof(possible_values[0]),
TWTY_UINT16, activeDS.sane_param.depth, activeDS.sane_param.depth);
break;
case MSG_GETDEFAULT:
/* .. Fall through intentional .. */
case MSG_GETCURRENT:
twCC = set_onevalue(pCapability, TWTY_UINT16, activeDS.sane_param.depth);
break;
}
#endif
return twCC;
}
/* CAP_UICONTROLLABLE */
static TW_UINT16 SANE_CAPUiControllable(pTW_CAPABILITY pCapability, TW_UINT16 action)
{
@ -547,6 +581,10 @@ TW_UINT16 SANE_SaneCapability (pTW_CAPABILITY pCapability, TW_UINT16 action)
twCC = SANE_ICAPPixelType (pCapability, action);
break;
case ICAP_BITDEPTH:
twCC = SANE_ICAPBitDepth(pCapability, action);
break;
case ICAP_XFERMECH:
twCC = SANE_ICAPXferMech (pCapability, action);
break;

View File

@ -463,8 +463,10 @@ static void test_single_source(TW_IDENTITY *appid, TW_IDENTITY *source)
Sources that supply image information must support DG_CONTROL / DAT_CAPABILITY /
MSG_GET, MSG_GETCURRENT, MSG_GETDEFAULT, MSG_RESET and MSG_SET on:
*/
todo_wine
ok(capabilities[ICAP_BITDEPTH], "ICAP_BITDEPTH not supported\n");
if (capabilities[ICAP_BITDEPTH])
test_onevalue_cap(appid, source, ICAP_BITDEPTH, TWTY_UINT16,
TWQC_GET | TWQC_GETDEFAULT | TWQC_GETCURRENT );
todo_wine
ok(capabilities[ICAP_BITORDER], "ICAP_BITORDER not supported\n");
ok(capabilities[ICAP_PIXELTYPE], "ICAP_PIXELTYPE not supported\n");