Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
383bb720
Commit
383bb720
authored
Oct 27, 2021
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sane.ds: Convert the SANE parameters to a private structure.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
d63aa5dc
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
51 additions
and
17 deletions
+51
-17
capability.c
dlls/sane.ds/capability.c
+7
-8
ds_ctrl.c
dlls/sane.ds/ds_ctrl.c
+5
-6
ds_image.c
dlls/sane.ds/ds_image.c
+0
-0
options.c
dlls/sane.ds/options.c
+27
-0
sane_i.h
dlls/sane.ds/sane_i.h
+12
-3
No files found.
dlls/sane.ds/capability.c
View file @
383bb720
...
...
@@ -372,8 +372,7 @@ static TW_UINT16 SANE_ICAPPixelType (pTW_CAPABILITY pCapability, TW_UINT16 actio
strcpy
(
mode
,
"Grayscale"
);
twCC
=
sane_option_set_str
(
"mode"
,
mode
,
&
reload
);
}
if
(
reload
)
sane_get_parameters
(
activeDS
.
deviceHandle
,
&
activeDS
.
sane_param
);
if
(
reload
)
get_sane_params
(
&
activeDS
.
frame_params
);
}
break
;
...
...
@@ -394,7 +393,7 @@ static TW_UINT16 SANE_ICAPPixelType (pTW_CAPABILITY pCapability, TW_UINT16 actio
twCC
=
sane_option_set_str
(
"mode"
,
mode
,
&
reload
);
}
if
(
twCC
!=
TWCC_SUCCESS
)
break
;
if
(
reload
)
sane_get_parameters
(
activeDS
.
deviceHandle
,
&
activeDS
.
sane_param
);
if
(
reload
)
get_sane_params
(
&
activeDS
.
frame_params
);
/* .. fall through intentional .. */
...
...
@@ -458,7 +457,7 @@ static TW_UINT16 SANE_ICAPBitDepth(pTW_CAPABILITY pCapability, TW_UINT16 action)
TRACE
(
"ICAP_BITDEPTH
\n
"
);
possible_values
[
0
]
=
activeDS
.
sane_param
.
depth
;
possible_values
[
0
]
=
activeDS
.
frame_params
.
depth
;
switch
(
action
)
{
...
...
@@ -469,15 +468,15 @@ static TW_UINT16 SANE_ICAPBitDepth(pTW_CAPABILITY pCapability, TW_UINT16 action)
case
MSG_GET
:
twCC
=
msg_get_enum
(
pCapability
,
possible_values
,
ARRAY_SIZE
(
possible_values
),
TWTY_UINT16
,
activeDS
.
sane_param
.
depth
,
activeDS
.
sane_param
.
depth
);
TWTY_UINT16
,
activeDS
.
frame_params
.
depth
,
activeDS
.
frame_params
.
depth
);
break
;
case
MSG_GETDEFAULT
:
/* .. Fall through intentional .. */
case
MSG_GETCURRENT
:
TRACE
(
"Returning current bitdepth of %d
\n
"
,
activeDS
.
sane_param
.
depth
);
twCC
=
set_onevalue
(
pCapability
,
TWTY_UINT16
,
activeDS
.
sane_param
.
depth
);
TRACE
(
"Returning current bitdepth of %d
\n
"
,
activeDS
.
frame_params
.
depth
);
twCC
=
set_onevalue
(
pCapability
,
TWTY_UINT16
,
activeDS
.
frame_params
.
depth
);
break
;
}
return
twCC
;
...
...
@@ -675,7 +674,7 @@ static TW_UINT16 SANE_ICAPPixelFlavor (pTW_CAPABILITY pCapability, TW_UINT16 act
TW_UINT16
twCC
=
TWCC_BADCAP
;
static
const
TW_UINT32
possible_values
[]
=
{
TWPF_CHOCOLATE
,
TWPF_VANILLA
};
TW_UINT32
val
;
TW_UINT32
flavor
=
activeDS
.
sane_param
.
depth
==
1
?
TWPF_VANILLA
:
TWPF_CHOCOLATE
;
TW_UINT32
flavor
=
activeDS
.
frame_params
.
depth
==
1
?
TWPF_VANILLA
:
TWPF_CHOCOLATE
;
TRACE
(
"ICAP_PIXELFLAVOR
\n
"
);
...
...
dlls/sane.ds/ds_ctrl.c
View file @
383bb720
...
...
@@ -309,11 +309,11 @@ TW_UINT16 SANE_SetupMemXferGet (pTW_IDENTITY pOrigin,
pTW_SETUPMEMXFER
pSetupMemXfer
=
(
pTW_SETUPMEMXFER
)
pData
;
TRACE
(
"DG_CONTROL/DAT_SETUPMEMXFER/MSG_GET
\n
"
);
if
(
activeDS
.
sane_param_valid
)
if
(
activeDS
.
frame_params
.
bytes_per_line
)
{
pSetupMemXfer
->
MinBufSize
=
activeDS
.
sane_param
.
bytes_per_line
;
pSetupMemXfer
->
MaxBufSize
=
activeDS
.
sane_param
.
bytes_per_line
*
8
;
pSetupMemXfer
->
Preferred
=
activeDS
.
sane_param
.
bytes_per_line
*
2
;
pSetupMemXfer
->
MinBufSize
=
activeDS
.
frame_params
.
bytes_per_line
;
pSetupMemXfer
->
MaxBufSize
=
activeDS
.
frame_params
.
bytes_per_line
*
8
;
pSetupMemXfer
->
Preferred
=
activeDS
.
frame_params
.
bytes_per_line
*
2
;
}
else
{
...
...
@@ -392,8 +392,7 @@ TW_UINT16 SANE_EnableDSUserInterface (pTW_IDENTITY pOrigin,
}
else
{
sane_get_parameters
(
activeDS
.
deviceHandle
,
&
activeDS
.
sane_param
);
activeDS
.
sane_param_valid
=
TRUE
;
get_sane_params
(
&
activeDS
.
frame_params
);
}
}
else
...
...
dlls/sane.ds/ds_image.c
View file @
383bb720
This diff is collapsed.
Click to expand it.
dlls/sane.ds/options.c
View file @
383bb720
...
...
@@ -260,3 +260,30 @@ TW_FIX32 convert_sane_res_to_twain(int res)
value
.
Frac
=
res
&
0xffff
;
return
value
;
}
TW_UINT16
get_sane_params
(
struct
frame_parameters
*
params
)
{
SANE_Parameters
sane_params
;
TW_UINT16
rc
=
sane_status_to_twcc
(
sane_get_parameters
(
activeDS
.
deviceHandle
,
&
sane_params
));
if
(
rc
!=
TWCC_SUCCESS
)
return
rc
;
switch
(
sane_params
.
format
)
{
case
SANE_FRAME_GRAY
:
params
->
format
=
FMT_GRAY
;
break
;
case
SANE_FRAME_RGB
:
params
->
format
=
FMT_RGB
;
break
;
default:
ERR
(
"Unhandled source frame format %i
\n
"
,
sane_params
.
format
);
params
->
format
=
FMT_OTHER
;
break
;
}
params
->
last_frame
=
sane_params
.
last_frame
;
params
->
bytes_per_line
=
sane_params
.
bytes_per_line
;
params
->
pixels_per_line
=
sane_params
.
pixels_per_line
;
params
->
lines
=
sane_params
.
lines
;
params
->
depth
=
sane_params
.
depth
;
return
TWCC_SUCCESS
;
}
dlls/sane.ds/sane_i.h
View file @
383bb720
...
...
@@ -37,6 +37,16 @@ extern HINSTANCE SANE_instance DECLSPEC_HIDDEN;
#define TWCC_CHECKSTATUS (TWCC_CUSTOMBASE + 1)
struct
frame_parameters
{
enum
{
FMT_GRAY
,
FMT_RGB
,
FMT_OTHER
}
format
;
BOOL
last_frame
;
int
bytes_per_line
;
int
pixels_per_line
;
int
lines
;
int
depth
;
};
/* internal information about an active data source */
struct
tagActiveDS
{
...
...
@@ -49,9 +59,7 @@ struct tagActiveDS
HWND
progressWnd
;
/* window handle of the scanning window */
SANE_Handle
deviceHandle
;
/* device handle */
SANE_Parameters
sane_param
;
/* parameters about the image
transferred */
BOOL
sane_param_valid
;
/* true if valid sane_param*/
struct
frame_parameters
frame_params
;
/* parameters about the image transferred */
BOOL
sane_started
;
/* If sane_start has been called */
INT
deviceIndex
;
/* index of the current device */
...
...
@@ -220,5 +228,6 @@ 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
;
TW_UINT16
get_sane_params
(
struct
frame_parameters
*
params
)
DECLSPEC_HIDDEN
;
#endif
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment