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
ee89ce29
Commit
ee89ce29
authored
Dec 30, 2011
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gdi32: Add sanity checks for brush hatch styles.
parent
8bf48557
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
46 additions
and
0 deletions
+46
-0
brush.c
dlls/gdi32/brush.c
+8
-0
brush.c
dlls/gdi32/tests/brush.c
+37
-0
wingdi.h
include/wingdi.h
+1
-0
No files found.
dlls/gdi32/brush.c
View file @
ee89ce29
...
...
@@ -149,7 +149,15 @@ BOOL store_brush_pattern( LOGBRUSH *brush, struct brush_pattern *pattern )
{
case
BS_SOLID
:
case
BS_HOLLOW
:
return
TRUE
;
case
BS_HATCHED
:
if
(
brush
->
lbHatch
>
HS_DIAGCROSS
)
{
if
(
brush
->
lbHatch
>=
HS_API_MAX
)
return
FALSE
;
brush
->
lbStyle
=
BS_SOLID
;
brush
->
lbHatch
=
0
;
}
return
TRUE
;
case
BS_PATTERN8X8
:
...
...
dlls/gdi32/tests/brush.c
View file @
ee89ce29
...
...
@@ -79,6 +79,42 @@ static void test_solidbrush(void)
}
}
static
void
test_hatch_brush
(
void
)
{
int
i
,
size
;
HBRUSH
brush
;
LOGBRUSH
lb
;
for
(
i
=
0
;
i
<
20
;
i
++
)
{
SetLastError
(
0xdeadbeef
);
brush
=
CreateHatchBrush
(
i
,
RGB
(
12
,
34
,
56
)
);
if
(
i
<
HS_API_MAX
)
{
ok
(
brush
!=
0
,
"%u: CreateHatchBrush failed err %u
\n
"
,
i
,
GetLastError
()
);
size
=
GetObject
(
brush
,
sizeof
(
lb
),
&
lb
);
ok
(
size
==
sizeof
(
lb
),
"wrong size %u
\n
"
,
size
);
ok
(
lb
.
lbColor
==
RGB
(
12
,
34
,
56
),
"wrong color %08x
\n
"
,
lb
.
lbColor
);
if
(
i
<=
HS_DIAGCROSS
)
{
ok
(
lb
.
lbStyle
==
BS_HATCHED
,
"wrong style %u
\n
"
,
lb
.
lbStyle
);
ok
(
lb
.
lbHatch
==
i
,
"wrong hatch %lu/%u
\n
"
,
lb
.
lbHatch
,
i
);
}
else
{
ok
(
lb
.
lbStyle
==
BS_SOLID
,
"wrong style %u
\n
"
,
lb
.
lbStyle
);
ok
(
lb
.
lbHatch
==
0
,
"wrong hatch %lu
\n
"
,
lb
.
lbHatch
);
}
DeleteObject
(
brush
);
}
else
{
ok
(
!
brush
,
"%u: CreateHatchBrush succeeded
\n
"
,
i
);
ok
(
GetLastError
()
==
0xdeadbeef
,
"wrong error %u
\n
"
,
GetLastError
()
);
}
}
}
static
void
test_pattern_brush
(
void
)
{
char
buffer
[
sizeof
(
BITMAPINFOHEADER
)
+
2
*
sizeof
(
RGBQUAD
)
+
32
*
32
/
8
];
...
...
@@ -310,6 +346,7 @@ static void test_palette_brush(void)
START_TEST
(
brush
)
{
test_solidbrush
();
test_hatch_brush
();
test_pattern_brush
();
test_palette_brush
();
}
include/wingdi.h
View file @
ee89ce29
...
...
@@ -526,6 +526,7 @@ typedef LOGBRUSH PATTERN, *PPATTERN, *LPPATTERN;
#define HS_BDIAGONAL 3
#define HS_CROSS 4
#define HS_DIAGCROSS 5
#define HS_API_MAX 12
/* Fonts */
...
...
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