提交 d7c6cad8 编写于 作者: B bernard.xiong@gmail.com

update widget clip function.

git-svn-id: https://rt-thread.googlecode.com/svn/trunk@875 bbd45198-f89e-11dd-88c7-29a3b14d5316
上级 54089722
......@@ -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)
{
......
......@@ -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;
......
......@@ -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));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册