mirror of
https://gitee.com/zlgopen/awtk.git
synced 2024-11-30 02:58:26 +08:00
improve widget invalidate
This commit is contained in:
parent
5918e4ea8e
commit
3117f2893a
@ -2,6 +2,7 @@
|
||||
* 2019/10/10
|
||||
* 修改canvas draw image repeatx/repeaty的问题(感谢俊杰提供补丁)。
|
||||
* canvas增加repeat\_y\_inverse图片绘制方式。
|
||||
* 完善widget\_invalidate
|
||||
|
||||
* 2019/10/09
|
||||
* slider 的min/max/value/step使用浮动数。
|
||||
|
@ -2247,29 +2247,8 @@ static ret_t widget_set_dirty(widget_t* widget) {
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
ret_t widget_invalidate(widget_t* widget, rect_t* r) {
|
||||
rect_t rself;
|
||||
if (r == NULL) {
|
||||
rself = rect_init(0, 0, widget->w, widget->h);
|
||||
r = &rself;
|
||||
}
|
||||
|
||||
return_value_if_fail(widget != NULL && r != NULL, RET_BAD_PARAMS);
|
||||
|
||||
if (widget->dirty) {
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
widget_set_dirty(widget);
|
||||
if (widget->vt && widget->vt->invalidate) {
|
||||
return widget->vt->invalidate(widget, r);
|
||||
} else {
|
||||
return widget_invalidate_default(widget, r);
|
||||
}
|
||||
}
|
||||
|
||||
ret_t widget_invalidate_force(widget_t* widget, rect_t* r) {
|
||||
widget_t* iter = widget;
|
||||
static ret_t widget_set_parent_not_dirty(widget_t* widget) {
|
||||
widget_t* iter = widget->parent;
|
||||
return_value_if_fail(widget != NULL, RET_BAD_PARAMS);
|
||||
|
||||
while (iter != NULL) {
|
||||
@ -2280,6 +2259,36 @@ ret_t widget_invalidate_force(widget_t* widget, rect_t* r) {
|
||||
iter = iter->parent;
|
||||
}
|
||||
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
ret_t widget_invalidate(widget_t* widget, rect_t* r) {
|
||||
rect_t rself;
|
||||
return_value_if_fail(widget != NULL, RET_BAD_PARAMS);
|
||||
|
||||
if (widget->dirty) {
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
if (r == NULL) {
|
||||
rself = rect_init(0, 0, widget->w, widget->h);
|
||||
r = &rself;
|
||||
}
|
||||
|
||||
widget_set_dirty(widget);
|
||||
widget_set_parent_not_dirty(widget);
|
||||
|
||||
if (widget->vt && widget->vt->invalidate) {
|
||||
return widget->vt->invalidate(widget, r);
|
||||
} else {
|
||||
return widget_invalidate_default(widget, r);
|
||||
}
|
||||
}
|
||||
|
||||
ret_t widget_invalidate_force(widget_t* widget, rect_t* r) {
|
||||
return_value_if_fail(widget != NULL, RET_BAD_PARAMS);
|
||||
|
||||
widget->dirty = FALSE;
|
||||
return widget_invalidate(widget, NULL);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user