From fae944e695f1273f8a24bf0d6fc0e080d2cd7f05 Mon Sep 17 00:00:00 2001 From: Liu Chao Date: Sat, 3 May 2014 16:46:34 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E4=B8=BA=E5=85=AC=E7=94=A8=E5=87=BD?= =?UTF-8?q?=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- include/LCUI/misc/rect.h | 17 +++++++++++++++++ src/misc/rect.c | 18 ++---------------- 2 files changed, 19 insertions(+), 16 deletions(-) diff --git a/include/LCUI/misc/rect.h b/include/LCUI/misc/rect.h index cdd6d26b..89ed7b8e 100755 --- a/include/LCUI/misc/rect.h +++ b/include/LCUI/misc/rect.h @@ -58,6 +58,23 @@ LCUI_API void LCUIRect_ValidateArea( LCUI_Rect *rect, LCUI_Size box_size ); /** 检测矩形是否遮盖另一个矩形 */ LCUI_API LCUI_BOOL LCUIRect_IsCoverRect( LCUI_Rect rect1, LCUI_Rect rect2 ); +/** + * 根据重叠矩形 rect1,将矩形 rect2 分割成四个矩形 + * 分割方法如下: + * ┏━━┳━━━━━━┓ + * ┃ ┃ 3 ┃ + * ┃ 0 ┣━━━┳━━┃ + * ┃ ┃rect1 ┃ ┃ + * ┃ ┃ ┃ 2 ┃ + * ┣━━┻━━━┫ ┃ + * ┃ 1 ┃ ┃ + * ┗━━━━━━┻━━┛ + * + * rect2 必须被 rect1 完全包含 + */ +LCUI_API void LCUIRect_CutFourRect( LCUI_Rect *rect1, LCUI_Rect *rect2, + LCUI_Rect rects[4] ); + /** 初始化脏矩形记录 */ LCUI_API void DirtyRectList_Init( LCUI_DirtyRectList *list ); diff --git a/src/misc/rect.c b/src/misc/rect.c index 26f039c9..93b2c23d 100755 --- a/src/misc/rect.c +++ b/src/misc/rect.c @@ -202,22 +202,8 @@ static void LCUIRect_MergeRect( LCUI_Rect *big, LCUI_Rect *a, LCUI_Rect *b ) } } -/** - * 根据重叠矩形 rect1,将矩形 rect2 分割成四个矩形 - * 分割方法如下: - * ┏━━┳━━━━━━┓ - * ┃ ┃ 3 ┃ - * ┃ 0 ┣━━━┳━━┃ - * ┃ ┃rect1 ┃ ┃ - * ┃ ┃ ┃ 2 ┃ - * ┣━━┻━━━┫ ┃ - * ┃ 1 ┃ ┃ - * ┗━━━━━━┻━━┛ - * - * rect2 必须被 rect1 完全包含 - */ -static void LCUIRect_CutFourRect( LCUI_Rect *rect1, LCUI_Rect *rect2, - LCUI_Rect rects[4] ) +LCUI_API void LCUIRect_CutFourRect( LCUI_Rect *rect1, LCUI_Rect *rect2, + LCUI_Rect rects[4] ) { rects[0].x = rect2->x; rects[0].y = rect2->y;