diff options
| author | [email protected] <[email protected]> | 2011-03-28 14:11:21 +0000 |
|---|---|---|
| committer | [email protected] <[email protected]> | 2011-03-28 14:11:21 +0000 |
| commit | 2e591475226441996b3cf703b5508cfc7f36297f (patch) | |
| tree | f903af084507411cee879f6d48c88a484717ed00 /components | |
| parent | 967f6f6eefa2cba6c45a09f0187f59a906f0ab21 (diff) | |
fix,In region judage two rectangular intersect,Missing cross.
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@1352 bbd45198-f89e-11dd-88c7-29a3b14d5316
Diffstat (limited to 'components')
| -rw-r--r-- | components/rtgui/common/region.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/components/rtgui/common/region.c b/components/rtgui/common/region.c index d5a849c4dc..106550a702 100644 --- a/components/rtgui/common/region.c +++ b/components/rtgui/common/region.c @@ -114,6 +114,13 @@ static rtgui_region_status_t rtgui_break(rtgui_region_t *pReg); ((r1)->y1 <= (r2)->y1) && \ ((r1)->y2 >= (r2)->y2) ) +/* true iff Box r1 and Box r2 constitute cross */ +#define CROSS(r1,r2) \ + ( ((r1)->x1 <= (r2)->x1) && \ + ((r1)->x2 >= (r2)->x2) && \ + ((r1)->y1 >= (r2)->y1) && \ + ((r1)->y2 <= (r2)->y2) ) + #define allocData(n) rtgui_malloc(PIXREGION_SZOF(n)) #define freeData(reg) if ((reg)->data && (reg)->data->size) rtgui_free((reg)->data) @@ -2236,6 +2243,14 @@ int rtgui_rect_is_intersect(const rtgui_rect_t *rect1, const rtgui_rect_t *rect2 { return RT_EOK; } + else if (CROSS(rect1,rect2))
+ {
+ return RT_EOK;
+ } + else if (CROSS(rect2,rect1))
+ {
+ return RT_EOK;
+ } return -RT_ERROR; } |
