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
9ec5f9ad
Commit
9ec5f9ad
authored
Aug 24, 2009
by
Andrew Eikum
Committed by
Alexandre Julliard
Aug 25, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gdiplus: Support regions of more than one rectangle in GdipCreateRegionHrgn.
parent
cf5e2938
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
44 additions
and
34 deletions
+44
-34
region.c
dlls/gdiplus/region.c
+38
-26
region.c
dlls/gdiplus/tests/region.c
+6
-8
No files found.
dlls/gdiplus/region.c
View file @
9ec5f9ad
...
...
@@ -579,51 +579,63 @@ GpStatus WINGDIPAPI GdipCreateRegionRgnData(GDIPCONST BYTE *data, INT size, GpRe
*/
GpStatus
WINGDIPAPI
GdipCreateRegionHrgn
(
HRGN
hrgn
,
GpRegion
**
region
)
{
union
{
RGNDATA
data
;
char
buf
[
sizeof
(
RGNDATAHEADER
)
+
sizeof
(
RECT
)];
}
rdata
;
DWORD
size
;
GpRectF
rect
f
;
GpPath
*
path
;
LPRGNDATA
bu
f
;
LPRECT
rect
;
GpStatus
stat
;
GpPath
*
path
;
GpRegion
*
local
;
int
i
;
TRACE
(
"(%p, %p)
\n
"
,
hrgn
,
region
);
if
(
!
region
||
!
(
size
=
GetRegionData
(
hrgn
,
0
,
NULL
)))
return
InvalidParameter
;
if
(
size
>
sizeof
(
RGNDATAHEADER
)
+
sizeof
(
RECT
)){
FIXME
(
"Only simple rect regions supported.
\n
"
);
*
region
=
NULL
;
return
NotImplemented
;
}
buf
=
GdipAlloc
(
size
);
if
(
!
buf
)
return
OutOfMemory
;
if
(
!
GetRegionData
(
hrgn
,
sizeof
(
rdata
),
&
rdata
.
data
))
if
(
!
GetRegionData
(
hrgn
,
size
,
buf
)){
GdipFree
(
buf
);
return
GenericError
;
}
/* return empty region */
if
(
IsRectEmpty
(
&
rdata
.
data
.
rdh
.
rcBound
)){
stat
=
GdipCreateRegion
(
region
);
if
(
stat
==
Ok
)
GdipSetEmpty
(
*
region
);
if
(
buf
->
rdh
.
nCount
==
0
){
if
((
stat
=
GdipCreateRegion
(
&
local
))
!=
Ok
){
GdipFree
(
buf
);
return
stat
;
}
if
((
stat
=
GdipSetEmpty
(
local
))
!=
Ok
){
GdipFree
(
buf
);
GdipDeleteRegion
(
local
);
return
stat
;
}
*
region
=
local
;
GdipFree
(
buf
);
return
Ok
;
}
rectf
.
X
=
(
REAL
)
rdata
.
data
.
rdh
.
rcBound
.
left
;
rectf
.
Y
=
(
REAL
)
rdata
.
data
.
rdh
.
rcBound
.
top
;
rectf
.
Width
=
(
REAL
)
rdata
.
data
.
rdh
.
rcBound
.
right
-
rectf
.
X
;
rectf
.
Height
=
(
REAL
)
rdata
.
data
.
rdh
.
rcBound
.
bottom
-
rectf
.
Y
;
stat
=
GdipCreatePath
(
FillModeAlternate
,
&
path
);
if
(
stat
!=
Ok
)
if
((
stat
=
GdipCreatePath
(
FillModeAlternate
,
&
path
))
!=
Ok
){
GdipFree
(
buf
);
return
stat
;
}
GdipAddPathRectangle
(
path
,
rectf
.
X
,
rectf
.
Y
,
rectf
.
Width
,
rectf
.
Height
);
rect
=
(
LPRECT
)
buf
->
Buffer
;
for
(
i
=
0
;
i
<
buf
->
rdh
.
nCount
;
i
++
){
if
((
stat
=
GdipAddPathRectangle
(
path
,
(
REAL
)
rect
->
left
,
(
REAL
)
rect
->
top
,
(
REAL
)(
rect
->
right
-
rect
->
left
),
(
REAL
)(
rect
->
bottom
-
rect
->
top
)))
!=
Ok
){
GdipFree
(
buf
);
GdipDeletePath
(
path
);
return
stat
;
}
rect
++
;
}
stat
=
GdipCreateRegionPath
(
path
,
region
);
GdipDeletePath
(
path
);
GdipFree
(
buf
);
GdipDeletePath
(
path
);
return
stat
;
}
...
...
dlls/gdiplus/tests/region.c
View file @
9ec5f9ad
...
...
@@ -704,7 +704,7 @@ static void test_combinereplace(void)
static
void
test_fromhrgn
(
void
)
{
GpStatus
status
;
GpRegion
*
region
;
GpRegion
*
region
=
(
GpRegion
*
)
0xabcdef01
;
HRGN
hrgn
;
UINT
needed
;
DWORD
buf
[
220
];
...
...
@@ -720,6 +720,7 @@ static void test_fromhrgn(void)
expect
(
InvalidParameter
,
status
);
status
=
GdipCreateRegionHrgn
((
HRGN
)
0xdeadbeef
,
&
region
);
expect
(
InvalidParameter
,
status
);
ok
(
region
==
(
GpRegion
*
)
0xabcdef01
,
"Expected region not to be created
\n
"
);
/* empty rectangle */
hrgn
=
CreateRectRgn
(
0
,
0
,
0
,
0
);
...
...
@@ -788,21 +789,19 @@ static void test_fromhrgn(void)
/* ellipse */
hrgn
=
CreateEllipticRgn
(
0
,
0
,
100
,
10
);
status
=
GdipCreateRegionHrgn
(
hrgn
,
&
region
);
todo_wine
expect
(
Ok
,
status
);
expect
(
Ok
,
status
);
status
=
GdipGetRegionDataSize
(
region
,
&
needed
);
todo_wine
{
expect
(
Ok
,
status
);
ok
(
needed
==
216
||
needed
==
196
,
/* win98 */
"Got %.8x
\n
"
,
needed
);
}
status
=
GdipGetRegionData
(
region
,
(
BYTE
*
)
buf
,
sizeof
(
buf
),
&
needed
);
todo_wine
expect
(
Ok
,
status
);
expect
(
Ok
,
status
);
if
(
status
==
Ok
&&
needed
==
216
)
/* Don't try to test win98 layout */
{
todo_wine
{
expect
(
Ok
,
status
);
expect
(
216
,
needed
);
expect_dword
(
buf
,
208
);
...
...
@@ -812,8 +811,7 @@ todo_wine{
expect_dword
(
buf
+
5
,
0x000000C0
);
expect_magic
((
DWORD
*
)(
buf
+
6
));
expect_dword
(
buf
+
7
,
0x00000024
);
expect_dword
(
buf
+
8
,
0x00006000
);
/* ?? */
}
todo_wine
expect_dword
(
buf
+
8
,
0x00006000
);
/* ?? */
}
GdipDeleteRegion
(
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