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
2329a2fa
Commit
2329a2fa
authored
Mar 07, 2018
by
Vincent Povirk
Committed by
Alexandre Julliard
Mar 07, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gdiplus: Transform region rects as rects when possible.
Signed-off-by:
Vincent Povirk
<
vincent@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
bd7fb5b5
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
75 additions
and
1 deletion
+75
-1
region.c
dlls/gdiplus/region.c
+37
-1
region.c
dlls/gdiplus/tests/region.c
+38
-0
No files found.
dlls/gdiplus/region.c
View file @
2329a2fa
...
...
@@ -1398,10 +1398,46 @@ static GpStatus transform_region_element(region_element* element, GpMatrix *matr
return
Ok
;
case
RegionDataRect
:
{
/* We can't transform a rectangle, so convert it to a path. */
GpRegion
*
new_region
;
GpPath
*
path
;
if
(
matrix
->
matrix
[
1
]
==
0
.
0
&&
matrix
->
matrix
[
2
]
==
0
.
0
)
{
GpPointF
points
[
2
];
points
[
0
].
X
=
element
->
elementdata
.
rect
.
X
;
points
[
0
].
Y
=
element
->
elementdata
.
rect
.
Y
;
points
[
1
].
X
=
element
->
elementdata
.
rect
.
X
+
element
->
elementdata
.
rect
.
Width
;
points
[
1
].
Y
=
element
->
elementdata
.
rect
.
Y
+
element
->
elementdata
.
rect
.
Height
;
stat
=
GdipTransformMatrixPoints
(
matrix
,
points
,
2
);
if
(
stat
!=
Ok
)
return
stat
;
if
(
points
[
0
].
X
>
points
[
1
].
X
)
{
REAL
temp
;
temp
=
points
[
0
].
X
;
points
[
0
].
X
=
points
[
1
].
X
;
points
[
1
].
X
=
temp
;
}
if
(
points
[
0
].
Y
>
points
[
1
].
Y
)
{
REAL
temp
;
temp
=
points
[
0
].
Y
;
points
[
0
].
Y
=
points
[
1
].
Y
;
points
[
1
].
Y
=
temp
;
}
element
->
elementdata
.
rect
.
X
=
points
[
0
].
X
;
element
->
elementdata
.
rect
.
Y
=
points
[
0
].
Y
;
element
->
elementdata
.
rect
.
Width
=
points
[
1
].
X
-
points
[
0
].
X
;
element
->
elementdata
.
rect
.
Height
=
points
[
1
].
Y
-
points
[
0
].
Y
;
return
Ok
;
}
/* We can't rotate/shear a rectangle, so convert it to a path. */
stat
=
GdipCreatePath
(
FillModeAlternate
,
&
path
);
if
(
stat
==
Ok
)
{
...
...
dlls/gdiplus/tests/region.c
View file @
2329a2fa
...
...
@@ -1441,6 +1441,22 @@ static void test_translate(void)
ReleaseDC
(
0
,
hdc
);
}
static
DWORD
get_region_type
(
GpRegion
*
region
)
{
DWORD
*
data
;
DWORD
size
;
DWORD
result
;
DWORD
status
;
status
=
GdipGetRegionDataSize
(
region
,
&
size
);
expect
(
Ok
,
status
);
data
=
GdipAlloc
(
size
);
status
=
GdipGetRegionData
(
region
,
(
BYTE
*
)
data
,
size
,
NULL
);
ok
(
status
==
Ok
||
status
==
InsufficientBuffer
,
"unexpected status 0x%x
\n
"
,
status
);
result
=
data
[
4
];
GdipFree
(
data
);
return
result
;
}
static
void
test_transform
(
void
)
{
GpRegion
*
region
,
*
region2
;
...
...
@@ -1451,6 +1467,7 @@ static void test_transform(void)
GpStatus
status
;
HDC
hdc
=
GetDC
(
0
);
BOOL
res
;
DWORD
type
;
status
=
GdipCreateFromHDC
(
hdc
,
&
graphics
);
expect
(
Ok
,
status
);
...
...
@@ -1483,6 +1500,8 @@ static void test_transform(void)
status
=
GdipIsEqualRegion
(
region
,
region2
,
graphics
,
&
res
);
expect
(
Ok
,
status
);
ok
(
res
,
"Expected to be equal.
\n
"
);
type
=
get_region_type
(
region
);
expect
(
0x10000003
/* RegionDataInfiniteRect */
,
type
);
/* empty */
status
=
GdipSetEmpty
(
region
);
...
...
@@ -1497,6 +1516,8 @@ static void test_transform(void)
status
=
GdipIsEqualRegion
(
region
,
region2
,
graphics
,
&
res
);
expect
(
Ok
,
status
);
ok
(
res
,
"Expected to be equal.
\n
"
);
type
=
get_region_type
(
region
);
expect
(
0x10000002
/* RegionDataEmptyRect */
,
type
);
/* rect */
rectf
.
X
=
10
.
0
;
...
...
@@ -1516,6 +1537,8 @@ static void test_transform(void)
status
=
GdipIsEqualRegion
(
region
,
region2
,
graphics
,
&
res
);
expect
(
Ok
,
status
);
ok
(
res
,
"Expected to be equal.
\n
"
);
type
=
get_region_type
(
region
);
expect
(
0x10000000
/* RegionDataRect */
,
type
);
/* path */
status
=
GdipAddPathEllipse
(
path
,
0
.
0
,
10
.
0
,
100
.
0
,
150
.
0
);
...
...
@@ -1534,6 +1557,21 @@ static void test_transform(void)
status
=
GdipIsEqualRegion
(
region
,
region2
,
graphics
,
&
res
);
expect
(
Ok
,
status
);
ok
(
res
,
"Expected to be equal.
\n
"
);
type
=
get_region_type
(
region
);
expect
(
0x10000001
/* RegionDataPath */
,
type
);
/* rotated rect -> path */
rectf
.
X
=
10
.
0
;
rectf
.
Y
=
0
.
0
;
rectf
.
Width
=
rectf
.
Height
=
100
.
0
;
status
=
GdipCombineRegionRect
(
region
,
&
rectf
,
CombineModeReplace
);
expect
(
Ok
,
status
);
status
=
GdipRotateMatrix
(
matrix
,
45
.
0
,
MatrixOrderAppend
);
expect
(
Ok
,
status
);
status
=
GdipTransformRegion
(
region
,
matrix
);
expect
(
Ok
,
status
);
type
=
get_region_type
(
region
);
expect
(
0x10000001
/* RegionDataPath */
,
type
);
status
=
GdipDeleteRegion
(
region
);
expect
(
Ok
,
status
);
...
...
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