Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
wine
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
frmdstryr
wine
Commits
290dd95d
Commit
290dd95d
authored
1 year ago
by
Esme Povirk
Committed by
Alexandre Julliard
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
gdiplus: Calculate region bounding box without generating HRGN.
parent
423ba9cb
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
dlls/gdiplus/region.c
+17
-17
17 additions, 17 deletions
dlls/gdiplus/region.c
dlls/gdiplus/tests/region.c
+8
-8
8 additions, 8 deletions
dlls/gdiplus/tests/region.c
with
25 additions
and
25 deletions
dlls/gdiplus/region.c
+
17
−
17
View file @
290dd95d
...
...
@@ -104,6 +104,9 @@ typedef struct packed_point
short
Y
;
}
packed_point
;
static
void
get_region_bounding_box
(
struct
region_element
*
element
,
REAL
*
min_x
,
REAL
*
min_y
,
REAL
*
max_x
,
REAL
*
max_y
,
BOOL
*
empty
,
BOOL
*
infinite
);
static
inline
INT
get_element_size
(
const
region_element
*
element
)
{
INT
needed
=
sizeof
(
DWORD
);
/* DWORD for the type */
...
...
@@ -579,9 +582,8 @@ GpStatus WINGDIPAPI GdipDeleteRegion(GpRegion *region)
*/
GpStatus
WINGDIPAPI
GdipGetRegionBounds
(
GpRegion
*
region
,
GpGraphics
*
graphics
,
GpRectF
*
rect
)
{
HRGN
hrgn
;
RECT
r
;
GpStatus
status
;
REAL
min_x
,
min_y
,
max_x
,
max_y
;
BOOL
empty
,
infinite
;
TRACE
(
"(%p, %p, %p)
\n
"
,
region
,
graphics
,
rect
);
...
...
@@ -589,31 +591,29 @@ GpStatus WINGDIPAPI GdipGetRegionBounds(GpRegion *region, GpGraphics *graphics,
return
InvalidParameter
;
/* Contrary to MSDN, native ignores the graphics transform. */
status
=
GdipGetRegionHRgn
(
region
,
NULL
,
&
hrgn
);
if
(
status
!=
Ok
)
return
status
;
get_region_bounding_box
(
&
region
->
node
,
&
min_x
,
&
min_y
,
&
max_x
,
&
max_y
,
&
empty
,
&
infinite
);
/* infinite */
if
(
!
hrgn
){
if
(
infinite
){
rect
->
X
=
rect
->
Y
=
-
(
REAL
)(
1
<<
22
);
rect
->
Width
=
rect
->
Height
=
(
REAL
)(
1
<<
23
);
TRACE
(
"%p => infinite
\n
"
,
region
);
return
Ok
;
}
if
(
GetRgnBox
(
hrgn
,
&
r
)){
rect
->
X
=
r
.
left
;
rect
->
Y
=
r
.
top
;
rect
->
Width
=
r
.
right
-
r
.
left
;
rect
->
Height
=
r
.
bottom
-
r
.
top
;
TRACE
(
"%p => %s
\n
"
,
region
,
debugstr_rectf
(
rect
));
if
(
empty
){
rect
->
X
=
rect
->
Y
=
rect
->
Width
=
rect
->
Height
=
0
.
0
;
TRACE
(
"%p => empty
\n
"
,
region
);
return
Ok
;
}
else
status
=
GenericError
;
DeleteObject
(
hrgn
);
rect
->
X
=
min_x
;
rect
->
Y
=
min_y
;
rect
->
Width
=
max_x
-
min_x
;
rect
->
Height
=
max_y
-
min_y
;
TRACE
(
"%p => %s
\n
"
,
region
,
debugstr_rectf
(
rect
));
return
status
;
return
Ok
;
}
/*****************************************************************************
...
...
This diff is collapsed.
Click to expand it.
dlls/gdiplus/tests/region.c
+
8
−
8
View file @
290dd95d
...
...
@@ -1823,10 +1823,10 @@ static void test_getbounds(void)
rectf
.
Height
=
rectf
.
Width
=
0
.
0
;
status
=
GdipGetRegionBounds
(
region
,
graphics
,
&
rectf
);
ok
(
status
==
Ok
,
"status %08x
\n
"
,
status
);
todo_wine
ok
(
rectf
.
X
==
0
.
125
,
"Expected X = 0.0, got %.2f
\n
"
,
rectf
.
X
);
todo_wine
ok
(
rectf
.
Y
==
1
.
125
,
"Expected Y = 0.0, got %.2f
\n
"
,
rectf
.
Y
);
todo_wine
ok
(
rectf
.
Width
==
2
.
125
,
"Expected width = 0.0, got %.2f
\n
"
,
rectf
.
Width
);
todo_wine
ok
(
rectf
.
Height
==
3
.
125
,
"Expected height = 0.0, got %.2f
\n
"
,
rectf
.
Height
);
ok
(
rectf
.
X
==
0
.
125
,
"Expected X = 0.0, got %.2f
\n
"
,
rectf
.
X
);
ok
(
rectf
.
Y
==
1
.
125
,
"Expected Y = 0.0, got %.2f
\n
"
,
rectf
.
Y
);
ok
(
rectf
.
Width
==
2
.
125
,
"Expected width = 0.0, got %.2f
\n
"
,
rectf
.
Width
);
ok
(
rectf
.
Height
==
3
.
125
,
"Expected height = 0.0, got %.2f
\n
"
,
rectf
.
Height
);
/* test path */
status
=
GdipCreatePath
(
FillModeAlternate
,
&
path
);
...
...
@@ -1841,10 +1841,10 @@ static void test_getbounds(void)
rectf
.
Height
=
rectf
.
Width
=
0
.
0
;
status
=
GdipGetRegionBounds
(
region
,
graphics
,
&
rectf
);
ok
(
status
==
Ok
,
"status %08x
\n
"
,
status
);
todo_wine
ok
(
rectf
.
X
==
0
.
125
,
"Expected X = 0.0, got %.2f
\n
"
,
rectf
.
X
);
todo_wine
ok
(
rectf
.
Y
==
1
.
125
,
"Expected Y = 0.0, got %.2f
\n
"
,
rectf
.
Y
);
todo_wine
ok
(
rectf
.
Width
==
2
.
125
,
"Expected width = 0.0, got %.2f
\n
"
,
rectf
.
Width
);
todo_wine
ok
(
rectf
.
Height
==
3
.
125
,
"Expected height = 0.0, got %.2f
\n
"
,
rectf
.
Height
);
ok
(
rectf
.
X
==
0
.
125
,
"Expected X = 0.0, got %.2f
\n
"
,
rectf
.
X
);
ok
(
rectf
.
Y
==
1
.
125
,
"Expected Y = 0.0, got %.2f
\n
"
,
rectf
.
Y
);
ok
(
rectf
.
Width
==
2
.
125
,
"Expected width = 0.0, got %.2f
\n
"
,
rectf
.
Width
);
ok
(
rectf
.
Height
==
3
.
125
,
"Expected height = 0.0, got %.2f
\n
"
,
rectf
.
Height
);
status
=
GdipDeleteRegion
(
region
);
ok
(
status
==
Ok
,
"status %08x
\n
"
,
status
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment