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
592533bd
Commit
592533bd
authored
Oct 30, 2015
by
Vincent Povirk
Committed by
Alexandre Julliard
Nov 01, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gdiplus: Use GdipGetMetafileHeaderFromEmf when opening metafiles.
Signed-off-by:
Vincent Povirk
<
vincent@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
1735a724
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
66 deletions
+24
-66
metafile.c
dlls/gdiplus/metafile.c
+14
-56
metafile.c
dlls/gdiplus/tests/metafile.c
+10
-10
No files found.
dlls/gdiplus/metafile.c
View file @
592533bd
...
...
@@ -887,46 +887,6 @@ GpStatus WINGDIPAPI GdipEnumerateMetafileDestPointI(GpGraphics *graphics,
return
GdipEnumerateMetafileDestPoint
(
graphics
,
metafile
,
&
ptf
,
callback
,
cb_data
,
attrs
);
}
static
int
CALLBACK
get_metafile_type_proc
(
HDC
hDC
,
HANDLETABLE
*
lpHTable
,
const
ENHMETARECORD
*
lpEMFR
,
int
nObj
,
LPARAM
lpData
)
{
MetafileType
*
result
=
(
MetafileType
*
)
lpData
;
if
(
lpEMFR
->
iType
==
EMR_GDICOMMENT
)
{
const
EMRGDICOMMENT
*
comment
=
(
const
EMRGDICOMMENT
*
)
lpEMFR
;
if
(
comment
->
cbData
>=
4
&&
memcmp
(
comment
->
Data
,
"EMF+"
,
4
)
==
0
)
{
const
EmfPlusRecordHeader
*
header
=
(
const
EmfPlusRecordHeader
*
)
&
comment
->
Data
[
4
];
if
(
4
+
sizeof
(
EmfPlusRecordHeader
)
<=
comment
->
cbData
&&
header
->
Type
==
EmfPlusRecordTypeHeader
)
{
if
((
header
->
Flags
&
1
)
==
1
)
*
result
=
MetafileTypeEmfPlusDual
;
else
*
result
=
MetafileTypeEmfPlusOnly
;
}
}
else
*
result
=
MetafileTypeEmf
;
}
else
if
(
lpEMFR
->
iType
==
EMR_HEADER
)
return
TRUE
;
else
*
result
=
MetafileTypeEmf
;
return
FALSE
;
}
static
MetafileType
METAFILE_GetEmfType
(
HENHMETAFILE
hemf
)
{
MetafileType
result
=
MetafileTypeInvalid
;
EnumEnhMetaFile
(
NULL
,
hemf
,
get_metafile_type_proc
,
&
result
,
NULL
);
return
result
;
}
GpStatus
WINGDIPAPI
GdipGetMetafileHeaderFromMetafile
(
GpMetafile
*
metafile
,
MetafileHeader
*
header
)
{
...
...
@@ -1069,21 +1029,17 @@ GpStatus WINGDIPAPI GdipGetMetafileHeaderFromStream(IStream *stream,
GpStatus
WINGDIPAPI
GdipCreateMetafileFromEmf
(
HENHMETAFILE
hemf
,
BOOL
delete
,
GpMetafile
**
metafile
)
{
ENHMETAHEADER
header
;
Metafile
Type
metafile_type
;
GpStatus
stat
;
Metafile
Header
header
;
TRACE
(
"(%p,%i,%p)
\n
"
,
hemf
,
delete
,
metafile
);
if
(
!
hemf
||
!
metafile
)
return
InvalidParameter
;
if
(
GetEnhMetaFileHeader
(
hemf
,
sizeof
(
header
),
&
header
)
==
0
)
return
GenericError
;
metafile_type
=
METAFILE_GetEmfType
(
hemf
);
if
(
metafile_type
==
MetafileTypeInvalid
)
return
GenericError
;
stat
=
GdipGetMetafileHeaderFromEmf
(
hemf
,
&
header
);
if
(
stat
!=
Ok
)
return
stat
;
*
metafile
=
heap_alloc_zero
(
sizeof
(
GpMetafile
));
if
(
!*
metafile
)
...
...
@@ -1092,14 +1048,16 @@ GpStatus WINGDIPAPI GdipCreateMetafileFromEmf(HENHMETAFILE hemf, BOOL delete,
(
*
metafile
)
->
image
.
type
=
ImageTypeMetafile
;
(
*
metafile
)
->
image
.
format
=
ImageFormatEMF
;
(
*
metafile
)
->
image
.
frame_count
=
1
;
(
*
metafile
)
->
image
.
xres
=
(
REAL
)
header
.
szlDevice
.
cx
;
(
*
metafile
)
->
image
.
yres
=
(
REAL
)
header
.
szlDevice
.
cy
;
(
*
metafile
)
->
bounds
.
X
=
(
REAL
)
header
.
rclBounds
.
left
;
(
*
metafile
)
->
bounds
.
Y
=
(
REAL
)
header
.
rclBounds
.
top
;
(
*
metafile
)
->
bounds
.
Width
=
(
REAL
)(
header
.
rclBounds
.
right
-
header
.
rclBounds
.
left
);
(
*
metafile
)
->
bounds
.
Height
=
(
REAL
)(
header
.
rclBounds
.
bottom
-
header
.
rclBounds
.
top
);
(
*
metafile
)
->
image
.
xres
=
header
.
DpiX
;
(
*
metafile
)
->
image
.
yres
=
header
.
DpiY
;
(
*
metafile
)
->
bounds
.
X
=
(
REAL
)
header
.
EmfHeader
.
rclFrame
.
left
/
2540
.
0
*
header
.
DpiX
;
(
*
metafile
)
->
bounds
.
Y
=
(
REAL
)
header
.
EmfHeader
.
rclFrame
.
top
/
2540
.
0
*
header
.
DpiY
;
(
*
metafile
)
->
bounds
.
Width
=
(
REAL
)(
header
.
EmfHeader
.
rclFrame
.
right
-
header
.
EmfHeader
.
rclFrame
.
left
)
/
2540
.
0
*
header
.
DpiX
;
(
*
metafile
)
->
bounds
.
Height
=
(
REAL
)(
header
.
EmfHeader
.
rclFrame
.
bottom
-
header
.
EmfHeader
.
rclFrame
.
top
)
/
2540
.
0
*
header
.
DpiY
;
(
*
metafile
)
->
unit
=
UnitPixel
;
(
*
metafile
)
->
metafile_type
=
metafile_t
ype
;
(
*
metafile
)
->
metafile_type
=
header
.
T
ype
;
(
*
metafile
)
->
hemf
=
hemf
;
(
*
metafile
)
->
preserve_hemf
=
!
delete
;
...
...
dlls/gdiplus/tests/metafile.c
View file @
592533bd
...
...
@@ -401,17 +401,17 @@ static void test_empty(void)
expect
(
Ok
,
stat
);
expectf
(
0
.
0
,
bounds
.
X
);
expectf
(
0
.
0
,
bounds
.
Y
);
todo_wine
expectf_
(
100
.
0
,
bounds
.
Width
,
0
.
05
);
todo_wine
expectf_
(
100
.
0
,
bounds
.
Height
,
0
.
05
);
expectf_
(
100
.
0
,
bounds
.
Width
,
0
.
05
);
expectf_
(
100
.
0
,
bounds
.
Height
,
0
.
05
);
expect
(
UnitPixel
,
unit
);
stat
=
GdipGetImageHorizontalResolution
((
GpImage
*
)
metafile
,
&
xres
);
expect
(
Ok
,
stat
);
todo_wine
expectf
(
header
.
DpiX
,
xres
);
expectf
(
header
.
DpiX
,
xres
);
stat
=
GdipGetImageVerticalResolution
((
GpImage
*
)
metafile
,
&
yres
);
expect
(
Ok
,
stat
);
todo_wine
expectf
(
header
.
DpiY
,
yres
);
expectf
(
header
.
DpiY
,
yres
);
stat
=
GdipDisposeImage
((
GpImage
*
)
metafile
);
expect
(
Ok
,
stat
);
...
...
@@ -746,19 +746,19 @@ static void test_emfonly(void)
stat
=
GdipGetImageBounds
((
GpImage
*
)
metafile
,
&
bounds
,
&
unit
);
expect
(
Ok
,
stat
);
todo_wine
expectf
(
0
.
0
,
bounds
.
X
);
todo_wine
expectf
(
0
.
0
,
bounds
.
Y
);
todo_wine
expectf_
(
100
.
0
,
bounds
.
Width
,
0
.
05
);
todo_wine
expectf_
(
100
.
0
,
bounds
.
Height
,
0
.
05
);
expectf
(
0
.
0
,
bounds
.
X
);
expectf
(
0
.
0
,
bounds
.
Y
);
expectf_
(
100
.
0
,
bounds
.
Width
,
0
.
05
);
expectf_
(
100
.
0
,
bounds
.
Height
,
0
.
05
);
expect
(
UnitPixel
,
unit
);
stat
=
GdipGetImageHorizontalResolution
((
GpImage
*
)
metafile
,
&
xres
);
expect
(
Ok
,
stat
);
todo_wine
expectf
(
header
.
DpiX
,
xres
);
expectf
(
header
.
DpiX
,
xres
);
stat
=
GdipGetImageVerticalResolution
((
GpImage
*
)
metafile
,
&
yres
);
expect
(
Ok
,
stat
);
todo_wine
expectf
(
header
.
DpiY
,
yres
);
expectf
(
header
.
DpiY
,
yres
);
stat
=
GdipDisposeImage
((
GpImage
*
)
metafile
);
expect
(
Ok
,
stat
);
...
...
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