Module: wine Branch: master Commit: 782ea74acc56b27077ddefcd7c5efae246b2fc60 URL: http://source.winehq.org/git/wine.git/?a=commit;h=782ea74acc56b27077ddefcd7c...
Author: Jeremy White jwhite@codeweavers.com Date: Tue Mar 10 15:48:18 2009 -0500
sane.ds: Move a few static functions so they can be shared.
---
dlls/sane.ds/capability.c | 52 --------------------------------------------- dlls/sane.ds/options.c | 49 ++++++++++++++++++++++++++++++++++++++++++ dlls/sane.ds/sane_i.h | 2 + 3 files changed, 51 insertions(+), 52 deletions(-)
diff --git a/dlls/sane.ds/capability.c b/dlls/sane.ds/capability.c index 859b4be..20fd2c3 100644 --- a/dlls/sane.ds/capability.c +++ b/dlls/sane.ds/capability.c @@ -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) { diff --git a/dlls/sane.ds/options.c b/dlls/sane.ds/options.c index 44cd34e..c2e5020 100644 --- a/dlls/sane.ds/options.c +++ b/dlls/sane.ds/options.c @@ -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 diff --git a/dlls/sane.ds/sane_i.h b/dlls/sane.ds/sane_i.h index 72b4b79..30fde23 100644 --- a/dlls/sane.ds/sane_i.h +++ b/dlls/sane.ds/sane_i.h @@ -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