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
This commit is contained in:
iamyhw@gmail.com 2011-03-28 14:11:21 +00:00
parent 967f6f6eef
commit 2e59147522
1 changed files with 15 additions and 0 deletions

View File

@ -114,6 +114,13 @@ static rtgui_region_status_t rtgui_break(rtgui_region_t *pReg);
((r1)->y1 <= (r2)->y1) && \ ((r1)->y1 <= (r2)->y1) && \
((r1)->y2 >= (r2)->y2) ) ((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 allocData(n) rtgui_malloc(PIXREGION_SZOF(n))
#define freeData(reg) if ((reg)->data && (reg)->data->size) rtgui_free((reg)->data) #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; return RT_EOK;
} }
else if (CROSS(rect1,rect2))
{
return RT_EOK;
}
else if (CROSS(rect2,rect1))
{
return RT_EOK;
}
return -RT_ERROR; return -RT_ERROR;
} }