Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
f3f792d0
Commit
f3f792d0
authored
Sep 17, 2007
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gdi32: Replace DC_GetDCUpdate by get_dc_ptr+update_dc in the painting functions.
parent
f486f24b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
148 additions
and
83 deletions
+148
-83
painting.c
dlls/gdi32/painting.c
+148
-83
No files found.
dlls/gdi32/painting.c
View file @
f3f792d0
...
...
@@ -42,11 +42,12 @@ WINE_DEFAULT_DEBUG_CHANNEL(gdi);
*/
BOOL
WINAPI
LineTo
(
HDC
hdc
,
INT
x
,
INT
y
)
{
DC
*
dc
=
DC_GetDCUpdate
(
hdc
);
DC
*
dc
=
get_dc_ptr
(
hdc
);
BOOL
ret
;
if
(
!
dc
)
return
FALSE
;
update_dc
(
dc
);
if
(
PATH_IsPathOpen
(
dc
->
path
))
ret
=
PATH_LineTo
(
dc
,
x
,
y
);
else
...
...
@@ -55,7 +56,7 @@ BOOL WINAPI LineTo( HDC hdc, INT x, INT y )
dc
->
CursPosX
=
x
;
dc
->
CursPosY
=
y
;
}
DC_ReleaseDCP
tr
(
dc
);
release_dc_p
tr
(
dc
);
return
ret
;
}
...
...
@@ -92,14 +93,16 @@ BOOL WINAPI Arc( HDC hdc, INT left, INT top, INT right,
INT
xend
,
INT
yend
)
{
BOOL
ret
=
FALSE
;
DC
*
dc
=
DC_GetDCUpdate
(
hdc
);
DC
*
dc
=
get_dc_ptr
(
hdc
);
if
(
dc
)
{
if
(
PATH_IsPathOpen
(
dc
->
path
))
update_dc
(
dc
);
if
(
PATH_IsPathOpen
(
dc
->
path
))
ret
=
PATH_Arc
(
dc
,
left
,
top
,
right
,
bottom
,
xstart
,
ystart
,
xend
,
yend
,
0
);
else
if
(
dc
->
funcs
->
pArc
)
ret
=
dc
->
funcs
->
pArc
(
dc
->
physDev
,
left
,
top
,
right
,
bottom
,
xstart
,
ystart
,
xend
,
yend
);
DC_ReleaseDCP
tr
(
dc
);
release_dc_p
tr
(
dc
);
}
return
ret
;
}
...
...
@@ -121,9 +124,10 @@ BOOL WINAPI ArcTo( HDC hdc,
ycenter
=
bottom
>
top
?
top
+
yradius
:
bottom
+
yradius
,
angle
;
BOOL
result
;
DC
*
dc
=
DC_GetDCUpdate
(
hdc
);
DC
*
dc
=
get_dc_ptr
(
hdc
);
if
(
!
dc
)
return
FALSE
;
update_dc
(
dc
);
if
(
PATH_IsPathOpen
(
dc
->
path
))
result
=
PATH_Arc
(
dc
,
left
,
top
,
right
,
bottom
,
xstart
,
ystart
,
xend
,
yend
,
-
1
);
else
if
(
dc
->
funcs
->
pArcTo
)
...
...
@@ -143,7 +147,7 @@ BOOL WINAPI ArcTo( HDC hdc,
dc
->
CursPosX
=
GDI_ROUND
(
xcenter
+
(
cos
(
angle
)
*
xradius
));
dc
->
CursPosY
=
GDI_ROUND
(
ycenter
+
(
sin
(
angle
)
*
yradius
));
}
DC_ReleaseDCP
tr
(
dc
);
release_dc_p
tr
(
dc
);
return
result
;
}
...
...
@@ -156,15 +160,16 @@ BOOL WINAPI Pie( HDC hdc, INT left, INT top,
INT
xend
,
INT
yend
)
{
BOOL
ret
=
FALSE
;
DC
*
dc
=
DC_GetDCUpdate
(
hdc
);
DC
*
dc
=
get_dc_ptr
(
hdc
);
if
(
!
dc
)
return
FALSE
;
update_dc
(
dc
);
if
(
PATH_IsPathOpen
(
dc
->
path
))
ret
=
PATH_Arc
(
dc
,
left
,
top
,
right
,
bottom
,
xstart
,
ystart
,
xend
,
yend
,
2
);
else
if
(
dc
->
funcs
->
pPie
)
ret
=
dc
->
funcs
->
pPie
(
dc
->
physDev
,
left
,
top
,
right
,
bottom
,
xstart
,
ystart
,
xend
,
yend
);
DC_ReleaseDCP
tr
(
dc
);
release_dc_p
tr
(
dc
);
return
ret
;
}
...
...
@@ -177,15 +182,16 @@ BOOL WINAPI Chord( HDC hdc, INT left, INT top,
INT
xend
,
INT
yend
)
{
BOOL
ret
=
FALSE
;
DC
*
dc
=
DC_GetDCUpdate
(
hdc
);
DC
*
dc
=
get_dc_ptr
(
hdc
);
if
(
!
dc
)
return
FALSE
;
update_dc
(
dc
);
if
(
PATH_IsPathOpen
(
dc
->
path
))
ret
=
PATH_Arc
(
dc
,
left
,
top
,
right
,
bottom
,
xstart
,
ystart
,
xend
,
yend
,
1
);
else
if
(
dc
->
funcs
->
pChord
)
ret
=
dc
->
funcs
->
pChord
(
dc
->
physDev
,
left
,
top
,
right
,
bottom
,
xstart
,
ystart
,
xend
,
yend
);
DC_ReleaseDCP
tr
(
dc
);
release_dc_p
tr
(
dc
);
return
ret
;
}
...
...
@@ -197,15 +203,16 @@ BOOL WINAPI Ellipse( HDC hdc, INT left, INT top,
INT
right
,
INT
bottom
)
{
BOOL
ret
=
FALSE
;
DC
*
dc
=
DC_GetDCUpdate
(
hdc
);
DC
*
dc
=
get_dc_ptr
(
hdc
);
if
(
!
dc
)
return
FALSE
;
update_dc
(
dc
);
if
(
PATH_IsPathOpen
(
dc
->
path
))
ret
=
PATH_Ellipse
(
dc
,
left
,
top
,
right
,
bottom
);
else
if
(
dc
->
funcs
->
pEllipse
)
ret
=
dc
->
funcs
->
pEllipse
(
dc
->
physDev
,
left
,
top
,
right
,
bottom
);
DC_ReleaseDCP
tr
(
dc
);
release_dc_p
tr
(
dc
);
return
ret
;
}
...
...
@@ -217,14 +224,16 @@ BOOL WINAPI Rectangle( HDC hdc, INT left, INT top,
INT
right
,
INT
bottom
)
{
BOOL
ret
=
FALSE
;
DC
*
dc
=
DC_GetDCUpdate
(
hdc
);
DC
*
dc
=
get_dc_ptr
(
hdc
);
if
(
dc
)
{
if
(
PATH_IsPathOpen
(
dc
->
path
))
update_dc
(
dc
);
if
(
PATH_IsPathOpen
(
dc
->
path
))
ret
=
PATH_Rectangle
(
dc
,
left
,
top
,
right
,
bottom
);
else
if
(
dc
->
funcs
->
pRectangle
)
ret
=
dc
->
funcs
->
pRectangle
(
dc
->
physDev
,
left
,
top
,
right
,
bottom
);
DC_ReleaseDCP
tr
(
dc
);
release_dc_p
tr
(
dc
);
}
return
ret
;
}
...
...
@@ -237,15 +246,16 @@ BOOL WINAPI RoundRect( HDC hdc, INT left, INT top, INT right,
INT
bottom
,
INT
ell_width
,
INT
ell_height
)
{
BOOL
ret
=
FALSE
;
DC
*
dc
=
DC_GetDCUpdate
(
hdc
);
DC
*
dc
=
get_dc_ptr
(
hdc
);
if
(
dc
)
{
update_dc
(
dc
);
if
(
PATH_IsPathOpen
(
dc
->
path
))
ret
=
PATH_RoundRect
(
dc
,
left
,
top
,
right
,
bottom
,
ell_width
,
ell_height
);
else
if
(
dc
->
funcs
->
pRoundRect
)
ret
=
dc
->
funcs
->
pRoundRect
(
dc
->
physDev
,
left
,
top
,
right
,
bottom
,
ell_width
,
ell_height
);
DC_ReleaseDCP
tr
(
dc
);
release_dc_p
tr
(
dc
);
}
return
ret
;
}
...
...
@@ -256,11 +266,13 @@ BOOL WINAPI RoundRect( HDC hdc, INT left, INT top, INT right,
COLORREF
WINAPI
SetPixel
(
HDC
hdc
,
INT
x
,
INT
y
,
COLORREF
color
)
{
COLORREF
ret
=
0
;
DC
*
dc
=
DC_GetDCUpdate
(
hdc
);
DC
*
dc
=
get_dc_ptr
(
hdc
);
if
(
dc
)
{
update_dc
(
dc
);
if
(
dc
->
funcs
->
pSetPixel
)
ret
=
dc
->
funcs
->
pSetPixel
(
dc
->
physDev
,
x
,
y
,
color
);
DC_ReleaseDCP
tr
(
dc
);
release_dc_p
tr
(
dc
);
}
return
ret
;
}
...
...
@@ -271,15 +283,17 @@ COLORREF WINAPI SetPixel( HDC hdc, INT x, INT y, COLORREF color )
BOOL
WINAPI
SetPixelV
(
HDC
hdc
,
INT
x
,
INT
y
,
COLORREF
color
)
{
BOOL
ret
=
FALSE
;
DC
*
dc
=
DC_GetDCUpdate
(
hdc
);
DC
*
dc
=
get_dc_ptr
(
hdc
);
if
(
dc
)
{
update_dc
(
dc
);
if
(
dc
->
funcs
->
pSetPixel
)
{
dc
->
funcs
->
pSetPixel
(
dc
->
physDev
,
x
,
y
,
color
);
ret
=
TRUE
;
}
DC_ReleaseDCP
tr
(
dc
);
release_dc_p
tr
(
dc
);
}
return
ret
;
}
...
...
@@ -290,16 +304,17 @@ BOOL WINAPI SetPixelV( HDC hdc, INT x, INT y, COLORREF color )
COLORREF
WINAPI
GetPixel
(
HDC
hdc
,
INT
x
,
INT
y
)
{
COLORREF
ret
=
CLR_INVALID
;
DC
*
dc
=
DC_GetDCUpdate
(
hdc
);
DC
*
dc
=
get_dc_ptr
(
hdc
);
if
(
dc
)
{
/* FIXME: should this be in the graphics driver? */
update_dc
(
dc
);
/* FIXME: should this be in the graphics driver? */
if
(
PtVisible
(
hdc
,
x
,
y
))
{
if
(
dc
->
funcs
->
pGetPixel
)
ret
=
dc
->
funcs
->
pGetPixel
(
dc
->
physDev
,
x
,
y
);
}
DC_ReleaseDCP
tr
(
dc
);
release_dc_p
tr
(
dc
);
}
return
ret
;
}
...
...
@@ -469,11 +484,13 @@ BOOL WINAPI SwapBuffers( HDC hdc )
BOOL
WINAPI
PaintRgn
(
HDC
hdc
,
HRGN
hrgn
)
{
BOOL
ret
=
FALSE
;
DC
*
dc
=
DC_GetDCUpdate
(
hdc
);
DC
*
dc
=
get_dc_ptr
(
hdc
);
if
(
dc
)
{
update_dc
(
dc
);
if
(
dc
->
funcs
->
pPaintRgn
)
ret
=
dc
->
funcs
->
pPaintRgn
(
dc
->
physDev
,
hrgn
);
DC_ReleaseDCP
tr
(
dc
);
release_dc_p
tr
(
dc
);
}
return
ret
;
}
...
...
@@ -486,17 +503,20 @@ BOOL WINAPI FillRgn( HDC hdc, HRGN hrgn, HBRUSH hbrush )
{
BOOL
retval
=
FALSE
;
HBRUSH
prevBrush
;
DC
*
dc
=
DC_GetDCUpdate
(
hdc
);
DC
*
dc
=
get_dc_ptr
(
hdc
);
if
(
!
dc
)
return
FALSE
;
if
(
dc
->
funcs
->
pFillRgn
)
{
update_dc
(
dc
);
retval
=
dc
->
funcs
->
pFillRgn
(
dc
->
physDev
,
hrgn
,
hbrush
);
}
else
if
((
prevBrush
=
SelectObject
(
hdc
,
hbrush
)))
{
retval
=
PaintRgn
(
hdc
,
hrgn
);
SelectObject
(
hdc
,
prevBrush
);
retval
=
PaintRgn
(
hdc
,
hrgn
);
SelectObject
(
hdc
,
prevBrush
);
}
DC_ReleaseDCP
tr
(
dc
);
release_dc_p
tr
(
dc
);
return
retval
;
}
...
...
@@ -508,11 +528,15 @@ BOOL WINAPI FrameRgn( HDC hdc, HRGN hrgn, HBRUSH hbrush,
INT
nWidth
,
INT
nHeight
)
{
BOOL
ret
=
FALSE
;
DC
*
dc
=
DC_GetDCUpdate
(
hdc
);
DC
*
dc
=
get_dc_ptr
(
hdc
);
if
(
!
dc
)
return
FALSE
;
if
(
dc
->
funcs
->
pFrameRgn
)
{
update_dc
(
dc
);
ret
=
dc
->
funcs
->
pFrameRgn
(
dc
->
physDev
,
hrgn
,
hbrush
,
nWidth
,
nHeight
);
}
else
{
HRGN
tmp
=
CreateRectRgn
(
0
,
0
,
0
,
0
);
...
...
@@ -526,7 +550,7 @@ BOOL WINAPI FrameRgn( HDC hdc, HRGN hrgn, HBRUSH hbrush,
DeleteObject
(
tmp
);
}
}
DC_ReleaseDCP
tr
(
dc
);
release_dc_p
tr
(
dc
);
return
ret
;
}
...
...
@@ -539,20 +563,23 @@ BOOL WINAPI InvertRgn( HDC hdc, HRGN hrgn )
HBRUSH
prevBrush
;
INT
prevROP
;
BOOL
retval
;
DC
*
dc
=
DC_GetDCUpdate
(
hdc
);
DC
*
dc
=
get_dc_ptr
(
hdc
);
if
(
!
dc
)
return
FALSE
;
if
(
dc
->
funcs
->
pInvertRgn
)
{
update_dc
(
dc
);
retval
=
dc
->
funcs
->
pInvertRgn
(
dc
->
physDev
,
hrgn
);
}
else
{
prevBrush
=
SelectObject
(
hdc
,
GetStockObject
(
BLACK_BRUSH
)
);
prevROP
=
SetROP2
(
hdc
,
R2_NOT
);
retval
=
PaintRgn
(
hdc
,
hrgn
);
SelectObject
(
hdc
,
prevBrush
);
SetROP2
(
hdc
,
prevROP
);
prevBrush
=
SelectObject
(
hdc
,
GetStockObject
(
BLACK_BRUSH
)
);
prevROP
=
SetROP2
(
hdc
,
R2_NOT
);
retval
=
PaintRgn
(
hdc
,
hrgn
);
SelectObject
(
hdc
,
prevBrush
);
SetROP2
(
hdc
,
prevROP
);
}
DC_ReleaseDCP
tr
(
dc
);
release_dc_p
tr
(
dc
);
return
retval
;
}
...
...
@@ -563,12 +590,14 @@ BOOL WINAPI InvertRgn( HDC hdc, HRGN hrgn )
BOOL
WINAPI
Polyline
(
HDC
hdc
,
const
POINT
*
pt
,
INT
count
)
{
BOOL
ret
=
FALSE
;
DC
*
dc
=
DC_GetDCUpdate
(
hdc
);
DC
*
dc
=
get_dc_ptr
(
hdc
);
if
(
dc
)
{
update_dc
(
dc
);
if
(
PATH_IsPathOpen
(
dc
->
path
))
ret
=
PATH_Polyline
(
dc
,
pt
,
count
);
else
if
(
dc
->
funcs
->
pPolyline
)
ret
=
dc
->
funcs
->
pPolyline
(
dc
->
physDev
,
pt
,
count
);
DC_ReleaseDCP
tr
(
dc
);
release_dc_p
tr
(
dc
);
}
return
ret
;
}
...
...
@@ -578,34 +607,39 @@ BOOL WINAPI Polyline( HDC hdc, const POINT* pt, INT count )
*/
BOOL
WINAPI
PolylineTo
(
HDC
hdc
,
const
POINT
*
pt
,
DWORD
cCount
)
{
DC
*
dc
=
DC_GetDCUpdate
(
hdc
);
DC
*
dc
=
get_dc_ptr
(
hdc
);
BOOL
ret
=
FALSE
;
if
(
!
dc
)
return
FALSE
;
if
(
PATH_IsPathOpen
(
dc
->
path
))
{
update_dc
(
dc
);
ret
=
PATH_PolylineTo
(
dc
,
pt
,
cCount
);
}
else
if
(
dc
->
funcs
->
pPolylineTo
)
{
update_dc
(
dc
);
ret
=
dc
->
funcs
->
pPolylineTo
(
dc
->
physDev
,
pt
,
cCount
);
else
{
/* do it using Polyline */
}
else
/* do it using Polyline */
{
POINT
*
pts
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
POINT
)
*
(
cCount
+
1
)
);
if
(
pts
)
{
pts
[
0
].
x
=
dc
->
CursPosX
;
pts
[
0
].
y
=
dc
->
CursPosY
;
memcpy
(
pts
+
1
,
pt
,
sizeof
(
POINT
)
*
cCount
);
ret
=
Polyline
(
hdc
,
pts
,
cCount
+
1
);
HeapFree
(
GetProcessHeap
(),
0
,
pts
);
}
pts
[
0
].
x
=
dc
->
CursPosX
;
pts
[
0
].
y
=
dc
->
CursPosY
;
memcpy
(
pts
+
1
,
pt
,
sizeof
(
POINT
)
*
cCount
);
ret
=
Polyline
(
hdc
,
pts
,
cCount
+
1
);
HeapFree
(
GetProcessHeap
(),
0
,
pts
);
}
}
if
(
ret
)
{
dc
->
CursPosX
=
pt
[
cCount
-
1
].
x
;
dc
->
CursPosY
=
pt
[
cCount
-
1
].
y
;
}
DC_ReleaseDCP
tr
(
dc
);
release_dc_p
tr
(
dc
);
return
ret
;
}
...
...
@@ -616,12 +650,14 @@ BOOL WINAPI PolylineTo( HDC hdc, const POINT* pt, DWORD cCount )
BOOL
WINAPI
Polygon
(
HDC
hdc
,
const
POINT
*
pt
,
INT
count
)
{
BOOL
ret
=
FALSE
;
DC
*
dc
=
DC_GetDCUpdate
(
hdc
);
DC
*
dc
=
get_dc_ptr
(
hdc
);
if
(
dc
)
{
update_dc
(
dc
);
if
(
PATH_IsPathOpen
(
dc
->
path
))
ret
=
PATH_Polygon
(
dc
,
pt
,
count
);
else
if
(
dc
->
funcs
->
pPolygon
)
ret
=
dc
->
funcs
->
pPolygon
(
dc
->
physDev
,
pt
,
count
);
DC_ReleaseDCP
tr
(
dc
);
release_dc_p
tr
(
dc
);
}
return
ret
;
}
...
...
@@ -634,12 +670,14 @@ BOOL WINAPI PolyPolygon( HDC hdc, const POINT* pt, const INT* counts,
UINT
polygons
)
{
BOOL
ret
=
FALSE
;
DC
*
dc
=
DC_GetDCUpdate
(
hdc
);
DC
*
dc
=
get_dc_ptr
(
hdc
);
if
(
dc
)
{
update_dc
(
dc
);
if
(
PATH_IsPathOpen
(
dc
->
path
))
ret
=
PATH_PolyPolygon
(
dc
,
pt
,
counts
,
polygons
);
else
if
(
dc
->
funcs
->
pPolyPolygon
)
ret
=
dc
->
funcs
->
pPolyPolygon
(
dc
->
physDev
,
pt
,
counts
,
polygons
);
DC_ReleaseDCP
tr
(
dc
);
release_dc_p
tr
(
dc
);
}
return
ret
;
}
...
...
@@ -651,12 +689,14 @@ BOOL WINAPI PolyPolyline( HDC hdc, const POINT* pt, const DWORD* counts,
DWORD
polylines
)
{
BOOL
ret
=
FALSE
;
DC
*
dc
=
DC_GetDCUpdate
(
hdc
);
DC
*
dc
=
get_dc_ptr
(
hdc
);
if
(
dc
)
{
update_dc
(
dc
);
if
(
PATH_IsPathOpen
(
dc
->
path
))
ret
=
PATH_PolyPolyline
(
dc
,
pt
,
counts
,
polylines
);
else
if
(
dc
->
funcs
->
pPolyPolyline
)
ret
=
dc
->
funcs
->
pPolyPolyline
(
dc
->
physDev
,
pt
,
counts
,
polylines
);
DC_ReleaseDCP
tr
(
dc
);
release_dc_p
tr
(
dc
);
}
return
ret
;
}
...
...
@@ -668,11 +708,13 @@ BOOL WINAPI ExtFloodFill( HDC hdc, INT x, INT y, COLORREF color,
UINT
fillType
)
{
BOOL
ret
=
FALSE
;
DC
*
dc
=
DC_GetDCUpdate
(
hdc
);
DC
*
dc
=
get_dc_ptr
(
hdc
);
if
(
dc
)
{
update_dc
(
dc
);
if
(
dc
->
funcs
->
pExtFloodFill
)
ret
=
dc
->
funcs
->
pExtFloodFill
(
dc
->
physDev
,
x
,
y
,
color
,
fillType
);
DC_ReleaseDCP
tr
(
dc
);
release_dc_p
tr
(
dc
);
}
return
ret
;
}
...
...
@@ -708,13 +750,19 @@ BOOL WINAPI PolyBezier( HDC hdc, const POINT* lppt, DWORD cPoints )
/* cPoints must be 3 * n + 1 (where n>=1) */
if
(
cPoints
==
1
||
(
cPoints
%
3
)
!=
1
)
return
FALSE
;
dc
=
DC_GetDCUpdate
(
hdc
);
dc
=
get_dc_ptr
(
hdc
);
if
(
!
dc
)
return
FALSE
;
if
(
PATH_IsPathOpen
(
dc
->
path
))
{
update_dc
(
dc
);
ret
=
PATH_PolyBezier
(
dc
,
lppt
,
cPoints
);
}
else
if
(
dc
->
funcs
->
pPolyBezier
)
{
update_dc
(
dc
);
ret
=
dc
->
funcs
->
pPolyBezier
(
dc
->
physDev
,
lppt
,
cPoints
);
}
else
/* We'll convert it into line segments and draw them using Polyline */
{
POINT
*
Pts
;
...
...
@@ -723,12 +771,12 @@ BOOL WINAPI PolyBezier( HDC hdc, const POINT* lppt, DWORD cPoints )
if
((
Pts
=
GDI_Bezier
(
lppt
,
cPoints
,
&
nOut
)))
{
TRACE
(
"Pts = %p, no = %d
\n
"
,
Pts
,
nOut
);
ret
=
Polyline
(
dc
->
hSelf
,
Pts
,
nOut
);
ret
=
Polyline
(
hdc
,
Pts
,
nOut
);
HeapFree
(
GetProcessHeap
(),
0
,
Pts
);
}
}
DC_ReleaseDCP
tr
(
dc
);
release_dc_p
tr
(
dc
);
return
ret
;
}
...
...
@@ -748,33 +796,41 @@ BOOL WINAPI PolyBezier( HDC hdc, const POINT* lppt, DWORD cPoints )
BOOL
WINAPI
PolyBezierTo
(
HDC
hdc
,
const
POINT
*
lppt
,
DWORD
cPoints
)
{
DC
*
dc
;
BOOL
ret
;
BOOL
ret
=
FALSE
;
/* cbPoints must be 3 * n (where n>=1) */
if
(
!
cPoints
||
(
cPoints
%
3
)
!=
0
)
return
FALSE
;
dc
=
DC_GetDCUpdate
(
hdc
);
dc
=
get_dc_ptr
(
hdc
);
if
(
!
dc
)
return
FALSE
;
if
(
PATH_IsPathOpen
(
dc
->
path
))
{
update_dc
(
dc
);
ret
=
PATH_PolyBezierTo
(
dc
,
lppt
,
cPoints
);
}
else
if
(
dc
->
funcs
->
pPolyBezierTo
)
{
update_dc
(
dc
);
ret
=
dc
->
funcs
->
pPolyBezierTo
(
dc
->
physDev
,
lppt
,
cPoints
);
else
{
/* We'll do it using PolyBezier */
POINT
*
pt
;
pt
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
POINT
)
*
(
cPoints
+
1
)
);
if
(
!
pt
)
return
FALSE
;
pt
[
0
].
x
=
dc
->
CursPosX
;
pt
[
0
].
y
=
dc
->
CursPosY
;
memcpy
(
pt
+
1
,
lppt
,
sizeof
(
POINT
)
*
cPoints
);
ret
=
PolyBezier
(
dc
->
hSelf
,
pt
,
cPoints
+
1
);
HeapFree
(
GetProcessHeap
(),
0
,
pt
);
}
else
/* We'll do it using PolyBezier */
{
POINT
*
pt
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
POINT
)
*
(
cPoints
+
1
)
);
if
(
pt
)
{
pt
[
0
].
x
=
dc
->
CursPosX
;
pt
[
0
].
y
=
dc
->
CursPosY
;
memcpy
(
pt
+
1
,
lppt
,
sizeof
(
POINT
)
*
cPoints
);
ret
=
PolyBezier
(
hdc
,
pt
,
cPoints
+
1
);
HeapFree
(
GetProcessHeap
(),
0
,
pt
);
}
}
if
(
ret
)
{
dc
->
CursPosX
=
lppt
[
cPoints
-
1
].
x
;
dc
->
CursPosY
=
lppt
[
cPoints
-
1
].
y
;
}
DC_ReleaseDCP
tr
(
dc
);
release_dc_p
tr
(
dc
);
return
ret
;
}
...
...
@@ -790,7 +846,7 @@ BOOL WINAPI AngleArc(HDC hdc, INT x, INT y, DWORD dwRadius, FLOAT eStartAngle, F
if
(
(
signed
int
)
dwRadius
<
0
)
return
FALSE
;
dc
=
DC_GetDCUpdate
(
hdc
);
dc
=
get_dc_ptr
(
hdc
);
if
(
!
dc
)
return
FALSE
;
/* Calculate the end point */
...
...
@@ -798,7 +854,10 @@ BOOL WINAPI AngleArc(HDC hdc, INT x, INT y, DWORD dwRadius, FLOAT eStartAngle, F
y2
=
y
-
sin
((
eStartAngle
+
eSweepAngle
)
*
M_PI
/
180
)
*
dwRadius
;
if
(
!
PATH_IsPathOpen
(
dc
->
path
)
&&
dc
->
funcs
->
pAngleArc
)
{
update_dc
(
dc
);
result
=
dc
->
funcs
->
pAngleArc
(
dc
->
physDev
,
x
,
y
,
dwRadius
,
eStartAngle
,
eSweepAngle
);
}
else
{
/* do it using ArcTo */
x1
=
x
+
cos
(
eStartAngle
*
M_PI
/
180
)
*
dwRadius
;
y1
=
y
-
sin
(
eStartAngle
*
M_PI
/
180
)
*
dwRadius
;
...
...
@@ -812,7 +871,7 @@ BOOL WINAPI AngleArc(HDC hdc, INT x, INT y, DWORD dwRadius, FLOAT eStartAngle, F
dc
->
CursPosX
=
x2
;
dc
->
CursPosY
=
y2
;
}
DC_ReleaseDCP
tr
(
dc
);
release_dc_p
tr
(
dc
);
return
result
;
}
...
...
@@ -827,13 +886,19 @@ BOOL WINAPI PolyDraw(HDC hdc, const POINT *lppt, const BYTE *lpbTypes,
POINT
*
line_pts
=
NULL
,
*
bzr_pts
=
NULL
,
bzr
[
4
];
INT
i
,
num_pts
,
num_bzr_pts
,
space
,
size
;
dc
=
DC_GetDCUpdate
(
hdc
);
dc
=
get_dc_ptr
(
hdc
);
if
(
!
dc
)
return
FALSE
;
if
(
PATH_IsPathOpen
(
dc
->
path
)
)
{
update_dc
(
dc
);
result
=
PATH_PolyDraw
(
dc
,
lppt
,
lpbTypes
,
cCount
);
}
else
if
(
dc
->
funcs
->
pPolyDraw
)
{
update_dc
(
dc
);
result
=
dc
->
funcs
->
pPolyDraw
(
dc
->
physDev
,
lppt
,
lpbTypes
,
cCount
);
}
else
{
/* check for valid point types */
for
(
i
=
0
;
i
<
cCount
;
i
++
)
{
...
...
@@ -864,7 +929,7 @@ BOOL WINAPI PolyDraw(HDC hdc, const POINT *lppt, const BYTE *lpbTypes,
switch
(
lpbTypes
[
i
])
{
case
PT_MOVETO
:
if
(
num_pts
>=
2
)
Polyline
(
dc
->
hSelf
,
line_pts
,
num_pts
);
Polyline
(
hdc
,
line_pts
,
num_pts
);
num_pts
=
0
;
line_pts
[
num_pts
++
]
=
lppt
[
i
];
break
;
...
...
@@ -900,15 +965,15 @@ BOOL WINAPI PolyDraw(HDC hdc, const POINT *lppt, const BYTE *lpbTypes,
}
if
(
num_pts
>=
2
)
Polyline
(
dc
->
hSelf
,
line_pts
,
num_pts
);
Polyline
(
hdc
,
line_pts
,
num_pts
);
MoveToEx
(
dc
->
hSelf
,
line_pts
[
num_pts
-
1
].
x
,
line_pts
[
num_pts
-
1
].
y
,
NULL
);
MoveToEx
(
hdc
,
line_pts
[
num_pts
-
1
].
x
,
line_pts
[
num_pts
-
1
].
y
,
NULL
);
result
=
TRUE
;
}
end:
DC_ReleaseDCP
tr
(
dc
);
release_dc_p
tr
(
dc
);
return
result
;
}
...
...
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