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
ff59c33d
Commit
ff59c33d
authored
Oct 24, 2000
by
Dmitry Timoshkov
Committed by
Alexandre Julliard
Oct 24, 2000
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make EnumEnhMetaFile work.
parent
1fc70a94
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
60 additions
and
13 deletions
+60
-13
enhmetafile.c
objects/enhmetafile.c
+60
-13
No files found.
objects/enhmetafile.c
View file @
ff59c33d
...
...
@@ -1207,25 +1207,51 @@ BOOL WINAPI EnumEnhMetaFile(
const
RECT
*
lpRect
/* bounding rectangle for rendered metafile */
)
{
BOOL
ret
=
TRUE
;
LPENHMETAHEADER
emh
=
EMF_GetEnhMetaHeader
(
hmf
);
INT
count
,
i
;
BOOL
ret
;
ENHMETAHEADER
*
emh
,
*
emhTemp
;
ENHMETARECORD
*
emr
;
DWORD
offset
;
INT
i
;
HANDLETABLE
*
ht
;
INT
savedMode
=
0
;
FLOAT
xSrcPixSize
,
ySrcPixSize
,
xscale
,
yscale
;
XFORM
savedXform
,
xform
;
HPEN
hPen
;
HBRUSH
hBrush
;
HFONT
hFont
;
if
(
!
lpRect
)
{
SetLastError
(
ERROR_INVALID_PARAMETER
);
return
FALSE
;
}
emh
=
EMF_GetEnhMetaHeader
(
hmf
);
if
(
!
emh
)
{
SetLastError
(
ERROR_INVALID_HANDLE
);
return
FALSE
;
}
if
(
!
lpRect
)
{
SetLastError
(
ERROR_INVALID_PARAMETER
);
/* Copy the metafile into memory, because we need to avoid deadlock. */
emhTemp
=
HeapAlloc
(
GetProcessHeap
(),
0
,
emh
->
nSize
+
emh
->
nBytes
);
if
(
!
emhTemp
)
{
EMF_ReleaseEnhMetaHeader
(
hmf
);
SetLastError
(
ERROR_NOT_ENOUGH_MEMORY
);
return
FALSE
;
}
count
=
emh
->
nHandles
;
memcpy
(
emhTemp
,
emh
,
emh
->
nSize
+
emh
->
nBytes
);
emh
=
emhTemp
;
EMF_ReleaseEnhMetaHeader
(
hmf
);
ht
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
HANDLETABLE
)
*
count
);
sizeof
(
HANDLETABLE
)
*
emh
->
nHandles
);
if
(
!
ht
)
{
HeapFree
(
GetProcessHeap
(),
0
,
emhTemp
);
SetLastError
(
ERROR_NOT_ENOUGH_MEMORY
);
return
FALSE
;
}
ht
->
objectHandle
[
0
]
=
hmf
;
xSrcPixSize
=
(
FLOAT
)
emh
->
szlMillimeters
.
cx
/
emh
->
szlDevice
.
cx
;
...
...
@@ -1250,18 +1276,39 @@ BOOL WINAPI EnumEnhMetaFile(
ERR
(
"World transform failed!
\n
"
);
}
while
(
ret
)
{
ret
=
(
*
callback
)(
hdc
,
ht
,
(
LPENHMETARECORD
)
emh
,
count
,
data
);
if
(
emh
->
iType
==
EMR_EOF
)
break
;
emh
=
(
LPENHMETAHEADER
)
((
char
*
)
emh
+
emh
->
nSize
);
/* save the current pen, brush and font */
hPen
=
GetCurrentObject
(
hdc
,
OBJ_PEN
);
hBrush
=
GetCurrentObject
(
hdc
,
OBJ_BRUSH
);
hFont
=
GetCurrentObject
(
hdc
,
OBJ_FONT
);
TRACE
(
"nSize = %ld, nBytes = %ld, nHandles = %d, nRecords = %ld, nPalEntries = %ld
\n
"
,
emh
->
nSize
,
emh
->
nBytes
,
emh
->
nHandles
,
emh
->
nRecords
,
emh
->
nPalEntries
);
ret
=
TRUE
;
offset
=
0
;
while
(
ret
&&
offset
<
emh
->
nBytes
)
{
emr
=
(
ENHMETARECORD
*
)((
char
*
)
emh
+
offset
);
TRACE
(
"Calling EnumFunc with record type %ld, size %ld
\n
"
,
emr
->
iType
,
emr
->
nSize
);
ret
=
(
*
callback
)(
hdc
,
ht
,
emr
,
emh
->
nRecords
,
data
);
offset
+=
emr
->
nSize
;
}
for
(
i
=
1
;
i
<
count
;
i
++
)
/* Don't delete element 0 (hmf) */
/* restore pen, brush and font */
SelectObject
(
hdc
,
hBrush
);
SelectObject
(
hdc
,
hPen
);
SelectObject
(
hdc
,
hFont
);
for
(
i
=
1
;
i
<
emh
->
nRecords
;
i
++
)
/* Don't delete element 0 (hmf) */
if
(
(
ht
->
objectHandle
)[
i
]
)
DeleteObject
(
(
ht
->
objectHandle
)[
i
]
);
HeapFree
(
GetProcessHeap
(),
0
,
ht
);
EMF_ReleaseEnhMetaHeader
(
hmf
);
HeapFree
(
GetProcessHeap
(),
0
,
emhTemp
);
SetWorldTransform
(
hdc
,
&
savedXform
);
if
(
savedMode
)
SetGraphicsMode
(
hdc
,
savedMode
);
return
ret
;
}
...
...
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