update widget clip function.

git-svn-id: https://rt-thread.googlecode.com/svn/trunk@875 bbd45198-f89e-11dd-88c7-29a3b14d5316
This commit is contained in:
bernard.xiong@gmail.com 2010-08-22 14:53:32 +00:00
parent 54089722c3
commit d7c6cad8c1
3 changed files with 14 additions and 2 deletions

View File

@ -42,6 +42,8 @@ static void rtgui_dc_client_get_rect(struct rtgui_dc* dc, rtgui_rect_t* rect);
struct rtgui_dc* rtgui_dc_begin_drawing(rtgui_widget_t* owner)
{
RT_ASSERT(owner != RT_NULL);
if ((rtgui_region_is_flat(&owner->clip) == RT_EOK) &&
rtgui_rect_is_equal(&(owner->extent), &(owner->clip.extents)) == RT_EOK)
{

View File

@ -58,6 +58,8 @@ void rtgui_theme_draw_win(struct rtgui_topwin* win)
struct rtgui_dc* dc;
rtgui_rect_t rect;
if (win->title == RT_NULL) return; /* no title and no board */
/* begin drawing */
dc = rtgui_dc_begin_drawing(RTGUI_WIDGET(win->title));
if (dc == RT_NULL) return;

View File

@ -134,7 +134,7 @@ void rtgui_widget_set_rect(rtgui_widget_t* widget, rtgui_rect_t* rect)
if ((widget->parent != RT_NULL) && (widget->toplevel != RT_NULL))
{
/* update widget clip */
rtgui_widget_update_clip(widget);
rtgui_widget_update_clip(widget->parent);
}
}
@ -417,7 +417,15 @@ void rtgui_widget_update_clip(rtgui_widget_t* widget)
parent = widget->parent;
/* if there is no parent, do not update clip (please use toplevel widget API) */
if (parent == RT_NULL) return;
if (parent == RT_NULL)
{
if (RTGUI_IS_TOPLEVEL(widget))
{
/* if it's toplevel widget, update it by toplevel function */
rtgui_toplevel_update_clip(RTGUI_TOPLEVEL(widget));
}
return;
}
/* reset clip to extent */
rtgui_region_reset(&(widget->clip), &(widget->extent));