Jeremy White : sane.ds: Add support for ICAP_BITDEPTH.
Alexandre Julliard
julliard at winehq.org
Thu Feb 26 09:04:54 CST 2009
Module: wine
Branch: master
Commit: 982482e7e8129197a509c4152facd61d8f9b5822
URL: http://source.winehq.org/git/wine.git/?a=commit;h=982482e7e8129197a509c4152facd61d8f9b5822
Author: Jeremy White <jwhite at codeweavers.com>
Date: Wed Feb 25 20:58:25 2009 -0600
sane.ds: Add support for ICAP_BITDEPTH.
---
dlls/sane.ds/capability.c | 40 +++++++++++++++++++++++++++++++++++++++-
dlls/twain_32/tests/dsm.c | 4 +++-
2 files changed, 42 insertions(+), 2 deletions(-)
diff --git a/dlls/sane.ds/capability.c b/dlls/sane.ds/capability.c
index 1d574e3..bbd0590 100644
--- a/dlls/sane.ds/capability.c
+++ b/dlls/sane.ds/capability.c
@@ -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;
diff --git a/dlls/twain_32/tests/dsm.c b/dlls/twain_32/tests/dsm.c
index 54641c1..9e7dd8d 100644
--- a/dlls/twain_32/tests/dsm.c
+++ b/dlls/twain_32/tests/dsm.c
@@ -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");
More information about the wine-cvs
mailing list