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
3e88582a
Commit
3e88582a
authored
Oct 17, 2013
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gdi32: Determine the virtual resolution dynamically if it hasn't been set.
parent
fa37b635
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
54 additions
and
36 deletions
+54
-36
mapping.c
dlls/gdi32/mapping.c
+54
-36
No files found.
dlls/gdi32/mapping.c
View file @
3e88582a
...
...
@@ -29,6 +29,30 @@
WINE_DEFAULT_DEBUG_CHANNEL
(
dc
);
static
SIZE
get_dc_virtual_size
(
DC
*
dc
)
{
SIZE
ret
=
dc
->
virtual_size
;
if
(
!
ret
.
cx
)
{
ret
.
cx
=
GetDeviceCaps
(
dc
->
hSelf
,
HORZSIZE
);
ret
.
cy
=
GetDeviceCaps
(
dc
->
hSelf
,
VERTSIZE
);
}
return
ret
;
}
static
SIZE
get_dc_virtual_res
(
DC
*
dc
)
{
SIZE
ret
=
dc
->
virtual_res
;
if
(
!
ret
.
cx
)
{
ret
.
cx
=
GetDeviceCaps
(
dc
->
hSelf
,
HORZRES
);
ret
.
cy
=
GetDeviceCaps
(
dc
->
hSelf
,
VERTRES
);
}
return
ret
;
}
/***********************************************************************
* MAPPING_FixIsotropic
*
...
...
@@ -36,10 +60,10 @@ WINE_DEFAULT_DEBUG_CHANNEL(dc);
*/
static
void
MAPPING_FixIsotropic
(
DC
*
dc
)
{
double
xdim
=
fabs
((
double
)
dc
->
vportExtX
*
dc
->
virtual_size
.
cx
/
(
dc
->
virtual_res
.
cx
*
dc
->
wndExtX
)
);
double
ydim
=
fabs
((
double
)
dc
->
vportExtY
*
dc
->
virtual_size
.
cy
/
(
dc
->
virtual_res
.
cy
*
dc
->
wndExtY
));
SIZE
virtual_size
=
get_dc_virtual_size
(
dc
);
SIZE
virtual_res
=
get_dc_virtual_res
(
dc
);
double
xdim
=
fabs
((
double
)
dc
->
vportExtX
*
virtual_size
.
cx
/
(
virtual_res
.
cx
*
dc
->
wndExtX
));
double
ydim
=
fabs
((
double
)
dc
->
vportExtY
*
virtual_size
.
cy
/
(
virtual_res
.
cy
*
dc
->
wndExtY
));
if
(
xdim
>
ydim
)
{
...
...
@@ -136,14 +160,12 @@ INT nulldrv_SetMapMode( PHYSDEV dev, INT mode )
{
DC
*
dc
=
get_nulldrv_dc
(
dev
);
INT
ret
=
dc
->
MapMode
;
INT
horzSize
,
vertSize
,
horzRes
,
vertR
es
;
SIZE
virtual_size
,
virtual_r
es
;
if
(
mode
==
dc
->
MapMode
&&
(
mode
==
MM_ISOTROPIC
||
mode
==
MM_ANISOTROPIC
))
return
ret
;
horzSize
=
dc
->
virtual_size
.
cx
;
vertSize
=
dc
->
virtual_size
.
cy
;
horzRes
=
dc
->
virtual_res
.
cx
;
vertRes
=
dc
->
virtual_res
.
cy
;
virtual_size
=
get_dc_virtual_size
(
dc
);
virtual_res
=
get_dc_virtual_res
(
dc
);
switch
(
mode
)
{
case
MM_TEXT
:
...
...
@@ -154,34 +176,34 @@ INT nulldrv_SetMapMode( PHYSDEV dev, INT mode )
break
;
case
MM_LOMETRIC
:
case
MM_ISOTROPIC
:
dc
->
wndExtX
=
horzSize
*
10
;
dc
->
wndExtY
=
v
ertSize
*
10
;
dc
->
vportExtX
=
horzRes
;
dc
->
vportExtY
=
-
v
ertRes
;
dc
->
wndExtX
=
virtual_size
.
cx
*
10
;
dc
->
wndExtY
=
v
irtual_size
.
cy
*
10
;
dc
->
vportExtX
=
virtual_res
.
cx
;
dc
->
vportExtY
=
-
v
irtual_res
.
cy
;
break
;
case
MM_HIMETRIC
:
dc
->
wndExtX
=
horzSize
*
100
;
dc
->
wndExtY
=
v
ertSize
*
100
;
dc
->
vportExtX
=
horzRes
;
dc
->
vportExtY
=
-
v
ertRes
;
dc
->
wndExtX
=
virtual_size
.
cx
*
100
;
dc
->
wndExtY
=
v
irtual_size
.
cy
*
100
;
dc
->
vportExtX
=
virtual_res
.
cx
;
dc
->
vportExtY
=
-
v
irtual_res
.
cy
;
break
;
case
MM_LOENGLISH
:
dc
->
wndExtX
=
MulDiv
(
1000
,
horzSize
,
254
);
dc
->
wndExtY
=
MulDiv
(
1000
,
v
ertSize
,
254
);
dc
->
vportExtX
=
horzRes
;
dc
->
vportExtY
=
-
v
ertRes
;
dc
->
wndExtX
=
MulDiv
(
1000
,
virtual_size
.
cx
,
254
);
dc
->
wndExtY
=
MulDiv
(
1000
,
v
irtual_size
.
cy
,
254
);
dc
->
vportExtX
=
virtual_res
.
cx
;
dc
->
vportExtY
=
-
v
irtual_res
.
cy
;
break
;
case
MM_HIENGLISH
:
dc
->
wndExtX
=
MulDiv
(
10000
,
horzSize
,
254
);
dc
->
wndExtY
=
MulDiv
(
10000
,
v
ertSize
,
254
);
dc
->
vportExtX
=
horzRes
;
dc
->
vportExtY
=
-
v
ertRes
;
dc
->
wndExtX
=
MulDiv
(
10000
,
virtual_size
.
cx
,
254
);
dc
->
wndExtY
=
MulDiv
(
10000
,
v
irtual_size
.
cy
,
254
);
dc
->
vportExtX
=
virtual_res
.
cx
;
dc
->
vportExtY
=
-
v
irtual_res
.
cy
;
break
;
case
MM_TWIPS
:
dc
->
wndExtX
=
MulDiv
(
14400
,
horzSize
,
254
);
dc
->
wndExtY
=
MulDiv
(
14400
,
v
ertSize
,
254
);
dc
->
vportExtX
=
horzRes
;
dc
->
vportExtY
=
-
v
ertRes
;
dc
->
wndExtX
=
MulDiv
(
14400
,
virtual_size
.
cx
,
254
);
dc
->
wndExtY
=
MulDiv
(
14400
,
v
irtual_size
.
cy
,
254
);
dc
->
vportExtX
=
virtual_res
.
cx
;
dc
->
vportExtY
=
-
v
irtual_res
.
cy
;
break
;
case
MM_ANISOTROPIC
:
break
;
...
...
@@ -596,15 +618,11 @@ BOOL WINAPI SetVirtualResolution(HDC hdc, DWORD horz_res, DWORD vert_res,
DC
*
dc
;
TRACE
(
"(%p %d %d %d %d)
\n
"
,
hdc
,
horz_res
,
vert_res
,
horz_size
,
vert_size
);
if
(
horz_res
==
0
&&
vert_res
==
0
&&
horz_size
==
0
&&
vert_size
==
0
)
if
(
!
horz_res
||
!
vert_res
||
!
horz_size
||
!
vert_size
)
{
horz_res
=
GetDeviceCaps
(
hdc
,
HORZRES
);
vert_res
=
GetDeviceCaps
(
hdc
,
VERTRES
);
horz_size
=
GetDeviceCaps
(
hdc
,
HORZSIZE
);
vert_size
=
GetDeviceCaps
(
hdc
,
VERTSIZE
);
/* they must be all zero */
if
(
horz_res
||
vert_res
||
horz_size
||
vert_size
)
return
FALSE
;
}
else
if
(
horz_res
==
0
||
vert_res
==
0
||
horz_size
==
0
||
vert_size
==
0
)
return
FALSE
;
dc
=
get_dc_ptr
(
hdc
);
if
(
!
dc
)
return
FALSE
;
...
...
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