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
02a15500
Commit
02a15500
authored
May 25, 2008
by
Dmitry Timoshkov
Committed by
Alexandre Julliard
May 27, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gdi32: Make generated EMFs fully match Windows ones.
parent
7aff723c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
70 additions
and
48 deletions
+70
-48
enhmetafile.c
dlls/gdi32/enhmetafile.c
+49
-40
metafile.c
dlls/gdi32/metafile.c
+16
-3
metafile.c
dlls/gdi32/tests/metafile.c
+5
-5
No files found.
dlls/gdi32/enhmetafile.c
View file @
02a15500
...
...
@@ -2257,6 +2257,7 @@ BOOL WINAPI EnumEnhMetaFile(
HPEN
hPen
=
NULL
;
HBRUSH
hBrush
=
NULL
;
HFONT
hFont
=
NULL
;
HRGN
hRgn
=
NULL
;
enum_emh_data
*
info
;
SIZE
vp_size
,
win_size
;
POINT
vp_org
,
win_org
;
...
...
@@ -2311,11 +2312,18 @@ BOOL WINAPI EnumEnhMetaFile(
GetWindowOrgEx
(
hdc
,
&
win_org
);
mapMode
=
GetMapMode
(
hdc
);
/* save
the current pen, brush and font
*/
/* save
DC
*/
hPen
=
GetCurrentObject
(
hdc
,
OBJ_PEN
);
hBrush
=
GetCurrentObject
(
hdc
,
OBJ_BRUSH
);
hFont
=
GetCurrentObject
(
hdc
,
OBJ_FONT
);
hRgn
=
CreateRectRgn
(
0
,
0
,
0
,
0
);
if
(
!
GetClipRgn
(
hdc
,
hRgn
))
{
DeleteObject
(
hRgn
);
hRgn
=
0
;
}
old_text_color
=
SetTextColor
(
hdc
,
RGB
(
0
,
0
,
0
));
old_bk_color
=
SetBkColor
(
hdc
,
RGB
(
0xff
,
0xff
,
0xff
));
old_align
=
SetTextAlign
(
hdc
,
0
);
...
...
@@ -2410,10 +2418,12 @@ BOOL WINAPI EnumEnhMetaFile(
SetBkColor
(
hdc
,
old_bk_color
);
SetTextColor
(
hdc
,
old_text_color
);
/* restore
pen, brush and font
*/
/* restore
DC
*/
SelectObject
(
hdc
,
hBrush
);
SelectObject
(
hdc
,
hPen
);
SelectObject
(
hdc
,
hFont
);
ExtSelectClipRgn
(
hdc
,
hRgn
,
RGN_COPY
);
DeleteObject
(
hRgn
);
SetWorldTransform
(
hdc
,
&
savedXform
);
if
(
savedMode
)
...
...
@@ -2673,9 +2683,8 @@ HENHMETAFILE WINAPI SetWinMetaFileBits(UINT cbBuffer,
HENHMETAFILE
ret
=
NULL
;
HDC
hdc
=
NULL
,
hdcdisp
=
NULL
;
RECT
rc
,
*
prcFrame
=
NULL
;
gdi_mf_comment
*
mfcomment
;
UINT
mfcomment_size
;
LONG
mm
,
xExt
,
yExt
;
INT
horzsize
,
vertsize
,
horzres
,
vertres
;
TRACE
(
"(%d, %p, %p, %p)
\n
"
,
cbBuffer
,
lpbBuffer
,
hdcRef
,
lpmfp
);
...
...
@@ -2736,49 +2745,49 @@ HENHMETAFILE WINAPI SetWinMetaFileBits(UINT cbBuffer,
* Write the original METAFILE into the enhanced metafile.
* It is encapsulated in a GDICOMMENT_WINDOWS_METAFILE record.
*/
mfcomment_size
=
sizeof
(
gdi_mf_comment
)
+
cbBuffer
;
mfcomment
=
HeapAlloc
(
GetProcessHeap
(),
0
,
mfcomment_size
);
if
(
mfcomment
)
{
mfcomment
->
ident
=
GDICOMMENT_IDENTIFIER
;
mfcomment
->
iComment
=
GDICOMMENT_WINDOWS_METAFILE
;
mfcomment
->
nVersion
=
0x00000300
;
mfcomment
->
nChecksum
=
0
;
/* FIXME */
mfcomment
->
fFlags
=
0
;
mfcomment
->
cbWinMetaFile
=
cbBuffer
;
memcpy
(
&
mfcomment
[
1
],
lpbBuffer
,
cbBuffer
);
GdiComment
(
hdc
,
mfcomment_size
,
(
BYTE
*
)
mfcomment
);
HeapFree
(
GetProcessHeap
(),
0
,
mfcomment
);
}
if
(
mm
!=
MM_TEXT
)
SetMapMode
(
hdc
,
mm
);
if
(
mm
==
MM_ISOTROPIC
||
mm
==
MM_ANISOTROPIC
)
{
INT
horzsize
,
vertsize
,
horzres
,
vertres
;
gdi_mf_comment
*
mfcomment
;
UINT
mfcomment_size
;
horzsize
=
GetDeviceCaps
(
hdcRef
,
HORZSIZE
);
vertsize
=
GetDeviceCaps
(
hdcRef
,
VERTSIZE
);
horzres
=
GetDeviceCaps
(
hdcRef
,
HORZRES
);
vertres
=
GetDeviceCaps
(
hdcRef
,
VERTRES
);
if
(
!
xExt
||
!
yExt
)
mfcomment_size
=
sizeof
(
gdi_mf_comment
)
+
cbBuffer
;
mfcomment
=
HeapAlloc
(
GetProcessHeap
(),
0
,
mfcomment_size
);
if
(
mfcomment
)
{
/* Use the whole device surface */
xExt
=
horzres
;
yExt
=
vertres
;
}
else
{
xExt
=
MulDiv
(
xExt
,
horzres
,
100
*
horzsize
);
yExt
=
MulDiv
(
yExt
,
vertres
,
100
*
vertsize
);
mfcomment
->
ident
=
GDICOMMENT_IDENTIFIER
;
mfcomment
->
iComment
=
GDICOMMENT_WINDOWS_METAFILE
;
mfcomment
->
nVersion
=
0x00000300
;
mfcomment
->
nChecksum
=
0
;
/* FIXME */
mfcomment
->
fFlags
=
0
;
mfcomment
->
cbWinMetaFile
=
cbBuffer
;
memcpy
(
&
mfcomment
[
1
],
lpbBuffer
,
cbBuffer
);
GdiComment
(
hdc
,
mfcomment_size
,
(
BYTE
*
)
mfcomment
);
HeapFree
(
GetProcessHeap
(),
0
,
mfcomment
);
}
SetMapMode
(
hdc
,
mm
);
}
/* set the initial viewport:window ratio as 1:1 */
SetViewportExtEx
(
hdc
,
xExt
,
yExt
,
NULL
);
SetWindowExtEx
(
hdc
,
xExt
,
yExt
,
NULL
);
horzsize
=
GetDeviceCaps
(
hdcRef
,
HORZSIZE
);
vertsize
=
GetDeviceCaps
(
hdcRef
,
VERTSIZE
);
horzres
=
GetDeviceCaps
(
hdcRef
,
HORZRES
);
vertres
=
GetDeviceCaps
(
hdcRef
,
VERTRES
);
if
(
!
xExt
||
!
yExt
)
{
/* Use the whole device surface */
xExt
=
horzres
;
yExt
=
vertres
;
}
else
{
xExt
=
MulDiv
(
xExt
,
horzres
,
100
*
horzsize
);
yExt
=
MulDiv
(
yExt
,
vertres
,
100
*
vertsize
);
}
/* set the initial viewport:window ratio as 1:1 */
SetViewportExtEx
(
hdc
,
xExt
,
yExt
,
NULL
);
SetWindowExtEx
(
hdc
,
xExt
,
yExt
,
NULL
);
PlayMetaFile
(
hdc
,
hmf
);
...
...
dlls/gdi32/metafile.c
View file @
02a15500
...
...
@@ -396,6 +396,8 @@ BOOL MF_PlayMetaFile( HDC hdc, METAHEADER *mh)
HPEN
hPen
;
HBRUSH
hBrush
;
HFONT
hFont
;
HPALETTE
hPal
;
HRGN
hRgn
;
BOOL
loaded
=
FALSE
;
if
(
!
mh
)
return
FALSE
;
...
...
@@ -405,10 +407,18 @@ BOOL MF_PlayMetaFile( HDC hdc, METAHEADER *mh)
loaded
=
TRUE
;
}
/* save
the current pen, brush and font
*/
/* save
DC
*/
hPen
=
GetCurrentObject
(
hdc
,
OBJ_PEN
);
hBrush
=
GetCurrentObject
(
hdc
,
OBJ_BRUSH
);
hFont
=
GetCurrentObject
(
hdc
,
OBJ_FONT
);
hPal
=
GetCurrentObject
(
hdc
,
OBJ_PAL
);
hRgn
=
CreateRectRgn
(
0
,
0
,
0
,
0
);
if
(
!
GetClipRgn
(
hdc
,
hRgn
))
{
DeleteObject
(
hRgn
);
hRgn
=
0
;
}
/* create the handle table */
ht
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
...
...
@@ -436,9 +446,12 @@ BOOL MF_PlayMetaFile( HDC hdc, METAHEADER *mh)
PlayMetaFileRecord
(
hdc
,
ht
,
mr
,
mh
->
mtNoObjects
);
}
SelectObject
(
hdc
,
hBrush
);
/* restore DC */
SelectObject
(
hdc
,
hPen
);
SelectObject
(
hdc
,
hFont
);
SelectObject
(
hdc
,
hBrush
);
SelectPalette
(
hdc
,
hPal
,
FALSE
);
ExtSelectClipRgn
(
hdc
,
hRgn
,
RGN_COPY
);
DeleteObject
(
hRgn
);
/* free objects in handle table */
for
(
i
=
0
;
i
<
mh
->
mtNoObjects
;
i
++
)
...
...
dlls/gdi32/tests/metafile.c
View file @
02a15500
...
...
@@ -1480,7 +1480,7 @@ static void test_emf_ExtTextOut_on_path(void)
* are there, but their contents don't match for different reasons.
*/
if
(
compare_emf_bits
(
hMetafile
,
EMF_TEXTOUT_ON_PATH_BITS
,
sizeof
(
EMF_TEXTOUT_ON_PATH_BITS
),
"emf_TextOut_on_path"
,
FALSE
,
TRU
E
)
!=
0
)
"emf_TextOut_on_path"
,
FALSE
,
FALS
E
)
!=
0
)
{
dump_emf_bits
(
hMetafile
,
"emf_TextOut_on_path"
);
dump_emf_records
(
hMetafile
,
"emf_TextOut_on_path"
);
...
...
@@ -1676,7 +1676,7 @@ static void test_emf_clipping(void)
ok
(
hemf
!=
0
,
"CloseEnhMetaFile error %d
\n
"
,
GetLastError
());
if
(
compare_emf_bits
(
hemf
,
EMF_CLIPPING
,
sizeof
(
EMF_CLIPPING
),
"emf_clipping"
,
FALSE
,
TRU
E
)
!=
0
)
"emf_clipping"
,
FALSE
,
FALS
E
)
!=
0
)
{
dump_emf_bits
(
hemf
,
"emf_clipping"
);
dump_emf_records
(
hemf
,
"emf_clipping"
);
...
...
@@ -1785,7 +1785,7 @@ static void test_mf_conversions(void)
hemf
=
create_converted_emf
(
&
mfp
);
if
(
compare_emf_bits
(
hemf
,
EMF_LINETO_MM_ANISOTROPIC_BITS
,
sizeof
(
EMF_LINETO_MM_ANISOTROPIC_BITS
),
"emf_LineTo MM_ANISOTROPIC"
,
TRUE
,
TRU
E
)
!=
0
)
"emf_LineTo MM_ANISOTROPIC"
,
TRUE
,
FALS
E
)
!=
0
)
{
dump_emf_bits
(
hemf
,
"emf_LineTo MM_ANISOTROPIC"
);
dump_emf_records
(
hemf
,
"emf_LineTo MM_ANISOTROPIC"
);
...
...
@@ -1810,7 +1810,7 @@ static void test_mf_conversions(void)
hemf
=
create_converted_emf
(
&
mfp
);
if
(
compare_emf_bits
(
hemf
,
EMF_LINETO_MM_TEXT_BITS
,
sizeof
(
EMF_LINETO_MM_TEXT_BITS
),
"emf_LineTo MM_TEXT"
,
TRUE
,
TRU
E
)
!=
0
)
"emf_LineTo MM_TEXT"
,
TRUE
,
FALS
E
)
!=
0
)
{
dump_emf_bits
(
hemf
,
"emf_LineTo MM_TEXT"
);
dump_emf_records
(
hemf
,
"emf_LineTo MM_TEXT"
);
...
...
@@ -1830,7 +1830,7 @@ static void test_mf_conversions(void)
hemf
=
create_converted_emf
(
NULL
);
if
(
compare_emf_bits
(
hemf
,
EMF_LINETO_BITS
,
sizeof
(
EMF_LINETO_BITS
),
"emf_LineTo NULL"
,
TRUE
,
TRU
E
)
!=
0
)
"emf_LineTo NULL"
,
TRUE
,
FALS
E
)
!=
0
)
{
dump_emf_bits
(
hemf
,
"emf_LineTo NULL"
);
dump_emf_records
(
hemf
,
"emf_LineTo NULL"
);
...
...
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