add dialog_highlighter_is_dynamic

This commit is contained in:
lixianjing 2019-06-26 11:37:44 +08:00
parent a2f3d86eaa
commit ce4d75059e
4 changed files with 30 additions and 0 deletions

View File

@ -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);

View File

@ -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
*

View File

@ -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

View File

@ -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) {