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
2032b0d3
Commit
2032b0d3
authored
Aug 25, 2009
by
Andrew Eikum
Committed by
Alexandre Julliard
Aug 26, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gdiplus: Implement GdipIsVisibleRegionRect.
parent
32996e0a
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
261 additions
and
2 deletions
+261
-2
gdiplus.spec
dlls/gdiplus/gdiplus.spec
+2
-2
gdiplus_private.h
dlls/gdiplus/gdiplus_private.h
+5
-0
region.c
dlls/gdiplus/region.c
+47
-0
region.c
dlls/gdiplus/tests/region.c
+205
-0
gdiplusflat.h
include/gdiplusflat.h
+2
-0
No files found.
dlls/gdiplus/gdiplus.spec
View file @
2032b0d3
...
...
@@ -433,8 +433,8 @@
@ stdcall GdipIsVisibleRectI(ptr long long long long ptr)
@ stdcall GdipIsVisibleRegionPoint(ptr long long ptr ptr)
@ stdcall GdipIsVisibleRegionPointI(ptr long long ptr ptr)
@ st
ub GdipIsVisibleRegionRect
@ st
ub GdipIsVisibleRegionRectI
@ st
dcall GdipIsVisibleRegionRect(ptr long long long long ptr ptr)
@ st
dcall GdipIsVisibleRegionRectI(ptr long long long long ptr ptr)
@ stdcall GdipLoadImageFromFile(wstr ptr)
@ stdcall GdipLoadImageFromFileICM(wstr ptr)
@ stdcall GdipLoadImageFromStream(ptr ptr)
...
...
dlls/gdiplus/gdiplus_private.h
View file @
2032b0d3
...
...
@@ -68,6 +68,11 @@ static inline INT roundr(REAL x)
return
(
INT
)
floorf
(
x
+
0
.
5
);
}
static
inline
INT
ceilr
(
REAL
x
)
{
return
(
INT
)
ceilf
(
x
);
}
static
inline
REAL
deg2rad
(
REAL
degrees
)
{
return
M_PI
*
degrees
/
180
.
0
;
...
...
dlls/gdiplus/region.c
View file @
2032b0d3
...
...
@@ -1128,6 +1128,53 @@ GpStatus WINGDIPAPI GdipIsInfiniteRegion(GpRegion *region, GpGraphics *graphics,
}
/*****************************************************************************
* GdipIsVisibleRegionRect [GDIPLUS.@]
*/
GpStatus
WINGDIPAPI
GdipIsVisibleRegionRect
(
GpRegion
*
region
,
REAL
x
,
REAL
y
,
REAL
w
,
REAL
h
,
GpGraphics
*
graphics
,
BOOL
*
res
)
{
HRGN
hrgn
;
GpStatus
stat
;
RECT
rect
;
TRACE
(
"(%p, %.2f, %.2f, %.2f, %.2f, %p, %p)
\n
"
,
region
,
x
,
y
,
w
,
h
,
graphics
,
res
);
if
(
!
region
||
!
res
)
return
InvalidParameter
;
if
((
stat
=
GdipGetRegionHRgn
(
region
,
NULL
,
&
hrgn
))
!=
Ok
)
return
stat
;
/* infinite */
if
(
!
hrgn
){
*
res
=
TRUE
;
return
Ok
;
}
rect
.
left
=
ceilr
(
x
);
rect
.
top
=
ceilr
(
y
);
rect
.
right
=
ceilr
(
x
+
w
);
rect
.
bottom
=
ceilr
(
y
+
h
);
*
res
=
RectInRegion
(
hrgn
,
&
rect
);
DeleteObject
(
hrgn
);
return
Ok
;
}
/*****************************************************************************
* GdipIsVisibleRegionRectI [GDIPLUS.@]
*/
GpStatus
WINGDIPAPI
GdipIsVisibleRegionRectI
(
GpRegion
*
region
,
INT
x
,
INT
y
,
INT
w
,
INT
h
,
GpGraphics
*
graphics
,
BOOL
*
res
)
{
TRACE
(
"(%p, %d, %d, %d, %d, %p, %p)
\n
"
,
region
,
x
,
y
,
w
,
h
,
graphics
,
res
);
if
(
!
region
||
!
res
)
return
InvalidParameter
;
return
GdipIsVisibleRegionRect
(
region
,
(
REAL
)
x
,
(
REAL
)
y
,
(
REAL
)
w
,
(
REAL
)
h
,
graphics
,
res
);
}
/*****************************************************************************
* GdipIsVisibleRegionPoint [GDIPLUS.@]
*/
GpStatus
WINGDIPAPI
GdipIsVisibleRegionPoint
(
GpRegion
*
region
,
REAL
x
,
REAL
y
,
GpGraphics
*
graphics
,
BOOL
*
res
)
...
...
dlls/gdiplus/tests/region.c
View file @
2032b0d3
...
...
@@ -1407,6 +1407,210 @@ static void test_isvisiblepoint(void)
ReleaseDC
(
0
,
hdc
);
}
static
void
test_isvisiblerect
(
void
)
{
HDC
hdc
=
GetDC
(
0
);
GpGraphics
*
graphics
;
GpRegion
*
region
;
GpPath
*
path
;
GpRectF
rectf
;
GpStatus
status
;
BOOL
res
;
REAL
x
,
y
,
w
,
h
;
status
=
GdipCreateFromHDC
(
hdc
,
&
graphics
);
expect
(
Ok
,
status
);
status
=
GdipCreateRegion
(
&
region
);
expect
(
Ok
,
status
);
/* null parameters */
status
=
GdipIsVisibleRegionRect
(
NULL
,
0
,
0
,
0
,
0
,
graphics
,
&
res
);
expect
(
InvalidParameter
,
status
);
status
=
GdipIsVisibleRegionRectI
(
NULL
,
0
,
0
,
0
,
0
,
graphics
,
&
res
);
expect
(
InvalidParameter
,
status
);
status
=
GdipIsVisibleRegionRect
(
region
,
0
,
0
,
0
,
0
,
NULL
,
&
res
);
expect
(
Ok
,
status
);
status
=
GdipIsVisibleRegionRectI
(
region
,
0
,
0
,
0
,
0
,
NULL
,
&
res
);
expect
(
Ok
,
status
);
status
=
GdipIsVisibleRegionRect
(
region
,
0
,
0
,
0
,
0
,
graphics
,
NULL
);
expect
(
InvalidParameter
,
status
);
status
=
GdipIsVisibleRegionRectI
(
region
,
0
,
0
,
0
,
0
,
graphics
,
NULL
);
expect
(
InvalidParameter
,
status
);
/* infinite region */
status
=
GdipIsInfiniteRegion
(
region
,
graphics
,
&
res
);
expect
(
Ok
,
status
);
ok
(
res
==
TRUE
,
"Region should be infinite
\n
"
);
x
=
10
;
w
=
10
;
y
=
10
;
h
=
10
;
status
=
GdipIsVisibleRegionRect
(
region
,
x
,
y
,
w
,
h
,
graphics
,
&
res
);
expect
(
Ok
,
status
);
ok
(
res
==
TRUE
,
"Expected (%.2f, %.2f, %.2f, %.2f) to be visible
\n
"
,
x
,
y
,
w
,
h
);
x
=
-
10
;
w
=
5
;
y
=
-
10
;
h
=
5
;
status
=
GdipIsVisibleRegionRect
(
region
,
x
,
y
,
w
,
h
,
graphics
,
&
res
);
expect
(
Ok
,
status
);
ok
(
res
==
TRUE
,
"Expected (%.2f, %.2f, %.2f, %.2f) to be visible
\n
"
,
x
,
y
,
w
,
h
);
/* rectangular region */
rectf
.
X
=
10
;
rectf
.
Y
=
20
;
rectf
.
Width
=
30
;
rectf
.
Height
=
40
;
status
=
GdipCombineRegionRect
(
region
,
&
rectf
,
CombineModeIntersect
);
expect
(
Ok
,
status
);
/* entirely within the region */
x
=
11
;
w
=
10
;
y
=
12
;
h
=
10
;
status
=
GdipIsVisibleRegionRect
(
region
,
x
,
y
,
w
,
h
,
graphics
,
&
res
);
expect
(
Ok
,
status
);
ok
(
res
==
TRUE
,
"Expected (%.2f, %.2f, %.2f, %.2f) to be visible
\n
"
,
x
,
y
,
w
,
h
);
status
=
GdipIsVisibleRegionRectI
(
region
,
(
INT
)
x
,
(
INT
)
y
,
(
INT
)
w
,
(
INT
)
h
,
graphics
,
&
res
);
expect
(
Ok
,
status
);
ok
(
res
==
TRUE
,
"Expected (%d, %d, %d, %d) to be visible
\n
"
,
(
INT
)
x
,
(
INT
)
y
,
(
INT
)
w
,
(
INT
)
h
);
/* entirely outside of the region */
x
=
0
;
w
=
5
;
y
=
0
;
h
=
5
;
status
=
GdipIsVisibleRegionRect
(
region
,
x
,
y
,
w
,
h
,
graphics
,
&
res
);
expect
(
Ok
,
status
);
ok
(
res
==
FALSE
,
"Expected (%.2f, %.2f, %.2f, %.2f) not to be visible
\n
"
,
x
,
y
,
w
,
h
);
status
=
GdipIsVisibleRegionRectI
(
region
,
(
INT
)
x
,
(
INT
)
y
,
(
INT
)
w
,
(
INT
)
h
,
graphics
,
&
res
);
expect
(
Ok
,
status
);
ok
(
res
==
FALSE
,
"Expected (%d, %d, %d, %d) not to be visible
\n
"
,
(
INT
)
x
,
(
INT
)
y
,
(
INT
)
w
,
(
INT
)
h
);
/* corner cases */
x
=
0
;
w
=
10
;
y
=
0
;
h
=
20
;
status
=
GdipIsVisibleRegionRect
(
region
,
x
,
y
,
w
,
h
,
graphics
,
&
res
);
expect
(
Ok
,
status
);
ok
(
res
==
FALSE
,
"Expected (%.2f, %.2f, %.2f, %.2f) not to be visible
\n
"
,
x
,
y
,
w
,
h
);
x
=
0
;
w
=
10
.
25
;
y
=
0
;
h
=
20
.
25
;
status
=
GdipIsVisibleRegionRect
(
region
,
x
,
y
,
w
,
h
,
graphics
,
&
res
);
expect
(
Ok
,
status
);
ok
(
res
==
TRUE
,
"Expected (%.2f, %.2f, %.2f, %.2f) to be visible
\n
"
,
x
,
y
,
w
,
h
);
x
=
39
;
w
=
10
;
y
=
59
;
h
=
10
;
status
=
GdipIsVisibleRegionRect
(
region
,
x
,
y
,
w
,
h
,
graphics
,
&
res
);
expect
(
Ok
,
status
);
ok
(
res
==
TRUE
,
"Expected (%.2f, %.2f, %.2f, %.2f) to be visible
\n
"
,
x
,
y
,
w
,
h
);
x
=
39
.
25
;
w
=
10
;
y
=
59
.
25
;
h
=
10
;
status
=
GdipIsVisibleRegionRect
(
region
,
x
,
y
,
w
,
h
,
graphics
,
&
res
);
expect
(
Ok
,
status
);
ok
(
res
==
FALSE
,
"Expected (%.2f, %.2f, %.2f, %.2f) not to be visible
\n
"
,
x
,
y
,
w
,
h
);
/* corners outside, but some intersection */
x
=
0
;
w
=
100
;
y
=
0
;
h
=
100
;
status
=
GdipIsVisibleRegionRect
(
region
,
x
,
y
,
w
,
h
,
graphics
,
&
res
);
expect
(
Ok
,
status
);
ok
(
res
==
TRUE
,
"Expected (%.2f, %.2f, %.2f, %.2f) to be visible
\n
"
,
x
,
y
,
w
,
h
);
x
=
0
;
w
=
100
;
y
=
0
;
h
=
40
;
status
=
GdipIsVisibleRegionRect
(
region
,
x
,
y
,
w
,
h
,
graphics
,
&
res
);
expect
(
Ok
,
status
);
ok
(
res
==
TRUE
,
"Expected (%.2f, %.2f, %.2f, %.2f) to be visible
\n
"
,
x
,
y
,
w
,
h
);
x
=
0
;
w
=
25
;
y
=
0
;
h
=
100
;
status
=
GdipIsVisibleRegionRect
(
region
,
x
,
y
,
w
,
h
,
graphics
,
&
res
);
expect
(
Ok
,
status
);
ok
(
res
==
TRUE
,
"Expected (%.2f, %.2f, %.2f, %.2f) to be visible
\n
"
,
x
,
y
,
w
,
h
);
/* translate into the center of the rectangle */
status
=
GdipTranslateWorldTransform
(
graphics
,
25
,
40
,
MatrixOrderAppend
);
expect
(
Ok
,
status
);
/* native ignores the world transform, so treat these as if
* no transform exists */
x
=
0
;
w
=
5
;
y
=
0
;
h
=
5
;
status
=
GdipIsVisibleRegionRect
(
region
,
x
,
y
,
w
,
h
,
graphics
,
&
res
);
expect
(
Ok
,
status
);
ok
(
res
==
FALSE
,
"Expected (%.2f, %.2f, %.2f, %.2f) not to be visible
\n
"
,
x
,
y
,
w
,
h
);
status
=
GdipIsVisibleRegionRectI
(
region
,
(
INT
)
x
,
(
INT
)
y
,
(
INT
)
w
,
(
INT
)
h
,
graphics
,
&
res
);
expect
(
Ok
,
status
);
ok
(
res
==
FALSE
,
"Expected (%d, %d, %d, %d) not to be visible
\n
"
,
(
INT
)
x
,
(
INT
)
y
,
(
INT
)
w
,
(
INT
)
h
);
x
=
11
;
w
=
10
;
y
=
12
;
h
=
10
;
status
=
GdipIsVisibleRegionRect
(
region
,
x
,
y
,
w
,
h
,
graphics
,
&
res
);
expect
(
Ok
,
status
);
ok
(
res
==
TRUE
,
"Expected (%.2f, %.2f, %.2f, %.2f) to be visible
\n
"
,
x
,
y
,
w
,
h
);
status
=
GdipIsVisibleRegionRectI
(
region
,
(
INT
)
x
,
(
INT
)
y
,
(
INT
)
w
,
(
INT
)
h
,
graphics
,
&
res
);
expect
(
Ok
,
status
);
ok
(
res
==
TRUE
,
"Expected (%d, %d, %d, %d) to be visible
\n
"
,
(
INT
)
x
,
(
INT
)
y
,
(
INT
)
w
,
(
INT
)
h
);
/* translate back to origin */
status
=
GdipTranslateWorldTransform
(
graphics
,
-
25
,
-
40
,
MatrixOrderAppend
);
expect
(
Ok
,
status
);
/* region from path */
status
=
GdipCreatePath
(
FillModeAlternate
,
&
path
);
expect
(
Ok
,
status
);
status
=
GdipAddPathEllipse
(
path
,
10
,
20
,
30
,
40
);
expect
(
Ok
,
status
);
status
=
GdipCombineRegionPath
(
region
,
path
,
CombineModeReplace
);
expect
(
Ok
,
status
);
x
=
0
;
w
=
12
;
y
=
0
;
h
=
22
;
status
=
GdipIsVisibleRegionRect
(
region
,
x
,
y
,
w
,
h
,
graphics
,
&
res
);
expect
(
Ok
,
status
);
ok
(
res
==
FALSE
,
"Expected (%.2f, %.2f, %.2f, %.2f) not to be visible
\n
"
,
x
,
y
,
w
,
h
);
status
=
GdipIsVisibleRegionRectI
(
region
,
(
INT
)
x
,
(
INT
)
y
,
(
INT
)
w
,
(
INT
)
h
,
graphics
,
&
res
);
expect
(
Ok
,
status
);
ok
(
res
==
FALSE
,
"Expected (%d, %d, %d, %d) not to be visible
\n
"
,
(
INT
)
x
,
(
INT
)
y
,
(
INT
)
w
,
(
INT
)
h
);
x
=
0
;
w
=
25
;
y
=
0
;
h
=
40
;
status
=
GdipIsVisibleRegionRect
(
region
,
x
,
y
,
w
,
h
,
graphics
,
&
res
);
expect
(
Ok
,
status
);
ok
(
res
==
TRUE
,
"Expected (%.2f, %.2f, %.2f, %.2f) to be visible
\n
"
,
x
,
y
,
w
,
h
);
status
=
GdipIsVisibleRegionRectI
(
region
,
(
INT
)
x
,
(
INT
)
y
,
(
INT
)
w
,
(
INT
)
h
,
graphics
,
&
res
);
expect
(
Ok
,
status
);
ok
(
res
==
TRUE
,
"Expected (%d, %d, %d, %d) to be visible
\n
"
,
(
INT
)
x
,
(
INT
)
y
,
(
INT
)
w
,
(
INT
)
h
);
x
=
38
;
w
=
10
;
y
=
55
;
h
=
10
;
status
=
GdipIsVisibleRegionRect
(
region
,
x
,
y
,
w
,
h
,
graphics
,
&
res
);
expect
(
Ok
,
status
);
ok
(
res
==
FALSE
,
"Expected (%.2f, %.2f, %.2f, %.2f) not to be visible
\n
"
,
x
,
y
,
w
,
h
);
status
=
GdipIsVisibleRegionRectI
(
region
,
(
INT
)
x
,
(
INT
)
y
,
(
INT
)
w
,
(
INT
)
h
,
graphics
,
&
res
);
expect
(
Ok
,
status
);
ok
(
res
==
FALSE
,
"Expected (%d, %d, %d, %d) not to be visible
\n
"
,
(
INT
)
x
,
(
INT
)
y
,
(
INT
)
w
,
(
INT
)
h
);
x
=
0
;
w
=
100
;
y
=
0
;
h
=
100
;
status
=
GdipIsVisibleRegionRect
(
region
,
x
,
y
,
w
,
h
,
graphics
,
&
res
);
expect
(
Ok
,
status
);
ok
(
res
==
TRUE
,
"Expected (%.2f, %.2f, %.2f, %.2f) to be visible
\n
"
,
x
,
y
,
w
,
h
);
status
=
GdipIsVisibleRegionRectI
(
region
,
(
INT
)
x
,
(
INT
)
y
,
(
INT
)
w
,
(
INT
)
h
,
graphics
,
&
res
);
expect
(
Ok
,
status
);
ok
(
res
==
TRUE
,
"Expected (%d, %d, %d, %d) to be visible
\n
"
,
(
INT
)
x
,
(
INT
)
y
,
(
INT
)
w
,
(
INT
)
h
);
GdipDeletePath
(
path
);
GdipDeleteRegion
(
region
);
GdipDeleteGraphics
(
graphics
);
ReleaseDC
(
0
,
hdc
);
}
START_TEST
(
region
)
{
struct
GdiplusStartupInput
gdiplusStartupInput
;
...
...
@@ -1429,6 +1633,7 @@ START_TEST(region)
test_translate
();
test_getbounds
();
test_isvisiblepoint
();
test_isvisiblerect
();
GdiplusShutdown
(
gdiplusToken
);
}
include/gdiplusflat.h
View file @
2032b0d3
...
...
@@ -567,6 +567,8 @@ GpStatus WINGDIPAPI GdipIsEqualRegion(GpRegion *, GpRegion *, GpGraphics *, BOOL
GpStatus
WINGDIPAPI
GdipIsInfiniteRegion
(
GpRegion
*
,
GpGraphics
*
,
BOOL
*
);
GpStatus
WINGDIPAPI
GdipIsVisibleRegionPoint
(
GpRegion
*
,
REAL
,
REAL
,
GpGraphics
*
,
BOOL
*
);
GpStatus
WINGDIPAPI
GdipIsVisibleRegionPointI
(
GpRegion
*
,
INT
,
INT
,
GpGraphics
*
,
BOOL
*
);
GpStatus
WINGDIPAPI
GdipIsVisibleRegionRect
(
GpRegion
*
,
REAL
,
REAL
,
REAL
,
REAL
,
GpGraphics
*
,
BOOL
*
);
GpStatus
WINGDIPAPI
GdipIsVisibleRegionRectI
(
GpRegion
*
,
INT
,
INT
,
INT
,
INT
,
GpGraphics
*
,
BOOL
*
);
GpStatus
WINGDIPAPI
GdipSetEmpty
(
GpRegion
*
);
GpStatus
WINGDIPAPI
GdipSetInfinite
(
GpRegion
*
);
GpStatus
WINGDIPAPI
GdipTransformRegion
(
GpRegion
*
,
GpMatrix
*
);
...
...
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