From 2e591475226441996b3cf703b5508cfc7f36297f Mon Sep 17 00:00:00 2001 From: "iamyhw@gmail.com" Date: Mon, 28 Mar 2011 14:11:21 +0000 Subject: [PATCH] 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 --- components/rtgui/common/region.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/components/rtgui/common/region.c b/components/rtgui/common/region.c index d5a849c4d..106550a70 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; } -- GitLab