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
40d8876f
Commit
40d8876f
authored
Sep 30, 2010
by
Vincent Povirk
Committed by
Alexandre Julliard
Oct 01, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gdiplus: Implement GdipTransformRegion.
parent
1eb12cb0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
165 additions
and
2 deletions
+165
-2
region.c
dlls/gdiplus/region.c
+57
-2
region.c
dlls/gdiplus/tests/region.c
+108
-0
No files found.
dlls/gdiplus/region.c
View file @
40d8876f
...
@@ -1248,11 +1248,66 @@ GpStatus WINGDIPAPI GdipSetInfinite(GpRegion *region)
...
@@ -1248,11 +1248,66 @@ GpStatus WINGDIPAPI GdipSetInfinite(GpRegion *region)
return
stat
;
return
stat
;
}
}
/* Transforms GpRegion elements with given matrix */
static
GpStatus
transform_region_element
(
region_element
*
element
,
GpMatrix
*
matrix
)
{
GpStatus
stat
;
switch
(
element
->
type
)
{
case
RegionDataEmptyRect
:
case
RegionDataInfiniteRect
:
return
Ok
;
case
RegionDataRect
:
{
/* We can't transform a rectangle, so convert it to a path. */
GpRegion
*
new_region
;
GpPath
*
path
;
stat
=
GdipCreatePath
(
FillModeAlternate
,
&
path
);
if
(
stat
==
Ok
)
{
stat
=
GdipAddPathRectangle
(
path
,
element
->
elementdata
.
rect
.
X
,
element
->
elementdata
.
rect
.
Y
,
element
->
elementdata
.
rect
.
Width
,
element
->
elementdata
.
rect
.
Height
);
if
(
stat
==
Ok
)
stat
=
GdipCreateRegionPath
(
path
,
&
new_region
);
GdipDeletePath
(
path
);
}
if
(
stat
==
Ok
)
{
/* Steal the element from the created region. */
memcpy
(
element
,
&
new_region
->
node
,
sizeof
(
region_element
));
HeapFree
(
GetProcessHeap
(),
0
,
new_region
);
}
else
return
stat
;
}
/* Fall-through to do the actual conversion. */
case
RegionDataPath
:
stat
=
GdipTransformMatrixPoints
(
matrix
,
element
->
elementdata
.
pathdata
.
path
->
pathdata
.
Points
,
element
->
elementdata
.
pathdata
.
path
->
pathdata
.
Count
);
return
stat
;
default:
stat
=
transform_region_element
(
element
->
elementdata
.
combine
.
left
,
matrix
);
if
(
stat
==
Ok
)
stat
=
transform_region_element
(
element
->
elementdata
.
combine
.
right
,
matrix
);
return
stat
;
}
}
GpStatus
WINGDIPAPI
GdipTransformRegion
(
GpRegion
*
region
,
GpMatrix
*
matrix
)
GpStatus
WINGDIPAPI
GdipTransformRegion
(
GpRegion
*
region
,
GpMatrix
*
matrix
)
{
{
FIXME
(
"(%p, %p): stub
\n
"
,
region
,
matrix
);
TRACE
(
"(%p, %p)
\n
"
,
region
,
matrix
);
return
NotImplemented
;
if
(
!
region
||
!
matrix
)
return
InvalidParameter
;
return
transform_region_element
(
&
region
->
node
,
matrix
);
}
}
/* Translates GpRegion elements with specified offsets */
/* Translates GpRegion elements with specified offsets */
...
...
dlls/gdiplus/tests/region.c
View file @
40d8876f
...
@@ -1123,6 +1123,113 @@ static void test_translate(void)
...
@@ -1123,6 +1123,113 @@ static void test_translate(void)
ReleaseDC
(
0
,
hdc
);
ReleaseDC
(
0
,
hdc
);
}
}
static
void
test_transform
(
void
)
{
GpRegion
*
region
,
*
region2
;
GpMatrix
*
matrix
;
GpGraphics
*
graphics
;
GpPath
*
path
;
GpRectF
rectf
;
GpStatus
status
;
HDC
hdc
=
GetDC
(
0
);
BOOL
res
;
status
=
GdipCreateFromHDC
(
hdc
,
&
graphics
);
expect
(
Ok
,
status
);
status
=
GdipCreatePath
(
FillModeAlternate
,
&
path
);
expect
(
Ok
,
status
);
status
=
GdipCreateRegion
(
&
region
);
expect
(
Ok
,
status
);
status
=
GdipCreateRegion
(
&
region2
);
expect
(
Ok
,
status
);
status
=
GdipCreateMatrix
(
&
matrix
);
expect
(
Ok
,
status
);
status
=
GdipScaleMatrix
(
matrix
,
2
.
0
,
3
.
0
,
MatrixOrderAppend
);
expect
(
Ok
,
status
);
/* NULL */
status
=
GdipTransformRegion
(
NULL
,
matrix
);
expect
(
InvalidParameter
,
status
);
status
=
GdipTransformRegion
(
region
,
NULL
);
expect
(
InvalidParameter
,
status
);
/* infinite */
status
=
GdipTransformRegion
(
region
,
matrix
);
expect
(
Ok
,
status
);
res
=
FALSE
;
status
=
GdipIsEqualRegion
(
region
,
region2
,
graphics
,
&
res
);
expect
(
Ok
,
status
);
ok
(
res
,
"Expected to be equal.
\n
"
);
/* empty */
status
=
GdipSetEmpty
(
region
);
expect
(
Ok
,
status
);
status
=
GdipTransformRegion
(
region
,
matrix
);
expect
(
Ok
,
status
);
status
=
GdipSetEmpty
(
region2
);
expect
(
Ok
,
status
);
res
=
FALSE
;
status
=
GdipIsEqualRegion
(
region
,
region2
,
graphics
,
&
res
);
expect
(
Ok
,
status
);
ok
(
res
,
"Expected to be equal.
\n
"
);
/* rect */
rectf
.
X
=
10
.
0
;
rectf
.
Y
=
0
.
0
;
rectf
.
Width
=
rectf
.
Height
=
100
.
0
;
status
=
GdipCombineRegionRect
(
region
,
&
rectf
,
CombineModeReplace
);
expect
(
Ok
,
status
);
rectf
.
X
=
20
.
0
;
rectf
.
Y
=
0
.
0
;
rectf
.
Width
=
200
.
0
;
rectf
.
Height
=
300
.
0
;
status
=
GdipCombineRegionRect
(
region2
,
&
rectf
,
CombineModeReplace
);
expect
(
Ok
,
status
);
status
=
GdipTransformRegion
(
region
,
matrix
);
expect
(
Ok
,
status
);
res
=
FALSE
;
status
=
GdipIsEqualRegion
(
region
,
region2
,
graphics
,
&
res
);
expect
(
Ok
,
status
);
ok
(
res
,
"Expected to be equal.
\n
"
);
/* path */
status
=
GdipAddPathEllipse
(
path
,
0
.
0
,
10
.
0
,
100
.
0
,
150
.
0
);
expect
(
Ok
,
status
);
status
=
GdipCombineRegionPath
(
region
,
path
,
CombineModeReplace
);
expect
(
Ok
,
status
);
status
=
GdipResetPath
(
path
);
expect
(
Ok
,
status
);
status
=
GdipAddPathEllipse
(
path
,
0
.
0
,
30
.
0
,
200
.
0
,
450
.
0
);
expect
(
Ok
,
status
);
status
=
GdipCombineRegionPath
(
region2
,
path
,
CombineModeReplace
);
expect
(
Ok
,
status
);
status
=
GdipTransformRegion
(
region
,
matrix
);
expect
(
Ok
,
status
);
res
=
FALSE
;
status
=
GdipIsEqualRegion
(
region
,
region2
,
graphics
,
&
res
);
expect
(
Ok
,
status
);
ok
(
res
,
"Expected to be equal.
\n
"
);
status
=
GdipDeleteRegion
(
region
);
expect
(
Ok
,
status
);
status
=
GdipDeleteRegion
(
region2
);
expect
(
Ok
,
status
);
status
=
GdipDeleteGraphics
(
graphics
);
expect
(
Ok
,
status
);
status
=
GdipDeletePath
(
path
);
expect
(
Ok
,
status
);
status
=
GdipDeleteMatrix
(
matrix
);
expect
(
Ok
,
status
);
ReleaseDC
(
0
,
hdc
);
}
static
void
test_getbounds
(
void
)
static
void
test_getbounds
(
void
)
{
{
GpRegion
*
region
;
GpRegion
*
region
;
...
@@ -1634,6 +1741,7 @@ START_TEST(region)
...
@@ -1634,6 +1741,7 @@ START_TEST(region)
test_gethrgn
();
test_gethrgn
();
test_isequal
();
test_isequal
();
test_translate
();
test_translate
();
test_transform
();
test_getbounds
();
test_getbounds
();
test_isvisiblepoint
();
test_isvisiblepoint
();
test_isvisiblerect
();
test_isvisiblerect
();
...
...
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