Commit 5590294c authored by Ilia Docin's avatar Ilia Docin Committed by Alexandre Julliard

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.
parent ed29473e
......@@ -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)
......
......@@ -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 );
......
......@@ -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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment