mirror of
https://gitee.com/zlgopen/awtk.git
synced 2024-12-02 20:18:22 +08:00
add dialog_highlighter_is_dynamic
This commit is contained in:
parent
a2f3d86eaa
commit
ce4d75059e
@ -69,6 +69,14 @@ ret_t dialog_highlighter_draw(dialog_highlighter_t* h, float_t percent) {
|
||||
return RET_NOT_IMPL;
|
||||
}
|
||||
|
||||
bool_t dialog_highlighter_is_dynamic(dialog_highlighter_t* h) {
|
||||
if (h != NULL && h->vt != NULL && h->vt->is_dynamic != NULL) {
|
||||
return h->vt->is_dynamic(h);
|
||||
} else {
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
static ret_t dialog_highlighter_on_destroy(dialog_highlighter_t* h) {
|
||||
return_value_if_fail(h != NULL && h->vt != NULL, RET_BAD_PARAMS);
|
||||
|
||||
|
@ -31,6 +31,7 @@ typedef struct _dialog_highlighter_t dialog_highlighter_t;
|
||||
|
||||
typedef ret_t (*dialog_highlighter_prepare_t)(dialog_highlighter_t* h, canvas_t* c);
|
||||
typedef ret_t (*dialog_highlighter_draw_t)(dialog_highlighter_t* h, float_t percent);
|
||||
typedef bool_t (*dialog_highlighter_is_dynamic_t)(dialog_highlighter_t* h);
|
||||
typedef ret_t (*dialog_highlighter_on_destroy_t)(dialog_highlighter_t* h);
|
||||
|
||||
typedef dialog_highlighter_t* (*dialog_highlighter_create_t)(object_t* args);
|
||||
@ -41,6 +42,7 @@ typedef struct _dialog_highlighter_vtable_t {
|
||||
uint32_t size;
|
||||
dialog_highlighter_draw_t draw;
|
||||
dialog_highlighter_prepare_t prepare;
|
||||
dialog_highlighter_is_dynamic_t is_dynamic;
|
||||
dialog_highlighter_on_destroy_t on_destroy;
|
||||
} dialog_highlighter_vtable_t;
|
||||
|
||||
@ -129,6 +131,15 @@ ret_t dialog_highlighter_prepare(dialog_highlighter_t* h, canvas_t* c);
|
||||
*/
|
||||
ret_t dialog_highlighter_draw(dialog_highlighter_t* h, float_t percent);
|
||||
|
||||
/**
|
||||
* @method dialog_highlighter_is_dynamic
|
||||
* 是否是动态绘制(方便外层优化)。
|
||||
* @param {dialog_highlighter_t*} h 对话框高亮策略对象。
|
||||
*
|
||||
* @return {bool_t} 返回TRUE表示动态绘制,否则表示不是动态绘制。
|
||||
*/
|
||||
bool_t dialog_highlighter_is_dynamic(dialog_highlighter_t* h);
|
||||
|
||||
/**
|
||||
* @method dialog_highlighter_destroy
|
||||
* 销毁对话框高亮策略对象。
|
||||
|
@ -146,6 +146,10 @@ static ret_t window_animator_begin_frame_overlap(window_animator_t* wa) {
|
||||
w = wa->curr_win->parent;
|
||||
}
|
||||
|
||||
if (dialog_highlighter_is_dynamic(wa->dialog_highlighter)) {
|
||||
w = wa->curr_win->parent;
|
||||
}
|
||||
|
||||
r = rect_init(w->x, w->y, w->w, w->h);
|
||||
ENSURE(canvas_begin_frame(wa->canvas, &r, LCD_DRAW_ANIMATION_OVERLAP) == RET_OK);
|
||||
#endif
|
||||
|
@ -78,11 +78,18 @@ static ret_t dialog_highlighter_default_draw(dialog_highlighter_t* h, float_t pe
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
static bool_t dialog_highlighter_default_is_dynamic(dialog_highlighter_t* h) {
|
||||
dialog_highlighter_default_t* dh = (dialog_highlighter_default_t*)h;
|
||||
|
||||
return (dh->start_alpha != dh->end_alpha);
|
||||
}
|
||||
|
||||
static const dialog_highlighter_vtable_t s_dialog_highlighter_default_vt = {
|
||||
.type = "dialog_highlighter_default_t",
|
||||
.desc = "dialog_highlighter_default_t",
|
||||
.size = sizeof(dialog_highlighter_default_t),
|
||||
.prepare = dialog_highlighter_default_prepare,
|
||||
.is_dynamic = dialog_highlighter_default_is_dynamic,
|
||||
.draw = dialog_highlighter_default_draw};
|
||||
|
||||
dialog_highlighter_t* dialog_highlighter_default_create(object_t* args) {
|
||||
|
Loading…
Reference in New Issue
Block a user