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
d145f399
Commit
d145f399
authored
Jun 06, 2009
by
Rein Klazes
Committed by
Alexandre Julliard
Jun 08, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gdi32: Fix RectInRegion() if right < left or bottom < top.
parent
ad9036e1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
63 additions
and
5 deletions
+63
-5
region.c
dlls/gdi32/region.c
+23
-5
gdiobj.c
dlls/gdi32/tests/gdiobj.c
+40
-0
No files found.
dlls/gdi32/region.c
View file @
d145f399
...
...
@@ -1144,27 +1144,45 @@ BOOL WINAPI RectInRegion( HRGN hrgn, const RECT *rect )
{
RGNOBJ
*
obj
;
BOOL
ret
=
FALSE
;
RECT
rc
;
/* swap the coordinates to make right >= left and bottom >= top */
/* (region building rectangles are normalized the same way) */
if
(
rect
->
top
>
rect
->
bottom
)
{
rc
.
top
=
rect
->
bottom
;
rc
.
bottom
=
rect
->
top
;
}
else
{
rc
.
top
=
rect
->
top
;
rc
.
bottom
=
rect
->
bottom
;
}
if
(
rect
->
right
<
rect
->
left
)
{
rc
.
right
=
rect
->
left
;
rc
.
left
=
rect
->
right
;
}
else
{
rc
.
right
=
rect
->
right
;
rc
.
left
=
rect
->
left
;
}
if
((
obj
=
GDI_GetObjPtr
(
hrgn
,
OBJ_REGION
)))
{
RECT
*
pCurRect
,
*
pRectEnd
;
/* this is (just) a useful optimization */
if
((
obj
->
rgn
.
numRects
>
0
)
&&
EXTENTCHECK
(
&
obj
->
rgn
.
extents
,
rect
))
if
((
obj
->
rgn
.
numRects
>
0
)
&&
EXTENTCHECK
(
&
obj
->
rgn
.
extents
,
&
rc
))
{
for
(
pCurRect
=
obj
->
rgn
.
rects
,
pRectEnd
=
pCurRect
+
obj
->
rgn
.
numRects
;
pCurRect
<
pRectEnd
;
pCurRect
++
)
{
if
(
pCurRect
->
bottom
<=
r
ect
->
top
)
if
(
pCurRect
->
bottom
<=
r
c
.
top
)
continue
;
/* not far enough down yet */
if
(
pCurRect
->
top
>=
r
ect
->
bottom
)
if
(
pCurRect
->
top
>=
r
c
.
bottom
)
break
;
/* too far down */
if
(
pCurRect
->
right
<=
r
ect
->
left
)
if
(
pCurRect
->
right
<=
r
c
.
left
)
continue
;
/* not far enough over yet */
if
(
pCurRect
->
left
>=
r
ect
->
right
)
{
if
(
pCurRect
->
left
>=
r
c
.
right
)
{
continue
;
}
...
...
dlls/gdi32/tests/gdiobj.c
View file @
d145f399
...
...
@@ -266,9 +266,49 @@ static void test_GetCurrentObject(void)
DeleteDC
(
hdc
);
}
static
void
test_region
(
void
)
{
HRGN
hrgn
=
CreateRectRgn
(
10
,
10
,
20
,
20
);
RECT
rc
=
{
5
,
5
,
15
,
15
};
BOOL
ret
=
RectInRegion
(
hrgn
,
&
rc
);
ok
(
ret
,
"RectInRegion should return TRUE
\n
"
);
/* swap left and right */
SetRect
(
&
rc
,
15
,
5
,
5
,
15
);
ret
=
RectInRegion
(
hrgn
,
&
rc
);
ok
(
ret
,
"RectInRegion should return TRUE
\n
"
);
/* swap top and bottom */
SetRect
(
&
rc
,
5
,
15
,
15
,
5
);
ret
=
RectInRegion
(
hrgn
,
&
rc
);
ok
(
ret
,
"RectInRegion should return TRUE
\n
"
);
/* swap both */
SetRect
(
&
rc
,
15
,
15
,
5
,
5
);
ret
=
RectInRegion
(
hrgn
,
&
rc
);
ok
(
ret
,
"RectInRegion should return TRUE
\n
"
);
DeleteObject
(
hrgn
);
/* swap left and right in the region */
hrgn
=
CreateRectRgn
(
20
,
10
,
10
,
20
);
SetRect
(
&
rc
,
5
,
5
,
15
,
15
);
ret
=
RectInRegion
(
hrgn
,
&
rc
);
ok
(
ret
,
"RectInRegion should return TRUE
\n
"
);
/* swap left and right */
SetRect
(
&
rc
,
15
,
5
,
5
,
15
);
ret
=
RectInRegion
(
hrgn
,
&
rc
);
ok
(
ret
,
"RectInRegion should return TRUE
\n
"
);
/* swap top and bottom */
SetRect
(
&
rc
,
5
,
15
,
15
,
5
);
ret
=
RectInRegion
(
hrgn
,
&
rc
);
ok
(
ret
,
"RectInRegion should return TRUE
\n
"
);
/* swap both */
SetRect
(
&
rc
,
15
,
15
,
5
,
5
);
ret
=
RectInRegion
(
hrgn
,
&
rc
);
ok
(
ret
,
"RectInRegion should return TRUE
\n
"
);
DeleteObject
(
hrgn
);
}
START_TEST
(
gdiobj
)
{
test_gdi_objects
();
test_thread_objects
();
test_GetCurrentObject
();
test_region
();
}
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