1
0
mirror of https://github.com/wine-mirror/wine synced 2024-07-08 03:45:57 +00:00

sane.ds: Do the reverse conversion of frame edges before setting.

Sane backends must attach a unit of either pixels or millimeters to scan area options.
This commit is contained in:
Ilia Docin 2023-08-06 12:30:31 +03:00 committed by Alexandre Julliard
parent ed29473e60
commit 5590294cf3
3 changed files with 10 additions and 4 deletions

View File

@ -164,10 +164,10 @@ TW_UINT16 SANE_ImageLayoutSet (pTW_IDENTITY pOrigin,
img->Frame.Right.Whole, img->Frame.Right.Frac,
img->Frame.Bottom.Whole, img->Frame.Bottom.Frac);
tlx = img->Frame.Left.Whole * 65536 + img->Frame.Left.Frac;
tly = img->Frame.Top.Whole * 65536 + img->Frame.Top.Frac;
brx = img->Frame.Right.Whole * 65536 + img->Frame.Right.Frac;
bry = img->Frame.Bottom.Whole * 65536 + img->Frame.Bottom.Frac;
tlx = convert_twain_res_to_sane( img->Frame.Left );
tly = convert_twain_res_to_sane( img->Frame.Top );
brx = convert_twain_res_to_sane( img->Frame.Right );
bry = convert_twain_res_to_sane( img->Frame.Bottom );
twrc = sane_option_set_scan_area( tlx, tly, brx, bry, &changed );
if (twrc != TWRC_SUCCESS)

View File

@ -200,6 +200,11 @@ TW_FIX32 convert_sane_res_to_twain(int res)
return value;
}
int convert_twain_res_to_sane( TW_FIX32 res )
{
return MulDiv( res.Whole * 65536 + res.Frac, 254, 10 ); /* inch -> mm */
}
TW_UINT16 get_sane_params( struct frame_parameters *params )
{
return SANE_CALL( get_params, params );

View File

@ -208,6 +208,7 @@ TW_UINT16 sane_option_get_scan_area( int *tlx, int *tly, int *brx, int *bry ) DE
TW_UINT16 sane_option_get_max_scan_area( int *tlx, int *tly, int *brx, int *bry ) DECLSPEC_HIDDEN;
TW_UINT16 sane_option_set_scan_area( int tlx, int tly, int brx, int bry, BOOL *reload ) DECLSPEC_HIDDEN;
TW_FIX32 convert_sane_res_to_twain( int res ) DECLSPEC_HIDDEN;
int convert_twain_res_to_sane( TW_FIX32 res ) DECLSPEC_HIDDEN;
TW_UINT16 get_sane_params( struct frame_parameters *params ) DECLSPEC_HIDDEN;
#endif