mirror of
https://github.com/reactos/wine.git
synced 2025-02-08 21:27:31 +00:00
sane.ds: Move a few static functions so they can be shared.
This commit is contained in:
parent
689a49b52a
commit
782ea74acc
@ -315,33 +315,6 @@ static BOOL sane_mode_to_pixeltype(SANE_String_Const mode, TW_UINT16 *pixeltype)
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static TW_UINT16 sane_status_to_twcc(SANE_Status rc)
|
||||
{
|
||||
switch (rc)
|
||||
{
|
||||
case SANE_STATUS_GOOD:
|
||||
return TWCC_SUCCESS;
|
||||
case SANE_STATUS_UNSUPPORTED:
|
||||
return TWCC_CAPUNSUPPORTED;
|
||||
case SANE_STATUS_JAMMED:
|
||||
return TWCC_PAPERJAM;
|
||||
case SANE_STATUS_NO_MEM:
|
||||
return TWCC_LOWMEMORY;
|
||||
case SANE_STATUS_ACCESS_DENIED:
|
||||
return TWCC_DENIED;
|
||||
|
||||
case SANE_STATUS_IO_ERROR:
|
||||
case SANE_STATUS_NO_DOCS:
|
||||
case SANE_STATUS_COVER_OPEN:
|
||||
case SANE_STATUS_EOF:
|
||||
case SANE_STATUS_INVAL:
|
||||
case SANE_STATUS_CANCELLED:
|
||||
case SANE_STATUS_DEVICE_BUSY:
|
||||
default:
|
||||
return TWCC_BUMMER;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/* ICAP_PIXELTYPE */
|
||||
@ -696,31 +669,6 @@ static TW_UINT16 SANE_ICAPResolution (pTW_CAPABILITY pCapability, TW_UINT16 acti
|
||||
return twCC;
|
||||
}
|
||||
|
||||
#ifdef SONAME_LIBSANE
|
||||
static void convert_double_fix32(double d, TW_FIX32 *fix32)
|
||||
{
|
||||
TW_INT32 value = (TW_INT32) (d * 65536.0 + 0.5);
|
||||
fix32->Whole = value >> 16;
|
||||
fix32->Frac = value & 0x0000ffffL;
|
||||
}
|
||||
|
||||
static BOOL convert_sane_res_to_twain(double sane_res, SANE_Unit unit, TW_FIX32 *twain_res, TW_UINT16 twtype)
|
||||
{
|
||||
double d;
|
||||
|
||||
if (unit != SANE_UNIT_MM)
|
||||
return FALSE;
|
||||
|
||||
if (twtype != TWUN_INCHES)
|
||||
return FALSE;
|
||||
|
||||
d = (sane_res / 10.0) / 2.54;
|
||||
convert_double_fix32((sane_res / 10.0) / 2.54, twain_res);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* ICAP_PHYSICALHEIGHT, ICAP_PHYSICALWIDTH */
|
||||
static TW_UINT16 SANE_ICAPPhysical (pTW_CAPABILITY pCapability, TW_UINT16 action, TW_UINT16 cap)
|
||||
{
|
||||
|
@ -218,4 +218,53 @@ SANE_Status sane_option_probe_scan_area(SANE_Handle h, const char *option_name,
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
TW_UINT16 sane_status_to_twcc(SANE_Status rc)
|
||||
{
|
||||
switch (rc)
|
||||
{
|
||||
case SANE_STATUS_GOOD:
|
||||
return TWCC_SUCCESS;
|
||||
case SANE_STATUS_UNSUPPORTED:
|
||||
return TWCC_CAPUNSUPPORTED;
|
||||
case SANE_STATUS_JAMMED:
|
||||
return TWCC_PAPERJAM;
|
||||
case SANE_STATUS_NO_MEM:
|
||||
return TWCC_LOWMEMORY;
|
||||
case SANE_STATUS_ACCESS_DENIED:
|
||||
return TWCC_DENIED;
|
||||
|
||||
case SANE_STATUS_IO_ERROR:
|
||||
case SANE_STATUS_NO_DOCS:
|
||||
case SANE_STATUS_COVER_OPEN:
|
||||
case SANE_STATUS_EOF:
|
||||
case SANE_STATUS_INVAL:
|
||||
case SANE_STATUS_CANCELLED:
|
||||
case SANE_STATUS_DEVICE_BUSY:
|
||||
default:
|
||||
return TWCC_BUMMER;
|
||||
}
|
||||
}
|
||||
static void convert_double_fix32(double d, TW_FIX32 *fix32)
|
||||
{
|
||||
TW_INT32 value = (TW_INT32) (d * 65536.0 + 0.5);
|
||||
fix32->Whole = value >> 16;
|
||||
fix32->Frac = value & 0x0000ffffL;
|
||||
}
|
||||
|
||||
BOOL convert_sane_res_to_twain(double sane_res, SANE_Unit unit, TW_FIX32 *twain_res, TW_UINT16 twtype)
|
||||
{
|
||||
double d;
|
||||
|
||||
if (unit != SANE_UNIT_MM)
|
||||
return FALSE;
|
||||
|
||||
if (twtype != TWUN_INCHES)
|
||||
return FALSE;
|
||||
|
||||
d = (sane_res / 10.0) / 2.54;
|
||||
convert_double_fix32((sane_res / 10.0) / 2.54, twain_res);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
#endif
|
||||
|
@ -234,6 +234,8 @@ SANE_Status sane_option_probe_scan_area(SANE_Handle h, const char *option_name,
|
||||
SANE_Status sane_option_get_bool(SANE_Handle h, const char *option_name, SANE_Bool *val, SANE_Int *status);
|
||||
SANE_Status sane_option_set_bool(SANE_Handle h, const char *option_name, SANE_Bool val, SANE_Int *status);
|
||||
SANE_Status sane_option_set_fixed(SANE_Handle h, const char *option_name, SANE_Fixed val, SANE_Int *status);
|
||||
TW_UINT16 sane_status_to_twcc(SANE_Status rc);
|
||||
BOOL convert_sane_res_to_twain(double sane_res, SANE_Unit unit, TW_FIX32 *twain_res, TW_UINT16 twtype);
|
||||
#endif
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user