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
629761ac
Commit
629761ac
authored
Jun 26, 2008
by
Nikolay Sivov
Committed by
Alexandre Julliard
Jun 26, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gdiplus: Implementation of GdipAddPathPolygon with tests.
parent
3ef22e56
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
100 additions
and
2 deletions
+100
-2
gdiplus.spec
dlls/gdiplus/gdiplus.spec
+2
-2
graphicspath.c
dlls/gdiplus/graphicspath.c
+49
-0
graphicspath.c
dlls/gdiplus/tests/graphicspath.c
+47
-0
gdiplusflat.h
include/gdiplusflat.h
+2
-0
No files found.
dlls/gdiplus/gdiplus.spec
View file @
629761ac
...
...
@@ -23,8 +23,8 @@
@ stdcall GdipAddPathPath(ptr ptr long)
@ stub GdipAddPathPie
@ stub GdipAddPathPieI
@ st
ub GdipAddPathPolygon
@ st
ub GdipAddPathPolygonI
@ st
dcall GdipAddPathPolygon(ptr ptr long)
@ st
dcall GdipAddPathPolygonI(ptr ptr long)
@ stdcall GdipAddPathRectangle(ptr long long long long)
@ stdcall GdipAddPathRectangleI(ptr long long long long)
@ stdcall GdipAddPathRectangles(ptr ptr long)
...
...
dlls/gdiplus/graphicspath.c
View file @
629761ac
...
...
@@ -346,6 +346,55 @@ GpStatus WINGDIPAPI GdipAddPathPath(GpPath *path, GDIPCONST GpPath* addingPath,
return
Ok
;
}
GpStatus
WINGDIPAPI
GdipAddPathPolygon
(
GpPath
*
path
,
GDIPCONST
GpPointF
*
points
,
INT
count
)
{
INT
old_count
;
if
(
!
path
||
!
points
||
count
<
3
)
return
InvalidParameter
;
if
(
!
lengthen_path
(
path
,
count
))
return
OutOfMemory
;
old_count
=
path
->
pathdata
.
Count
;
memcpy
(
&
path
->
pathdata
.
Points
[
old_count
],
points
,
count
*
sizeof
(
GpPointF
));
memset
(
&
path
->
pathdata
.
Types
[
old_count
+
1
],
PathPointTypeLine
,
count
-
1
);
/* A polygon is an intrinsic figure */
path
->
pathdata
.
Types
[
old_count
]
=
PathPointTypeStart
;
path
->
pathdata
.
Types
[
old_count
+
count
-
1
]
|=
PathPointTypeCloseSubpath
;
path
->
newfigure
=
TRUE
;
path
->
pathdata
.
Count
+=
count
;
return
Ok
;
}
GpStatus
WINGDIPAPI
GdipAddPathPolygonI
(
GpPath
*
path
,
GDIPCONST
GpPoint
*
points
,
INT
count
)
{
GpPointF
*
ptf
;
GpStatus
status
;
INT
i
;
if
(
!
points
||
count
<
3
)
return
InvalidParameter
;
ptf
=
GdipAlloc
(
sizeof
(
GpPointF
)
*
count
);
if
(
!
ptf
)
return
OutOfMemory
;
for
(
i
=
0
;
i
<
count
;
i
++
){
ptf
[
i
].
X
=
(
REAL
)
points
[
i
].
X
;
ptf
[
i
].
Y
=
(
REAL
)
points
[
i
].
Y
;
}
status
=
GdipAddPathPolygon
(
path
,
ptf
,
count
);
GdipFree
(
ptf
);
return
status
;
}
GpStatus
WINGDIPAPI
GdipClonePath
(
GpPath
*
path
,
GpPath
**
clone
)
{
if
(
!
path
||
!
clone
)
...
...
dlls/gdiplus/tests/graphicspath.c
View file @
629761ac
...
...
@@ -575,6 +575,52 @@ static void test_linei(void)
GdipDeletePath
(
path
);
}
static
path_test_t
poly_path
[]
=
{
{
5
.
00
,
5
.
00
,
PathPointTypeStart
,
0
,
0
},
/*1*/
{
6
.
00
,
8
.
00
,
PathPointTypeLine
,
0
,
0
},
/*2*/
{
0
.
00
,
0
.
00
,
PathPointTypeStart
,
0
,
0
},
/*3*/
{
10
.
00
,
10
.
00
,
PathPointTypeLine
,
0
,
0
},
/*4*/
{
10
.
00
,
20
.
00
,
PathPointTypeLine
,
0
,
0
},
/*5*/
{
30
.
00
,
10
.
00
,
PathPointTypeLine
,
0
,
0
},
/*6*/
{
20
.
00
,
0
.
00
,
PathPointTypeLine
|
PathPointTypeCloseSubpath
,
0
,
0
},
/*7*/
};
static
void
test_polygon
(
void
)
{
GpStatus
status
;
GpPath
*
path
;
GpPointF
points
[
5
];
points
[
0
].
X
=
0
.
0
;
points
[
0
].
Y
=
0
.
0
;
points
[
1
].
X
=
10
.
0
;
points
[
1
].
Y
=
10
.
0
;
points
[
2
].
X
=
10
.
0
;
points
[
2
].
Y
=
20
.
0
;
points
[
3
].
X
=
30
.
0
;
points
[
3
].
Y
=
10
.
0
;
points
[
4
].
X
=
20
.
0
;
points
[
4
].
Y
=
0
.
0
;
/* NULL args */
status
=
GdipAddPathPolygon
(
NULL
,
points
,
5
);
expect
(
InvalidParameter
,
status
);
status
=
GdipAddPathPolygon
(
path
,
NULL
,
5
);
expect
(
InvalidParameter
,
status
);
/* Polygon should have 3 points at least */
status
=
GdipAddPathPolygon
(
path
,
points
,
2
);
expect
(
InvalidParameter
,
status
);
GdipCreatePath
(
FillModeAlternate
,
&
path
);
/* to test how it prolongs not empty path */
status
=
GdipAddPathLine
(
path
,
5
.
0
,
5
.
0
,
6
.
0
,
8
.
0
);
expect
(
Ok
,
status
);
status
=
GdipAddPathPolygon
(
path
,
points
,
5
);
expect
(
Ok
,
status
);
/* check resulting path */
ok_path
(
path
,
poly_path
,
sizeof
(
poly_path
)
/
sizeof
(
path_test_t
),
FALSE
);
}
static
path_test_t
rect_path
[]
=
{
{
5
.
0
,
5
.
0
,
PathPointTypeStart
,
0
,
0
},
/*0*/
{
105
.
0
,
5
.
0
,
PathPointTypeLine
,
0
,
0
},
/*1*/
...
...
@@ -643,6 +689,7 @@ START_TEST(graphicspath)
test_ellipse
();
test_linei
();
test_rect
();
test_polygon
();
GdiplusShutdown
(
gdiplusToken
);
}
include/gdiplusflat.h
View file @
629761ac
...
...
@@ -215,6 +215,8 @@ GpStatus WINGDIPAPI GdipAddPathLine2(GpPath*,GDIPCONST GpPointF*,INT);
GpStatus
WINGDIPAPI
GdipAddPathLine2I
(
GpPath
*
,
GDIPCONST
GpPoint
*
,
INT
);
GpStatus
WINGDIPAPI
GdipAddPathLineI
(
GpPath
*
,
INT
,
INT
,
INT
,
INT
);
GpStatus
WINGDIPAPI
GdipAddPathPath
(
GpPath
*
,
GDIPCONST
GpPath
*
,
BOOL
);
GpStatus
WINGDIPAPI
GdipAddPathPolygon
(
GpPath
*
,
GDIPCONST
GpPointF
*
,
INT
);
GpStatus
WINGDIPAPI
GdipAddPathPolygonI
(
GpPath
*
,
GDIPCONST
GpPoint
*
,
INT
);
GpStatus
WINGDIPAPI
GdipAddPathRectangle
(
GpPath
*
,
REAL
,
REAL
,
REAL
,
REAL
);
GpStatus
WINGDIPAPI
GdipAddPathRectangleI
(
GpPath
*
,
INT
,
INT
,
INT
,
INT
);
GpStatus
WINGDIPAPI
GdipAddPathRectangles
(
GpPath
*
,
GDIPCONST
GpRectF
*
,
INT
);
...
...
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