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
1fcf8f54
Commit
1fcf8f54
authored
Jun 24, 2016
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gdi32: Compatibility fixes for Rectangle in paths, with tests.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
57d20090
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
164 additions
and
3 deletions
+164
-3
path.c
dlls/gdi32/path.c
+8
-3
path.c
dlls/gdi32/tests/path.c
+156
-0
No files found.
dlls/gdi32/path.c
View file @
1fcf8f54
...
...
@@ -357,7 +357,7 @@ static HRGN path_to_region( const struct gdi_path *path, int mode )
*
* Helper function for RoundRect() and Rectangle()
*/
static
void
PATH_CheckCorners
(
HDC
hdc
,
POINT
corners
[],
INT
x1
,
INT
y1
,
INT
x2
,
INT
y2
)
static
BOOL
PATH_CheckCorners
(
HDC
hdc
,
POINT
corners
[],
INT
x1
,
INT
y1
,
INT
x2
,
INT
y2
)
{
INT
temp
;
...
...
@@ -385,9 +385,12 @@ static void PATH_CheckCorners( HDC hdc, POINT corners[], INT x1, INT y1, INT x2,
/* In GM_COMPATIBLE, don't include bottom and right edges */
if
(
GetGraphicsMode
(
hdc
)
==
GM_COMPATIBLE
)
{
if
(
corners
[
0
].
x
==
corners
[
1
].
x
)
return
FALSE
;
if
(
corners
[
0
].
y
==
corners
[
1
].
y
)
return
FALSE
;
corners
[
1
].
x
--
;
corners
[
1
].
y
--
;
}
return
TRUE
;
}
/* PATH_AddFlatBezier
...
...
@@ -954,7 +957,7 @@ static BOOL pathdrv_Rectangle( PHYSDEV dev, INT x1, INT y1, INT x2, INT y2 )
POINT
corners
[
2
],
points
[
4
];
BYTE
*
type
;
PATH_CheckCorners
(
dev
->
hdc
,
corners
,
x1
,
y1
,
x2
,
y2
)
;
if
(
!
PATH_CheckCorners
(
dev
->
hdc
,
corners
,
x1
,
y1
,
x2
,
y2
))
return
TRUE
;
points
[
0
].
x
=
corners
[
1
].
x
;
points
[
0
].
y
=
corners
[
0
].
y
;
...
...
@@ -962,9 +965,11 @@ static BOOL pathdrv_Rectangle( PHYSDEV dev, INT x1, INT y1, INT x2, INT y2 )
points
[
2
].
x
=
corners
[
0
].
x
;
points
[
2
].
y
=
corners
[
1
].
y
;
points
[
3
]
=
corners
[
1
];
if
(
GetArcDirection
(
dev
->
hdc
)
==
AD_CLOCKWISE
)
reverse_points
(
points
,
4
);
if
(
!
(
type
=
add_points
(
physdev
->
path
,
points
,
4
,
PT_LINETO
)))
return
FALSE
;
type
[
0
]
=
PT_MOVETO
;
type
[
3
]
|=
PT_CLOSEFIGURE
;
close_figure
(
physdev
->
path
)
;
return
TRUE
;
}
...
...
dlls/gdi32/tests/path.c
View file @
1fcf8f54
...
...
@@ -815,6 +815,161 @@ static void test_linedda(void)
ok
(
pt
->
x
==
-
1
&&
pt
->
y
==
-
1
,
"didn't find terminator
\n
"
);
}
static
const
path_test_t
rectangle_path
[]
=
{
{
39
,
20
,
PT_MOVETO
},
/* 0 */
{
20
,
20
,
PT_LINETO
},
/* 1 */
{
20
,
39
,
PT_LINETO
},
/* 2 */
{
39
,
39
,
PT_LINETO
|
PT_CLOSEFIGURE
},
/* 3 */
{
54
,
35
,
PT_MOVETO
},
/* 4 */
{
30
,
35
,
PT_LINETO
},
/* 5 */
{
30
,
49
,
PT_LINETO
},
/* 6 */
{
54
,
49
,
PT_LINETO
|
PT_CLOSEFIGURE
},
/* 7 */
{
59
,
45
,
PT_MOVETO
},
/* 8 */
{
35
,
45
,
PT_LINETO
},
/* 9 */
{
35
,
59
,
PT_LINETO
},
/* 10 */
{
59
,
59
,
PT_LINETO
|
PT_CLOSEFIGURE
},
/* 11 */
{
80
,
80
,
PT_MOVETO
},
/* 12 */
{
80
,
80
,
PT_LINETO
},
/* 13 */
{
80
,
80
,
PT_LINETO
},
/* 14 */
{
80
,
80
,
PT_LINETO
|
PT_CLOSEFIGURE
},
/* 15 */
{
39
,
39
,
PT_MOVETO
},
/* 16 */
{
20
,
39
,
PT_LINETO
},
/* 17 */
{
20
,
20
,
PT_LINETO
},
/* 18 */
{
39
,
20
,
PT_LINETO
|
PT_CLOSEFIGURE
},
/* 19 */
{
54
,
49
,
PT_MOVETO
},
/* 20 */
{
30
,
49
,
PT_LINETO
},
/* 21 */
{
30
,
35
,
PT_LINETO
},
/* 22 */
{
54
,
35
,
PT_LINETO
|
PT_CLOSEFIGURE
},
/* 23 */
{
59
,
59
,
PT_MOVETO
},
/* 24 */
{
35
,
59
,
PT_LINETO
},
/* 25 */
{
35
,
45
,
PT_LINETO
},
/* 26 */
{
59
,
45
,
PT_LINETO
|
PT_CLOSEFIGURE
},
/* 27 */
{
80
,
80
,
PT_MOVETO
},
/* 28 */
{
80
,
80
,
PT_LINETO
},
/* 29 */
{
80
,
80
,
PT_LINETO
},
/* 30 */
{
80
,
80
,
PT_LINETO
|
PT_CLOSEFIGURE
},
/* 31 */
{
-
41
,
40
,
PT_MOVETO
},
/* 32 */
{
-
80
,
40
,
PT_LINETO
},
/* 33 */
{
-
80
,
79
,
PT_LINETO
},
/* 34 */
{
-
41
,
79
,
PT_LINETO
|
PT_CLOSEFIGURE
},
/* 35 */
{
-
61
,
70
,
PT_MOVETO
},
/* 36 */
{
-
110
,
70
,
PT_LINETO
},
/* 37 */
{
-
110
,
99
,
PT_LINETO
},
/* 38 */
{
-
61
,
99
,
PT_LINETO
|
PT_CLOSEFIGURE
},
/* 39 */
{
119
,
-
120
,
PT_MOVETO
},
/* 40 */
{
60
,
-
120
,
PT_LINETO
},
/* 41 */
{
60
,
-
61
,
PT_LINETO
},
/* 42 */
{
119
,
-
61
,
PT_LINETO
|
PT_CLOSEFIGURE
},
/* 43 */
{
164
,
-
150
,
PT_MOVETO
},
/* 44 */
{
90
,
-
150
,
PT_LINETO
},
/* 45 */
{
90
,
-
106
,
PT_LINETO
},
/* 46 */
{
164
,
-
106
,
PT_LINETO
|
PT_CLOSEFIGURE
},
/* 47 */
{
-
4
,
-
6
,
PT_MOVETO
},
/* 48 */
{
-
6
,
-
6
,
PT_LINETO
},
/* 49 */
{
-
6
,
-
4
,
PT_LINETO
},
/* 50 */
{
-
4
,
-
4
,
PT_LINETO
|
PT_CLOSEFIGURE
},
/* 51 */
{
40
,
20
,
PT_MOVETO
},
/* 52 */
{
20
,
20
,
PT_LINETO
},
/* 53 */
{
20
,
40
,
PT_LINETO
},
/* 54 */
{
40
,
40
,
PT_LINETO
|
PT_CLOSEFIGURE
},
/* 55 */
{
55
,
35
,
PT_MOVETO
},
/* 56 */
{
30
,
35
,
PT_LINETO
},
/* 57 */
{
30
,
50
,
PT_LINETO
},
/* 58 */
{
55
,
50
,
PT_LINETO
|
PT_CLOSEFIGURE
},
/* 59 */
{
60
,
45
,
PT_MOVETO
},
/* 60 */
{
35
,
45
,
PT_LINETO
},
/* 61 */
{
35
,
60
,
PT_LINETO
},
/* 62 */
{
60
,
60
,
PT_LINETO
|
PT_CLOSEFIGURE
},
/* 63 */
{
70
,
70
,
PT_MOVETO
},
/* 64 */
{
50
,
70
,
PT_LINETO
},
/* 65 */
{
50
,
70
,
PT_LINETO
},
/* 66 */
{
70
,
70
,
PT_LINETO
|
PT_CLOSEFIGURE
},
/* 67 */
{
75
,
75
,
PT_MOVETO
},
/* 68 */
{
75
,
75
,
PT_LINETO
},
/* 69 */
{
75
,
85
,
PT_LINETO
},
/* 70 */
{
75
,
85
,
PT_LINETO
|
PT_CLOSEFIGURE
},
/* 71 */
{
81
,
80
,
PT_MOVETO
},
/* 72 */
{
80
,
80
,
PT_LINETO
},
/* 73 */
{
80
,
81
,
PT_LINETO
},
/* 74 */
{
81
,
81
,
PT_LINETO
|
PT_CLOSEFIGURE
},
/* 75 */
{
40
,
40
,
PT_MOVETO
},
/* 76 */
{
20
,
40
,
PT_LINETO
},
/* 77 */
{
20
,
20
,
PT_LINETO
},
/* 78 */
{
40
,
20
,
PT_LINETO
|
PT_CLOSEFIGURE
},
/* 79 */
{
55
,
50
,
PT_MOVETO
},
/* 80 */
{
30
,
50
,
PT_LINETO
},
/* 81 */
{
30
,
35
,
PT_LINETO
},
/* 82 */
{
55
,
35
,
PT_LINETO
|
PT_CLOSEFIGURE
},
/* 83 */
{
60
,
60
,
PT_MOVETO
},
/* 84 */
{
35
,
60
,
PT_LINETO
},
/* 85 */
{
35
,
45
,
PT_LINETO
},
/* 86 */
{
60
,
45
,
PT_LINETO
|
PT_CLOSEFIGURE
},
/* 87 */
{
70
,
70
,
PT_MOVETO
},
/* 88 */
{
50
,
70
,
PT_LINETO
},
/* 89 */
{
50
,
70
,
PT_LINETO
},
/* 90 */
{
70
,
70
,
PT_LINETO
|
PT_CLOSEFIGURE
},
/* 91 */
{
75
,
85
,
PT_MOVETO
},
/* 92 */
{
75
,
85
,
PT_LINETO
},
/* 93 */
{
75
,
75
,
PT_LINETO
},
/* 94 */
{
75
,
75
,
PT_LINETO
|
PT_CLOSEFIGURE
},
/* 95 */
{
81
,
81
,
PT_MOVETO
},
/* 96 */
{
80
,
81
,
PT_LINETO
},
/* 97 */
{
80
,
80
,
PT_LINETO
},
/* 98 */
{
81
,
80
,
PT_LINETO
|
PT_CLOSEFIGURE
},
/* 99 */
};
static
void
test_rectangle
(
void
)
{
HDC
hdc
=
GetDC
(
0
);
BeginPath
(
hdc
);
Rectangle
(
hdc
,
20
,
20
,
40
,
40
);
Rectangle
(
hdc
,
30
,
50
,
55
,
35
);
Rectangle
(
hdc
,
60
,
60
,
35
,
45
);
Rectangle
(
hdc
,
70
,
70
,
50
,
70
);
Rectangle
(
hdc
,
75
,
75
,
75
,
85
);
Rectangle
(
hdc
,
80
,
80
,
81
,
81
);
SetArcDirection
(
hdc
,
AD_CLOCKWISE
);
Rectangle
(
hdc
,
20
,
20
,
40
,
40
);
Rectangle
(
hdc
,
30
,
50
,
55
,
35
);
Rectangle
(
hdc
,
60
,
60
,
35
,
45
);
Rectangle
(
hdc
,
70
,
70
,
50
,
70
);
Rectangle
(
hdc
,
75
,
75
,
75
,
85
);
Rectangle
(
hdc
,
80
,
80
,
81
,
81
);
SetArcDirection
(
hdc
,
AD_COUNTERCLOCKWISE
);
SetMapMode
(
hdc
,
MM_ANISOTROPIC
);
SetViewportExtEx
(
hdc
,
-
2
,
2
,
NULL
);
Rectangle
(
hdc
,
20
,
20
,
40
,
40
);
Rectangle
(
hdc
,
30
,
50
,
55
,
35
);
SetViewportExtEx
(
hdc
,
3
,
-
3
,
NULL
);
Rectangle
(
hdc
,
20
,
20
,
40
,
40
);
Rectangle
(
hdc
,
30
,
50
,
55
,
35
);
SetWindowExtEx
(
hdc
,
-
20
,
20
,
NULL
);
Rectangle
(
hdc
,
20
,
20
,
40
,
40
);
Rectangle
(
hdc
,
24
,
22
,
21
,
20
);
SetMapMode
(
hdc
,
MM_TEXT
);
SetGraphicsMode
(
hdc
,
GM_ADVANCED
);
Rectangle
(
hdc
,
20
,
20
,
40
,
40
);
Rectangle
(
hdc
,
30
,
50
,
55
,
35
);
Rectangle
(
hdc
,
60
,
60
,
35
,
45
);
Rectangle
(
hdc
,
70
,
70
,
50
,
70
);
Rectangle
(
hdc
,
75
,
75
,
75
,
85
);
Rectangle
(
hdc
,
80
,
80
,
81
,
81
);
SetArcDirection
(
hdc
,
AD_CLOCKWISE
);
Rectangle
(
hdc
,
20
,
20
,
40
,
40
);
Rectangle
(
hdc
,
30
,
50
,
55
,
35
);
Rectangle
(
hdc
,
60
,
60
,
35
,
45
);
Rectangle
(
hdc
,
70
,
70
,
50
,
70
);
Rectangle
(
hdc
,
75
,
75
,
75
,
85
);
Rectangle
(
hdc
,
80
,
80
,
81
,
81
);
SetArcDirection
(
hdc
,
AD_COUNTERCLOCKWISE
);
EndPath
(
hdc
);
SetMapMode
(
hdc
,
MM_TEXT
);
ok_path
(
hdc
,
"rectangle_path"
,
rectangle_path
,
sizeof
(
rectangle_path
)
/
sizeof
(
path_test_t
)
);
ReleaseDC
(
0
,
hdc
);
}
START_TEST
(
path
)
{
test_path_state
();
...
...
@@ -824,4 +979,5 @@ START_TEST(path)
test_polydraw
();
test_closefigure
();
test_linedda
();
test_rectangle
();
}
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