From 0258c4a275f6ad395be96032159f15e5c77cee07 Mon Sep 17 00:00:00 2001 From: xianjimli Date: Tue, 20 Oct 2020 13:44:42 +0800 Subject: [PATCH] refactor window_animator_begin_frame --- src/window_animators/window_animator_common.c | 52 ++----------------- 1 file changed, 3 insertions(+), 49 deletions(-) diff --git a/src/window_animators/window_animator_common.c b/src/window_animators/window_animator_common.c index 95fd36f5e..9c04d634f 100644 --- a/src/window_animators/window_animator_common.c +++ b/src/window_animators/window_animator_common.c @@ -97,7 +97,6 @@ ret_t window_animator_to_right_draw_curr(window_animator_t* wa) { return lcd_draw_image(c->lcd, &(wa->curr_img), rect_scale(&src, wa->ratio), &dst); } -static bool_t window_animator_is_overlap(window_animator_t* wa); static ret_t window_animator_paint_system_bar(window_animator_t* wa); static ret_t window_animator_update_percent(window_animator_t* wa); static ret_t window_animator_draw_prev_window(window_animator_t* wa); @@ -122,12 +121,6 @@ static ret_t window_animator_close_destroy(window_animator_t* wa) { return window_animator_open_destroy(wa); } -static bool_t window_animator_is_overlap(window_animator_t* wa) { - return_value_if_fail(wa != NULL && wa->vt != NULL, FALSE); - - return wa->vt->overlap; -} - ret_t window_animator_update(window_animator_t* wa, uint32_t time_ms) { return_value_if_fail(wa != NULL, RET_FAIL); @@ -179,43 +172,6 @@ static ret_t window_animator_paint_system_bar(window_animator_t* wa) { return RET_OK; } -static ret_t window_animator_begin_frame_normal(window_animator_t* wa) { -#ifdef WITH_NANOVG_GPU - ENSURE(canvas_begin_frame(wa->canvas, NULL, LCD_DRAW_ANIMATION) == RET_OK); -#else - rect_t r; - widget_t* wm = wa->curr_win->parent; - r = rect_init(wm->x, wm->y, wm->w, wm->h); - ENSURE(canvas_begin_frame(wa->canvas, &r, LCD_DRAW_ANIMATION) == RET_OK); -#endif - - return window_animator_paint_system_bar(wa); -} - -static ret_t window_animator_begin_frame_overlap(window_animator_t* wa) { -#ifdef WITH_NANOVG_GPU - ENSURE(canvas_begin_frame(wa->canvas, NULL, LCD_DRAW_ANIMATION) == RET_OK); -#else - rect_t r; - widget_t* w = NULL; - - if (wa->percent > 0) { - w = wa->curr_win; - } else { - 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 - - return window_animator_paint_system_bar(wa); -} - #ifdef WITH_WINDOW_ANIMATORS static ret_t window_animator_init(window_animator_t* wa) { ret_t ret = RET_NOT_IMPL; @@ -323,11 +279,9 @@ ret_t window_animator_overlap_default_draw_prev(window_animator_t* wa) { ret_t window_animator_begin_frame(window_animator_t* wa) { return_value_if_fail(wa != NULL, RET_OK); - if (window_animator_is_overlap(wa)) { - return window_animator_begin_frame_overlap(wa); - } else { - return window_animator_begin_frame_normal(wa); - } + ENSURE(canvas_begin_frame(wa->canvas, NULL, LCD_DRAW_ANIMATION) == RET_OK); + + return window_animator_paint_system_bar(wa); } ret_t window_animator_end_frame(window_animator_t* wa) {