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
8b837bf8
Commit
8b837bf8
authored
May 02, 2007
by
Laurent Vromman
Committed by
Alexandre Julliard
May 02, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gdi32: Complete WidenPath implementation.
WidenPath now recognizes PS_JOINs and PS_ENCDAPs.
parent
150608ab
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
232 additions
and
68 deletions
+232
-68
path.c
dlls/gdi32/path.c
+232
-68
No files found.
dlls/gdi32/path.c
View file @
8b837bf8
...
@@ -1767,14 +1767,15 @@ static BOOL PATH_StrokePath(DC *dc, GdiPath *pPath)
...
@@ -1767,14 +1767,15 @@ static BOOL PATH_StrokePath(DC *dc, GdiPath *pPath)
return
ret
;
return
ret
;
}
}
#define round(x) ((int)((x)>0?(x)+0.5:(x)-0.5))
static
BOOL
PATH_WidenPath
(
DC
*
dc
)
static
BOOL
PATH_WidenPath
(
DC
*
dc
)
{
{
INT
i
,
j
,
numStrokes
,
nLinePts
,
penWidth
,
penWidthIn
,
penWidthOut
,
size
;
INT
i
,
j
,
numStrokes
,
nLinePts
,
penWidth
,
penWidthIn
,
penWidthOut
,
size
,
penStyle
;
BOOL
ret
=
FALSE
;
BOOL
ret
=
FALSE
;
GdiPath
*
pPath
,
*
pNewPath
,
**
pStrokes
,
*
pUpPath
,
*
pDownPath
;
GdiPath
*
pPath
,
*
pNewPath
,
**
pStrokes
,
*
pUpPath
,
*
pDownPath
;
EXTLOGPEN
*
elp
;
EXTLOGPEN
*
elp
;
FLOAT
fCos
,
fSin
,
nPent
e
;
DWORD
obj_type
,
joint
,
endcap
,
penTyp
e
;
pPath
=
&
dc
->
path
;
pPath
=
&
dc
->
path
;
...
@@ -1786,21 +1787,45 @@ static BOOL PATH_WidenPath(DC *dc)
...
@@ -1786,21 +1787,45 @@ static BOOL PATH_WidenPath(DC *dc)
PATH_FlattenPath
(
pPath
);
PATH_FlattenPath
(
pPath
);
size
=
GetObjectW
(
dc
->
hPen
,
0
,
NULL
);
size
=
GetObjectW
(
dc
->
hPen
,
0
,
NULL
);
if
(
!
size
)
return
FALSE
;
if
(
!
size
)
{
SetLastError
(
ERROR_CAN_NOT_COMPLETE
);
return
FALSE
;
}
elp
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
);
elp
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
);
GetObjectW
(
dc
->
hPen
,
size
,
elp
);
GetObjectW
(
dc
->
hPen
,
size
,
elp
);
/* FIXME: add support for user style pens */
obj_type
=
GetObjectType
(
dc
->
hPen
);
if
(
obj_type
==
OBJ_PEN
)
{
penStyle
=
((
LOGPEN
*
)
elp
)
->
lopnStyle
;
}
else
if
(
obj_type
==
OBJ_EXTPEN
)
{
penStyle
=
elp
->
elpPenStyle
;
}
else
{
SetLastError
(
ERROR_CAN_NOT_COMPLETE
);
HeapFree
(
GetProcessHeap
(),
0
,
elp
);
return
FALSE
;
}
penWidth
=
elp
->
elpWidth
;
penWidth
=
elp
->
elpWidth
;
HeapFree
(
GetProcessHeap
(),
0
,
elp
);
HeapFree
(
GetProcessHeap
(),
0
,
elp
);
endcap
=
(
PS_ENDCAP_MASK
&
penStyle
);
joint
=
(
PS_JOIN_MASK
&
penStyle
);
penType
=
(
PS_TYPE_MASK
&
penStyle
);
/* The function cannot apply to cosmetic pens */
if
(
obj_type
==
OBJ_EXTPEN
&&
penType
==
PS_COSMETIC
)
{
SetLastError
(
ERROR_CAN_NOT_COMPLETE
);
return
FALSE
;
}
/* pen width must be strictly higher than 1 */
/* pen width must be strictly higher than 1 */
if
(
penWidth
==
1
)
{
if
(
penWidth
==
1
)
{
return
TRUE
;
return
TRUE
;
}
}
/* FIXME : If extPen, use the shape on corners */
penWidthIn
=
penWidth
/
2
;
penWidthIn
=
penWidth
/
2
;
penWidthOut
=
penWidth
/
2
;
penWidthOut
=
penWidth
/
2
;
if
(
penWidthIn
+
penWidthOut
<
penWidth
)
if
(
penWidthIn
+
penWidthOut
<
penWidth
)
...
@@ -1817,6 +1842,7 @@ static BOOL PATH_WidenPath(DC *dc)
...
@@ -1817,6 +1842,7 @@ static BOOL PATH_WidenPath(DC *dc)
pStrokes
[
0
]
->
numEntriesUsed
=
0
;
pStrokes
[
0
]
->
numEntriesUsed
=
0
;
for
(
i
=
0
,
j
=
0
;
i
<
pPath
->
numEntriesUsed
;
i
++
,
j
++
)
{
for
(
i
=
0
,
j
=
0
;
i
<
pPath
->
numEntriesUsed
;
i
++
,
j
++
)
{
POINT
point
;
if
((
i
==
0
||
(
pPath
->
pFlags
[
i
-
1
]
&
PT_CLOSEFIGURE
))
&&
if
((
i
==
0
||
(
pPath
->
pFlags
[
i
-
1
]
&
PT_CLOSEFIGURE
))
&&
(
pPath
->
pFlags
[
i
]
!=
PT_MOVETO
))
{
(
pPath
->
pFlags
[
i
]
!=
PT_MOVETO
))
{
ERR
(
"Expected PT_MOVETO %s, got path flag %c
\n
"
,
ERR
(
"Expected PT_MOVETO %s, got path flag %c
\n
"
,
...
@@ -1826,27 +1852,20 @@ static BOOL PATH_WidenPath(DC *dc)
...
@@ -1826,27 +1852,20 @@ static BOOL PATH_WidenPath(DC *dc)
}
}
switch
(
pPath
->
pFlags
[
i
])
{
switch
(
pPath
->
pFlags
[
i
])
{
case
PT_MOVETO
:
case
PT_MOVETO
:
if
(
numStrokes
>
0
)
{
pStrokes
[
numStrokes
-
1
]
->
state
=
PATH_Closed
;
}
numStrokes
++
;
numStrokes
++
;
j
=
0
;
j
=
0
;
pStrokes
=
HeapReAlloc
(
GetProcessHeap
(),
0
,
pStrokes
,
numStrokes
*
sizeof
(
GdiPath
*
));
pStrokes
=
HeapReAlloc
(
GetProcessHeap
(),
0
,
pStrokes
,
numStrokes
*
sizeof
(
GdiPath
*
));
pStrokes
[
numStrokes
-
1
]
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
GdiPath
));
pStrokes
[
numStrokes
-
1
]
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
GdiPath
));
PATH_InitGdiPath
(
pStrokes
[
numStrokes
-
1
]);
PATH_InitGdiPath
(
pStrokes
[
numStrokes
-
1
]);
pStrokes
[
numStrokes
-
1
]
->
pFlags
=
HeapAlloc
(
GetProcessHeap
(),
0
,
pPath
->
numEntriesUsed
*
sizeof
(
INT
));
pStrokes
[
numStrokes
-
1
]
->
state
=
PATH_Open
;
pStrokes
[
numStrokes
-
1
]
->
pPoints
=
HeapAlloc
(
GetProcessHeap
(),
0
,
pPath
->
numEntriesUsed
*
sizeof
(
POINT
));
pStrokes
[
numStrokes
-
1
]
->
numEntriesUsed
=
0
;
pStrokes
[
numStrokes
-
1
]
->
pFlags
[
j
]
=
pPath
->
pFlags
[
i
];
pStrokes
[
numStrokes
-
1
]
->
pPoints
[
j
].
x
=
pPath
->
pPoints
[
i
].
x
;
pStrokes
[
numStrokes
-
1
]
->
pPoints
[
j
].
y
=
pPath
->
pPoints
[
i
].
y
;
pStrokes
[
numStrokes
-
1
]
->
numEntriesUsed
++
;
break
;
case
PT_LINETO
:
case
PT_LINETO
:
case
(
PT_LINETO
|
PT_CLOSEFIGURE
):
case
(
PT_LINETO
|
PT_CLOSEFIGURE
):
pStrokes
[
numStrokes
-
1
]
->
pFlags
[
j
]
=
pPath
->
pFlags
[
i
];
point
.
x
=
pPath
->
pPoints
[
i
].
x
;
pStrokes
[
numStrokes
-
1
]
->
pPoints
[
j
].
x
=
pPath
->
pPoints
[
i
].
x
;
point
.
y
=
pPath
->
pPoints
[
i
].
y
;
pStrokes
[
numStrokes
-
1
]
->
pPoints
[
j
].
y
=
pPath
->
pPoints
[
i
].
y
;
PATH_AddEntry
(
pStrokes
[
numStrokes
-
1
],
&
point
,
pPath
->
pFlags
[
i
]);
pStrokes
[
numStrokes
-
1
]
->
numEntriesUsed
++
;
break
;
break
;
case
PT_BEZIERTO
:
case
PT_BEZIERTO
:
/* should never happen because of the FlattenPath call */
/* should never happen because of the FlattenPath call */
...
@@ -1860,65 +1879,211 @@ static BOOL PATH_WidenPath(DC *dc)
...
@@ -1860,65 +1879,211 @@ static BOOL PATH_WidenPath(DC *dc)
pNewPath
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
GdiPath
));
pNewPath
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
GdiPath
));
PATH_InitGdiPath
(
pNewPath
);
PATH_InitGdiPath
(
pNewPath
);
pNewPath
->
pFlags
=
HeapAlloc
(
GetProcessHeap
(),
0
,
4
*
pPath
->
numEntriesUsed
*
sizeof
(
INT
));
pNewPath
->
state
=
PATH_Open
;
pNewPath
->
pPoints
=
HeapAlloc
(
GetProcessHeap
(),
0
,
4
*
pPath
->
numEntriesUsed
*
sizeof
(
POINT
));
pNewPath
->
numEntriesUsed
=
0
;
pNewPath
->
numEntriesAllocated
=
4
*
pPath
->
numEntriesUsed
;
for
(
i
=
0
;
i
<
numStrokes
;
i
++
)
{
for
(
i
=
0
;
i
<
numStrokes
;
i
++
)
{
pUpPath
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
GdiPath
));
pUpPath
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
GdiPath
));
PATH_InitGdiPath
(
pUpPath
);
PATH_InitGdiPath
(
pUpPath
);
pUpPath
->
pFlags
=
HeapAlloc
(
GetProcessHeap
(),
0
,
2
*
pStrokes
[
i
]
->
numEntriesUsed
*
sizeof
(
INT
));
pUpPath
->
state
=
PATH_Open
;
pUpPath
->
pPoints
=
HeapAlloc
(
GetProcessHeap
(),
0
,
2
*
pStrokes
[
i
]
->
numEntriesUsed
*
sizeof
(
POINT
));
pUpPath
->
numEntriesUsed
=
0
;
pDownPath
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
GdiPath
));
pDownPath
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
GdiPath
));
PATH_InitGdiPath
(
pDownPath
);
PATH_InitGdiPath
(
pDownPath
);
pDownPath
->
pFlags
=
HeapAlloc
(
GetProcessHeap
(),
0
,
2
*
pStrokes
[
i
]
->
numEntriesUsed
*
sizeof
(
INT
));
pDownPath
->
state
=
PATH_Open
;
pDownPath
->
pPoints
=
HeapAlloc
(
GetProcessHeap
(),
0
,
2
*
pStrokes
[
i
]
->
numEntriesUsed
*
sizeof
(
POINT
));
pDownPath
->
numEntriesUsed
=
0
;
for
(
j
=
0
;
j
<
pStrokes
[
i
]
->
numEntriesUsed
;
j
++
)
{
for
(
j
=
0
;
j
<
pStrokes
[
i
]
->
numEntriesUsed
-
1
;
j
++
)
{
/* Beginning or end of the path if not closed */
if
(
pStrokes
[
i
]
->
pPoints
[
j
+
1
].
x
!=
pStrokes
[
i
]
->
pPoints
[
j
].
x
)
{
if
((
!
(
pStrokes
[
i
]
->
pFlags
[
pStrokes
[
i
]
->
numEntriesUsed
-
1
]
&
PT_CLOSEFIGURE
))
&&
(
j
==
0
||
j
==
pStrokes
[
i
]
->
numEntriesUsed
-
1
)
)
{
nPente
=
(
pStrokes
[
i
]
->
pPoints
[
j
+
1
].
y
-
pStrokes
[
i
]
->
pPoints
[
j
].
y
)
/
(
pStrokes
[
i
]
->
pPoints
[
j
+
1
].
x
-
pStrokes
[
i
]
->
pPoints
[
j
].
x
);
/* Compute segment angle */
fCos
=
cos
(
atan
(
nPente
));
FLOAT
xo
,
yo
,
xa
,
ya
;
fSin
=
sin
(
atan
(
nPente
));
POINT
pt
;
}
FLOAT
theta
,
scalarProduct
;
else
if
(
pStrokes
[
i
]
->
pPoints
[
j
+
1
].
y
>
pStrokes
[
i
]
->
pPoints
[
j
].
y
)
{
FLOAT_POINT
corners
[
2
];
fCos
=
0
;
if
(
j
==
0
)
{
fSin
=
-
1
;
xo
=
pStrokes
[
i
]
->
pPoints
[
j
].
x
;
yo
=
pStrokes
[
i
]
->
pPoints
[
j
].
y
;
xa
=
pStrokes
[
i
]
->
pPoints
[
1
].
x
;
ya
=
pStrokes
[
i
]
->
pPoints
[
1
].
y
;
}
else
{
xa
=
pStrokes
[
i
]
->
pPoints
[
j
-
1
].
x
;
ya
=
pStrokes
[
i
]
->
pPoints
[
j
-
1
].
y
;
xo
=
pStrokes
[
i
]
->
pPoints
[
j
].
x
;
yo
=
pStrokes
[
i
]
->
pPoints
[
j
].
y
;
}
scalarProduct
=
(
xa
-
xo
)
/
sqrt
(
pow
((
xa
-
xo
),
2
)
+
pow
((
ya
-
yo
),
2
));
theta
=
acos
(
scalarProduct
);
if
(
(
ya
-
yo
)
<
0
)
{
theta
=
-
theta
;
}
switch
(
endcap
)
{
case
PS_ENDCAP_SQUARE
:
pt
.
x
=
xo
+
round
(
sqrt
(
2
)
*
penWidthOut
*
cos
(
M_PI_4
+
theta
));
pt
.
y
=
yo
+
round
(
sqrt
(
2
)
*
penWidthOut
*
sin
(
M_PI_4
+
theta
));
PATH_AddEntry
(
pUpPath
,
&
pt
,
(
j
==
0
?
PT_MOVETO
:
PT_LINETO
)
);
pt
.
x
=
xo
+
round
(
sqrt
(
2
)
*
penWidthIn
*
cos
(
-
M_PI_4
+
theta
));
pt
.
y
=
yo
+
round
(
sqrt
(
2
)
*
penWidthIn
*
sin
(
-
M_PI_4
+
theta
));
PATH_AddEntry
(
pUpPath
,
&
pt
,
PT_LINETO
);
break
;
case
PS_ENDCAP_FLAT
:
pt
.
x
=
xo
+
round
(
penWidthOut
*
cos
(
theta
+
M_PI_2
)
);
pt
.
y
=
yo
+
round
(
penWidthOut
*
sin
(
theta
+
M_PI_2
)
);
PATH_AddEntry
(
pUpPath
,
&
pt
,
(
j
==
0
?
PT_MOVETO
:
PT_LINETO
));
pt
.
x
=
xo
-
round
(
penWidthIn
*
cos
(
theta
+
M_PI_2
)
);
pt
.
y
=
yo
-
round
(
penWidthIn
*
sin
(
theta
+
M_PI_2
)
);
PATH_AddEntry
(
pUpPath
,
&
pt
,
PT_LINETO
);
break
;
case
PS_ENDCAP_ROUND
:
default
:
corners
[
0
].
x
=
xo
-
penWidthIn
;
corners
[
0
].
y
=
yo
-
penWidthIn
;
corners
[
1
].
x
=
xo
+
penWidthOut
;
corners
[
1
].
y
=
yo
+
penWidthOut
;
PATH_DoArcPart
(
pUpPath
,
corners
,
theta
+
M_PI_2
,
theta
+
3
*
M_PI_4
,
(
j
==
0
?
TRUE
:
FALSE
));
PATH_DoArcPart
(
pUpPath
,
corners
,
theta
+
3
*
M_PI_4
,
theta
+
M_PI
,
FALSE
);
PATH_DoArcPart
(
pUpPath
,
corners
,
theta
+
M_PI
,
theta
+
5
*
M_PI_4
,
FALSE
);
PATH_DoArcPart
(
pUpPath
,
corners
,
theta
+
5
*
M_PI_4
,
theta
+
3
*
M_PI_2
,
FALSE
);
break
;
}
}
}
/* Corpse of the path */
else
{
else
{
fCos
=
0
;
/* Compute angle */
fSin
=
1
;
INT
previous
,
next
;
FLOAT
xa
,
ya
,
xb
,
yb
,
xo
,
yo
;
FLOAT
alpha
,
theta
;
FLOAT
scalarProduct
,
oa
,
ob
,
miterWidth
;
DWORD
_joint
=
joint
;
POINT
pt
;
GdiPath
*
pInsidePath
,
*
pOutsidePath
;
if
(
j
>
0
&&
j
<
pStrokes
[
i
]
->
numEntriesUsed
-
1
)
{
previous
=
j
-
1
;
next
=
j
+
1
;
}
else
if
(
j
==
0
)
{
previous
=
pStrokes
[
i
]
->
numEntriesUsed
-
1
;
next
=
j
+
1
;
}
else
{
previous
=
j
-
1
;
next
=
0
;
}
xo
=
pStrokes
[
i
]
->
pPoints
[
j
].
x
;
yo
=
pStrokes
[
i
]
->
pPoints
[
j
].
y
;
xa
=
pStrokes
[
i
]
->
pPoints
[
previous
].
x
;
ya
=
pStrokes
[
i
]
->
pPoints
[
previous
].
y
;
xb
=
pStrokes
[
i
]
->
pPoints
[
next
].
x
;
yb
=
pStrokes
[
i
]
->
pPoints
[
next
].
y
;
oa
=
sqrt
(
pow
((
xa
-
xo
),
2
)
+
pow
((
ya
-
yo
),
2
));
ob
=
sqrt
(
pow
((
xb
-
xo
),
2
)
+
pow
((
yb
-
yo
),
2
));
scalarProduct
=
((
xa
-
xo
)
*
(
xb
-
xo
)
+
(
ya
-
yo
)
*
(
yb
-
yo
))
/
(
oa
*
ob
);
alpha
=
acos
(
scalarProduct
);
if
((
(
xa
-
xo
)
*
(
yb
-
yo
)
-
(
ya
-
yo
)
*
(
xb
-
xo
)
)
<
0
)
{
alpha
=
-
alpha
;
}
scalarProduct
=
(
xo
-
xa
)
/
oa
;
theta
=
acos
(
scalarProduct
);
if
(
(
yo
-
ya
)
<
0
)
{
theta
=
-
theta
;
}
if
(
_joint
==
PS_JOIN_MITER
&&
dc
->
miterLimit
<
fabs
(
1
/
sin
(
alpha
/
2
)))
{
_joint
=
PS_JOIN_BEVEL
;
}
if
(
alpha
>
0
)
{
pInsidePath
=
pUpPath
;
pOutsidePath
=
pDownPath
;
}
else
if
(
alpha
<
0
)
{
pInsidePath
=
pDownPath
;
pOutsidePath
=
pUpPath
;
}
else
{
continue
;
}
/* Inside angle points */
if
(
alpha
>
0
)
{
pt
.
x
=
xo
-
round
(
penWidthIn
*
cos
(
theta
+
M_PI_2
)
);
pt
.
y
=
yo
-
round
(
penWidthIn
*
sin
(
theta
+
M_PI_2
)
);
}
else
{
pt
.
x
=
xo
+
round
(
penWidthIn
*
cos
(
theta
+
M_PI_2
)
);
pt
.
y
=
yo
+
round
(
penWidthIn
*
sin
(
theta
+
M_PI_2
)
);
}
PATH_AddEntry
(
pInsidePath
,
&
pt
,
PT_LINETO
);
if
(
alpha
>
0
)
{
pt
.
x
=
xo
+
round
(
penWidthIn
*
cos
(
M_PI_2
+
alpha
+
theta
)
);
pt
.
y
=
yo
+
round
(
penWidthIn
*
sin
(
M_PI_2
+
alpha
+
theta
)
);
}
else
{
pt
.
x
=
xo
-
round
(
penWidthIn
*
cos
(
M_PI_2
+
alpha
+
theta
)
);
pt
.
y
=
yo
-
round
(
penWidthIn
*
sin
(
M_PI_2
+
alpha
+
theta
)
);
}
PATH_AddEntry
(
pInsidePath
,
&
pt
,
PT_LINETO
);
/* Outside angle point */
switch
(
_joint
)
{
case
PS_JOIN_MITER
:
miterWidth
=
fabs
(
penWidthOut
/
cos
(
M_PI_2
-
fabs
(
alpha
)
/
2
));
pt
.
x
=
xo
+
round
(
miterWidth
*
cos
(
theta
+
alpha
/
2
)
);
pt
.
y
=
yo
+
round
(
miterWidth
*
sin
(
theta
+
alpha
/
2
)
);
PATH_AddEntry
(
pOutsidePath
,
&
pt
,
PT_LINETO
);
break
;
case
PS_JOIN_BEVEL
:
if
(
alpha
>
0
)
{
pt
.
x
=
xo
+
round
(
penWidthOut
*
cos
(
theta
+
M_PI_2
)
);
pt
.
y
=
yo
+
round
(
penWidthOut
*
sin
(
theta
+
M_PI_2
)
);
}
else
{
pt
.
x
=
xo
-
round
(
penWidthOut
*
cos
(
theta
+
M_PI_2
)
);
pt
.
y
=
yo
-
round
(
penWidthOut
*
sin
(
theta
+
M_PI_2
)
);
}
PATH_AddEntry
(
pOutsidePath
,
&
pt
,
PT_LINETO
);
if
(
alpha
>
0
)
{
pt
.
x
=
xo
-
round
(
penWidthOut
*
cos
(
M_PI_2
+
alpha
+
theta
)
);
pt
.
y
=
yo
-
round
(
penWidthOut
*
sin
(
M_PI_2
+
alpha
+
theta
)
);
}
else
{
pt
.
x
=
xo
+
round
(
penWidthOut
*
cos
(
M_PI_2
+
alpha
+
theta
)
);
pt
.
y
=
yo
+
round
(
penWidthOut
*
sin
(
M_PI_2
+
alpha
+
theta
)
);
}
PATH_AddEntry
(
pOutsidePath
,
&
pt
,
PT_LINETO
);
break
;
case
PS_JOIN_ROUND
:
default
:
if
(
alpha
>
0
)
{
pt
.
x
=
xo
+
round
(
penWidthOut
*
cos
(
theta
+
M_PI_2
)
);
pt
.
y
=
yo
+
round
(
penWidthOut
*
sin
(
theta
+
M_PI_2
)
);
}
else
{
pt
.
x
=
xo
-
round
(
penWidthOut
*
cos
(
theta
+
M_PI_2
)
);
pt
.
y
=
yo
-
round
(
penWidthOut
*
sin
(
theta
+
M_PI_2
)
);
}
PATH_AddEntry
(
pOutsidePath
,
&
pt
,
PT_BEZIERTO
);
pt
.
x
=
xo
+
round
(
penWidthOut
*
cos
(
theta
+
alpha
/
2
)
);
pt
.
y
=
yo
+
round
(
penWidthOut
*
sin
(
theta
+
alpha
/
2
)
);
PATH_AddEntry
(
pOutsidePath
,
&
pt
,
PT_BEZIERTO
);
if
(
alpha
>
0
)
{
pt
.
x
=
xo
-
round
(
penWidthOut
*
cos
(
M_PI_2
+
alpha
+
theta
)
);
pt
.
y
=
yo
-
round
(
penWidthOut
*
sin
(
M_PI_2
+
alpha
+
theta
)
);
}
else
{
pt
.
x
=
xo
+
round
(
penWidthOut
*
cos
(
M_PI_2
+
alpha
+
theta
)
);
pt
.
y
=
yo
+
round
(
penWidthOut
*
sin
(
M_PI_2
+
alpha
+
theta
)
);
}
PATH_AddEntry
(
pOutsidePath
,
&
pt
,
PT_BEZIERTO
);
break
;
}
}
}
/* FIXME : Improve corners */
pUpPath
->
pPoints
[
2
*
j
].
x
=
pStrokes
[
i
]
->
pPoints
[
j
].
x
+
penWidthOut
*
fSin
;
pUpPath
->
pPoints
[
2
*
j
].
y
=
pStrokes
[
i
]
->
pPoints
[
j
].
y
+
penWidthOut
*
fCos
;
pUpPath
->
pFlags
[
2
*
j
]
=
pStrokes
[
i
]
->
pFlags
[
j
];
pUpPath
->
pPoints
[
2
*
j
+
1
]
.
x
=
pStrokes
[
i
]
->
pPoints
[
j
+
1
].
x
+
penWidthOut
*
fSin
;
pUpPath
->
pPoints
[
2
*
j
+
1
]
.
y
=
pStrokes
[
i
]
->
pPoints
[
j
+
1
].
y
+
penWidthOut
*
fCos
;
pUpPath
->
pFlags
[
2
*
j
+
1
]
=
PT_LINETO
;
pUpPath
->
numEntriesUsed
=
pUpPath
->
numEntriesUsed
+
2
;
pDownPath
->
pPoints
[
2
*
j
].
x
=
pStrokes
[
i
]
->
pPoints
[
j
].
x
-
penWidthIn
*
fSin
;
pDownPath
->
pPoints
[
2
*
j
].
y
=
pStrokes
[
i
]
->
pPoints
[
j
].
y
-
penWidthIn
*
fCos
;
pDownPath
->
pFlags
[
2
*
j
]
=
PT_LINETO
;
pDownPath
->
pPoints
[
2
*
j
+
1
]
.
x
=
pStrokes
[
i
]
->
pPoints
[
j
+
1
].
x
-
penWidthIn
*
fSin
;
pDownPath
->
pPoints
[
2
*
j
+
1
]
.
y
=
pStrokes
[
i
]
->
pPoints
[
j
+
1
].
y
-
penWidthIn
*
fCos
;
pDownPath
->
pFlags
[
2
*
j
+
1
]
=
PT_LINETO
;
pDownPath
->
numEntriesUsed
=
pUpPath
->
numEntriesUsed
;
}
}
for
(
j
=
0
;
j
<
pUpPath
->
numEntriesUsed
;
j
++
)
{
for
(
j
=
0
;
j
<
pUpPath
->
numEntriesUsed
;
j
++
)
{
pNewPath
->
pPoints
[
pNewPath
->
numEntriesUsed
+
j
].
x
=
pUpPath
->
pPoints
[
j
].
x
;
POINT
pt
;
pNewPath
->
pPoints
[
pNewPath
->
numEntriesUsed
+
j
].
y
=
pUpPath
->
pPoints
[
j
].
y
;
pt
.
x
=
pUpPath
->
pPoints
[
j
].
x
;
pNewPath
->
pFlags
[
pNewPath
->
numEntriesUsed
+
j
]
=
pUpPath
->
pFlags
[
j
];
pt
.
y
=
pUpPath
->
pPoints
[
j
].
y
;
pNewPath
->
pPoints
[
pNewPath
->
numEntriesUsed
+
pUpPath
->
numEntriesUsed
+
j
].
x
=
pDownPath
->
pPoints
[
pUpPath
->
numEntriesUsed
-
j
-
1
].
x
;
PATH_AddEntry
(
pNewPath
,
&
pt
,
(
j
==
0
?
PT_MOVETO
:
PT_LINETO
));
pNewPath
->
pPoints
[
pNewPath
->
numEntriesUsed
+
pUpPath
->
numEntriesUsed
+
j
].
y
=
pDownPath
->
pPoints
[
pUpPath
->
numEntriesUsed
-
j
-
1
].
y
;
}
pNewPath
->
pFlags
[
pNewPath
->
numEntriesUsed
+
pUpPath
->
numEntriesUsed
+
j
]
=
pDownPath
->
pFlags
[
pUpPath
->
numEntriesUsed
-
j
-
1
];
for
(
j
=
0
;
j
<
pDownPath
->
numEntriesUsed
;
j
++
)
{
POINT
pt
;
pt
.
x
=
pDownPath
->
pPoints
[
pDownPath
->
numEntriesUsed
-
j
-
1
].
x
;
pt
.
y
=
pDownPath
->
pPoints
[
pDownPath
->
numEntriesUsed
-
j
-
1
].
y
;
PATH_AddEntry
(
pNewPath
,
&
pt
,
(
(
j
==
0
&&
(
pStrokes
[
i
]
->
pFlags
[
pStrokes
[
i
]
->
numEntriesUsed
-
1
]
&
PT_CLOSEFIGURE
))
?
PT_MOVETO
:
PT_LINETO
));
}
}
pNewPath
->
numEntriesUsed
+=
2
*
pUpPath
->
numEntriesUsed
;
pNewPath
->
pFlags
[
pNewPath
->
numEntriesUsed
-
1
]
=
PT_CLOSEFIGURE
|
PT_LINETO
;
PATH_DestroyGdiPath
(
pStrokes
[
i
]);
PATH_DestroyGdiPath
(
pStrokes
[
i
]);
HeapFree
(
GetProcessHeap
(),
0
,
pStrokes
[
i
]);
HeapFree
(
GetProcessHeap
(),
0
,
pStrokes
[
i
]);
...
@@ -2007,6 +2172,5 @@ BOOL WINAPI WidenPath(HDC hdc)
...
@@ -2007,6 +2172,5 @@ BOOL WINAPI WidenPath(HDC hdc)
else
else
ret
=
PATH_WidenPath
(
dc
);
ret
=
PATH_WidenPath
(
dc
);
GDI_ReleaseObj
(
hdc
);
GDI_ReleaseObj
(
hdc
);
FIXME
(
"partially implemented
\n
"
);
return
ret
;
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