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 @@
...
@@ -29,6 +29,30 @@
WINE_DEFAULT_DEBUG_CHANNEL
(
dc
);
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
* MAPPING_FixIsotropic
*
*
...
@@ -36,10 +60,10 @@ WINE_DEFAULT_DEBUG_CHANNEL(dc);
...
@@ -36,10 +60,10 @@ WINE_DEFAULT_DEBUG_CHANNEL(dc);
*/
*/
static
void
MAPPING_FixIsotropic
(
DC
*
dc
)
static
void
MAPPING_FixIsotropic
(
DC
*
dc
)
{
{
double
xdim
=
fabs
((
double
)
dc
->
vportExtX
*
dc
->
virtual_size
.
cx
/
SIZE
virtual_size
=
get_dc_virtual_size
(
dc
);
(
dc
->
virtual_res
.
cx
*
dc
->
wndExtX
)
);
SIZE
virtual_res
=
get_dc_virtual_res
(
dc
);
double
ydim
=
fabs
((
double
)
dc
->
vportExtY
*
dc
->
virtual_size
.
cy
/
double
xdim
=
fabs
((
double
)
dc
->
vportExtX
*
virtual_size
.
cx
/
(
virtual_res
.
cx
*
dc
->
wndExtX
));
(
dc
->
virtual_res
.
cy
*
dc
->
wndExtY
));
double
ydim
=
fabs
((
double
)
dc
->
vportExtY
*
virtual_size
.
cy
/
(
virtual_res
.
cy
*
dc
->
wndExtY
));
if
(
xdim
>
ydim
)
if
(
xdim
>
ydim
)
{
{
...
@@ -136,14 +160,12 @@ INT nulldrv_SetMapMode( PHYSDEV dev, INT mode )
...
@@ -136,14 +160,12 @@ INT nulldrv_SetMapMode( PHYSDEV dev, INT mode )
{
{
DC
*
dc
=
get_nulldrv_dc
(
dev
);
DC
*
dc
=
get_nulldrv_dc
(
dev
);
INT
ret
=
dc
->
MapMode
;
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
;
if
(
mode
==
dc
->
MapMode
&&
(
mode
==
MM_ISOTROPIC
||
mode
==
MM_ANISOTROPIC
))
return
ret
;
horzSize
=
dc
->
virtual_size
.
cx
;
virtual_size
=
get_dc_virtual_size
(
dc
);
vertSize
=
dc
->
virtual_size
.
cy
;
virtual_res
=
get_dc_virtual_res
(
dc
);
horzRes
=
dc
->
virtual_res
.
cx
;
vertRes
=
dc
->
virtual_res
.
cy
;
switch
(
mode
)
switch
(
mode
)
{
{
case
MM_TEXT
:
case
MM_TEXT
:
...
@@ -154,34 +176,34 @@ INT nulldrv_SetMapMode( PHYSDEV dev, INT mode )
...
@@ -154,34 +176,34 @@ INT nulldrv_SetMapMode( PHYSDEV dev, INT mode )
break
;
break
;
case
MM_LOMETRIC
:
case
MM_LOMETRIC
:
case
MM_ISOTROPIC
:
case
MM_ISOTROPIC
:
dc
->
wndExtX
=
horzSize
*
10
;
dc
->
wndExtX
=
virtual_size
.
cx
*
10
;
dc
->
wndExtY
=
v
ertSize
*
10
;
dc
->
wndExtY
=
v
irtual_size
.
cy
*
10
;
dc
->
vportExtX
=
horzRes
;
dc
->
vportExtX
=
virtual_res
.
cx
;
dc
->
vportExtY
=
-
v
ertRes
;
dc
->
vportExtY
=
-
v
irtual_res
.
cy
;
break
;
break
;
case
MM_HIMETRIC
:
case
MM_HIMETRIC
:
dc
->
wndExtX
=
horzSize
*
100
;
dc
->
wndExtX
=
virtual_size
.
cx
*
100
;
dc
->
wndExtY
=
v
ertSize
*
100
;
dc
->
wndExtY
=
v
irtual_size
.
cy
*
100
;
dc
->
vportExtX
=
horzRes
;
dc
->
vportExtX
=
virtual_res
.
cx
;
dc
->
vportExtY
=
-
v
ertRes
;
dc
->
vportExtY
=
-
v
irtual_res
.
cy
;
break
;
break
;
case
MM_LOENGLISH
:
case
MM_LOENGLISH
:
dc
->
wndExtX
=
MulDiv
(
1000
,
horzSize
,
254
);
dc
->
wndExtX
=
MulDiv
(
1000
,
virtual_size
.
cx
,
254
);
dc
->
wndExtY
=
MulDiv
(
1000
,
v
ertSize
,
254
);
dc
->
wndExtY
=
MulDiv
(
1000
,
v
irtual_size
.
cy
,
254
);
dc
->
vportExtX
=
horzRes
;
dc
->
vportExtX
=
virtual_res
.
cx
;
dc
->
vportExtY
=
-
v
ertRes
;
dc
->
vportExtY
=
-
v
irtual_res
.
cy
;
break
;
break
;
case
MM_HIENGLISH
:
case
MM_HIENGLISH
:
dc
->
wndExtX
=
MulDiv
(
10000
,
horzSize
,
254
);
dc
->
wndExtX
=
MulDiv
(
10000
,
virtual_size
.
cx
,
254
);
dc
->
wndExtY
=
MulDiv
(
10000
,
v
ertSize
,
254
);
dc
->
wndExtY
=
MulDiv
(
10000
,
v
irtual_size
.
cy
,
254
);
dc
->
vportExtX
=
horzRes
;
dc
->
vportExtX
=
virtual_res
.
cx
;
dc
->
vportExtY
=
-
v
ertRes
;
dc
->
vportExtY
=
-
v
irtual_res
.
cy
;
break
;
break
;
case
MM_TWIPS
:
case
MM_TWIPS
:
dc
->
wndExtX
=
MulDiv
(
14400
,
horzSize
,
254
);
dc
->
wndExtX
=
MulDiv
(
14400
,
virtual_size
.
cx
,
254
);
dc
->
wndExtY
=
MulDiv
(
14400
,
v
ertSize
,
254
);
dc
->
wndExtY
=
MulDiv
(
14400
,
v
irtual_size
.
cy
,
254
);
dc
->
vportExtX
=
horzRes
;
dc
->
vportExtX
=
virtual_res
.
cx
;
dc
->
vportExtY
=
-
v
ertRes
;
dc
->
vportExtY
=
-
v
irtual_res
.
cy
;
break
;
break
;
case
MM_ANISOTROPIC
:
case
MM_ANISOTROPIC
:
break
;
break
;
...
@@ -596,15 +618,11 @@ BOOL WINAPI SetVirtualResolution(HDC hdc, DWORD horz_res, DWORD vert_res,
...
@@ -596,15 +618,11 @@ BOOL WINAPI SetVirtualResolution(HDC hdc, DWORD horz_res, DWORD vert_res,
DC
*
dc
;
DC
*
dc
;
TRACE
(
"(%p %d %d %d %d)
\n
"
,
hdc
,
horz_res
,
vert_res
,
horz_size
,
vert_size
);
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
);
/* they must be all zero */
vert_res
=
GetDeviceCaps
(
hdc
,
VERTRES
);
if
(
horz_res
||
vert_res
||
horz_size
||
vert_size
)
return
FALSE
;
horz_size
=
GetDeviceCaps
(
hdc
,
HORZSIZE
);
vert_size
=
GetDeviceCaps
(
hdc
,
VERTSIZE
);
}
}
else
if
(
horz_res
==
0
||
vert_res
==
0
||
horz_size
==
0
||
vert_size
==
0
)
return
FALSE
;
dc
=
get_dc_ptr
(
hdc
);
dc
=
get_dc_ptr
(
hdc
);
if
(
!
dc
)
return
FALSE
;
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