mirror of
git://source.winehq.org/git/wine.git
synced 2024-10-06 07:57:22 +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:
parent
ed29473e60
commit
5590294cf3
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue