[sane.ds 1/3] Get resolution from sane, instead of hard coding -1.

Jeremy White jwhite at codeweavers.com
Thu Feb 12 15:47:04 CST 2009


---

With these 3 patches applied, Acrobat will scan single page, RBG images.

 dlls/sane.ds/Makefile.in |    3 ++-
 dlls/sane.ds/ds_image.c  |    7 +++++--
 dlls/sane.ds/sane_i.h    |    4 ++++
 3 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/dlls/sane.ds/Makefile.in b/dlls/sane.ds/Makefile.in
index d8646fe..245c42e 100644
--- a/dlls/sane.ds/Makefile.in
+++ b/dlls/sane.ds/Makefile.in
@@ -11,7 +11,8 @@ C_SRCS = \
 	ds_ctrl.c \
 	ds_image.c \
 	sane_main.c \
-	ui.c
+	ui.c \
+	options.c
 
 RC_SRCS = \
 	rsrc.rc
diff --git a/dlls/sane.ds/ds_image.c b/dlls/sane.ds/ds_image.c
index 9a88bb5..5bb6cbb 100644
--- a/dlls/sane.ds/ds_image.c
+++ b/dlls/sane.ds/ds_image.c
@@ -86,6 +86,7 @@ TW_UINT16 SANE_ImageInfoGet (pTW_IDENTITY pOrigin,
     TW_UINT16 twRC = TWRC_SUCCESS;
     pTW_IMAGEINFO pImageInfo = (pTW_IMAGEINFO) pData;
     SANE_Status status;
+    SANE_Int resolution;
 
     TRACE("DG_IMAGE/DAT_IMAGEINFO/MSG_GET\n");
 
@@ -111,9 +112,11 @@ TW_UINT16 SANE_ImageInfoGet (pTW_IDENTITY pOrigin,
             activeDS.sane_param_valid = TRUE;
         }
 
-        pImageInfo->XResolution.Whole = -1;
+        if (sane_option_get_int(activeDS.deviceHandle, "resolution", &resolution) == SANE_STATUS_GOOD)
+            pImageInfo->XResolution.Whole = pImageInfo->YResolution.Whole = resolution;
+        else
+            pImageInfo->XResolution.Whole = pImageInfo->YResolution.Whole = -1;
         pImageInfo->XResolution.Frac = 0;
-        pImageInfo->YResolution.Whole = -1;
         pImageInfo->YResolution.Frac = 0;
         pImageInfo->ImageWidth = activeDS.sane_param.pixels_per_line;
         pImageInfo->ImageLength = activeDS.sane_param.lines;
diff --git a/dlls/sane.ds/sane_i.h b/dlls/sane.ds/sane_i.h
index 5a3a6d0..5938eef 100644
--- a/dlls/sane.ds/sane_i.h
+++ b/dlls/sane.ds/sane_i.h
@@ -211,4 +211,8 @@ TW_UINT16 SANE_RGBResponseSet
 BOOL DoScannerUI(void);
 HWND ScanningDialogBox(HWND dialog, LONG progress);
 
+/* Option functions */
+SANE_Status sane_option_get_int(SANE_Handle h, const char *option_name, SANE_Int *val);
+
+
 #endif
-- 
1.6.2.rc0.57.g4ab7.dirty






More information about the wine-patches mailing list