sane.ds: Get resolution from sane, instead of hard coding -1.
This commit is contained in:
parent
9f32c0d9d6
commit
4b794bee9a
|
@ -10,6 +10,7 @@ C_SRCS = \
|
|||
capability.c \
|
||||
ds_ctrl.c \
|
||||
ds_image.c \
|
||||
options.c \
|
||||
sane_main.c \
|
||||
ui.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;
|
||||
|
|
|
@ -0,0 +1,49 @@
|
|||
/*
|
||||
* Copyright 2009 Jeremy White <jwhite@codeweavers.com> for CodeWeavers
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include "twain.h"
|
||||
#include "sane_i.h"
|
||||
#include "wine/debug.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(twain);
|
||||
|
||||
#ifdef SONAME_LIBSANE
|
||||
SANE_Status sane_option_get_int(SANE_Handle h, const char *option_name, SANE_Int *val)
|
||||
{
|
||||
SANE_Status rc;
|
||||
SANE_Int optcount;
|
||||
const SANE_Option_Descriptor *opt;
|
||||
int i;
|
||||
|
||||
rc = psane_control_option(h, 0, SANE_ACTION_GET_VALUE, &optcount, NULL);
|
||||
if (rc != SANE_STATUS_GOOD)
|
||||
return rc;
|
||||
|
||||
for (i = 1; i < optcount; i++)
|
||||
{
|
||||
opt = psane_get_option_descriptor(h, i);
|
||||
if (opt && (opt->name && strcmp(opt->name, option_name) == 0) &&
|
||||
opt->type == SANE_TYPE_INT )
|
||||
return psane_control_option(h, i, SANE_ACTION_GET_VALUE, val, NULL);
|
||||
}
|
||||
return SANE_STATUS_EOF;
|
||||
}
|
||||
#endif
|
|
@ -211,4 +211,10 @@ TW_UINT16 SANE_RGBResponseSet
|
|||
BOOL DoScannerUI(void);
|
||||
HWND ScanningDialogBox(HWND dialog, LONG progress);
|
||||
|
||||
/* Option functions */
|
||||
#ifdef SONAME_LIBSANE
|
||||
SANE_Status sane_option_get_int(SANE_Handle h, const char *option_name, SANE_Int *val);
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue