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
7698b636
Commit
7698b636
authored
Nov 22, 2011
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gdi32: Add helper functions for allocating and freeing paths.
parent
26b1bfa5
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
21 deletions
+39
-21
gdi_private.h
dlls/gdi32/gdi_private.h
+1
-1
path.c
dlls/gdi32/path.c
+38
-20
No files found.
dlls/gdi32/gdi_private.h
View file @
7698b636
...
...
@@ -84,7 +84,7 @@ typedef enum tagGdiPathState
PATH_Closed
}
GdiPathState
;
typedef
struct
tagGdiP
ath
typedef
struct
gdi_p
ath
{
GdiPathState
state
;
POINT
*
pPoints
;
...
...
dlls/gdi32/path.c
View file @
7698b636
...
...
@@ -100,6 +100,36 @@ static inline void pop_path_driver( DC *dc )
HeapFree
(
GetProcessHeap
(),
0
,
dev
);
}
static
void
free_gdi_path
(
struct
gdi_path
*
path
)
{
HeapFree
(
GetProcessHeap
(),
0
,
path
->
pPoints
);
HeapFree
(
GetProcessHeap
(),
0
,
path
->
pFlags
);
HeapFree
(
GetProcessHeap
(),
0
,
path
);
}
static
struct
gdi_path
*
alloc_gdi_path
(
void
)
{
struct
gdi_path
*
path
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
*
path
)
);
if
(
!
path
)
{
SetLastError
(
ERROR_NOT_ENOUGH_MEMORY
);
return
NULL
;
}
path
->
pPoints
=
HeapAlloc
(
GetProcessHeap
(),
0
,
NUM_ENTRIES_INITIAL
*
sizeof
(
*
path
->
pPoints
)
);
path
->
pFlags
=
HeapAlloc
(
GetProcessHeap
(),
0
,
NUM_ENTRIES_INITIAL
*
sizeof
(
*
path
->
pFlags
)
);
if
(
!
path
->
pPoints
||
!
path
->
pFlags
)
{
free_gdi_path
(
path
);
SetLastError
(
ERROR_NOT_ENOUGH_MEMORY
);
return
NULL
;
}
path
->
state
=
PATH_Open
;
path
->
numEntriesUsed
=
0
;
path
->
numEntriesAllocated
=
NUM_ENTRIES_INITIAL
;
path
->
newStroke
=
TRUE
;
return
path
;
}
/* Performs a world-to-viewport transformation on the specified point (which
* is in floating point format).
...
...
@@ -1808,9 +1838,7 @@ static BOOL PATH_WidenPath(DC *dc)
else
pStrokes
=
HeapReAlloc
(
GetProcessHeap
(),
0
,
pStrokes
,
numStrokes
*
sizeof
(
GdiPath
*
));
if
(
!
pStrokes
)
return
FALSE
;
pStrokes
[
numStrokes
-
1
]
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
GdiPath
));
PATH_InitGdiPath
(
pStrokes
[
numStrokes
-
1
]);
pStrokes
[
numStrokes
-
1
]
->
state
=
PATH_Open
;
pStrokes
[
numStrokes
-
1
]
=
alloc_gdi_path
();
/* fall through */
case
PT_LINETO
:
case
(
PT_LINETO
|
PT_CLOSEFIGURE
):
...
...
@@ -1828,17 +1856,11 @@ static BOOL PATH_WidenPath(DC *dc)
}
}
pNewPath
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
GdiPath
));
PATH_InitGdiPath
(
pNewPath
);
pNewPath
->
state
=
PATH_Open
;
pNewPath
=
alloc_gdi_path
();
for
(
i
=
0
;
i
<
numStrokes
;
i
++
)
{
pUpPath
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
GdiPath
));
PATH_InitGdiPath
(
pUpPath
);
pUpPath
->
state
=
PATH_Open
;
pDownPath
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
GdiPath
));
PATH_InitGdiPath
(
pDownPath
);
pDownPath
->
state
=
PATH_Open
;
pUpPath
=
alloc_gdi_path
();
pDownPath
=
alloc_gdi_path
();
for
(
j
=
0
;
j
<
pStrokes
[
i
]
->
numEntriesUsed
;
j
++
)
{
/* Beginning or end of the path if not closed */
...
...
@@ -2022,20 +2044,16 @@ static BOOL PATH_WidenPath(DC *dc)
PATH_AddEntry
(
pNewPath
,
&
pt
,
(
(
j
==
0
&&
(
pStrokes
[
i
]
->
pFlags
[
pStrokes
[
i
]
->
numEntriesUsed
-
1
]
&
PT_CLOSEFIGURE
))
?
PT_MOVETO
:
PT_LINETO
));
}
PATH_DestroyGdiPath
(
pStrokes
[
i
]);
HeapFree
(
GetProcessHeap
(),
0
,
pStrokes
[
i
]);
PATH_DestroyGdiPath
(
pUpPath
);
HeapFree
(
GetProcessHeap
(),
0
,
pUpPath
);
PATH_DestroyGdiPath
(
pDownPath
);
HeapFree
(
GetProcessHeap
(),
0
,
pDownPath
);
free_gdi_path
(
pStrokes
[
i
]
);
free_gdi_path
(
pUpPath
);
free_gdi_path
(
pDownPath
);
}
HeapFree
(
GetProcessHeap
(),
0
,
pStrokes
);
pNewPath
->
state
=
PATH_Closed
;
if
(
!
(
ret
=
PATH_AssignGdiPath
(
pPath
,
pNewPath
)))
ERR
(
"Assign path failed
\n
"
);
PATH_DestroyGdiPath
(
pNewPath
);
HeapFree
(
GetProcessHeap
(),
0
,
pNewPath
);
free_gdi_path
(
pNewPath
);
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