Skip to content

Commit 9595007

Browse files
committed
(MaterialUI) Fix similar issue as with Ozone - don't do
the fade-in animation on the first frame to fix the rendering issue where on the first frame it will show an incompletely rendered menu
1 parent 353981d commit 9595007

1 file changed

Lines changed: 28 additions & 1 deletion

File tree

menu/drivers/materialui.c

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -578,7 +578,8 @@ enum materialui_handle_flags
578578
MUI_FLAG_SCROLLBAR_ACTIVE = (1 << 25),
579579
MUI_FLAG_SCROLLBAR_DRAGGED = (1 << 26),
580580
MUI_FLAG_NAVBAR_MENU_NAVIGATION_WRAPPED = (1 << 27),
581-
MUI_FLAG_COL_DIVIDER_IS_LIST_BG = (1 << 28)
581+
MUI_FLAG_COL_DIVIDER_IS_LIST_BG = (1 << 28),
582+
MUI_FLAG_FIRST_FRAME = (1 << 29)
582583
};
583584

584585
typedef struct materialui_handle
@@ -8183,6 +8184,11 @@ static void materialui_frame(void *data, video_frame_info_t *video_info)
81838184
if (ctx_gen != mui->context_generation)
81848185
goto ctx_destroyed;
81858186

8187+
/* First-frame init done — subsequent frames are normal.
8188+
* Cleared here (not on entry) so that a context-destroyed
8189+
* mid-frame leaves the flag set for the retry. */
8190+
mui->flags &= ~MUI_FLAG_FIRST_FRAME;
8191+
81868192
/* Unbind fonts */
81878193
font_unbind(&mui->font_data.title);
81888194
font_unbind(&mui->font_data.list);
@@ -9120,6 +9126,7 @@ static void *materialui_init(void **userdata, bool video_is_threaded)
91209126
mui->dip_base_unit_size = mui->last_scale_factor
91219127
* MUI_DIP_BASE_UNIT_SIZE;
91229128
mui->flags = 0;
9129+
mui->flags |= MUI_FLAG_FIRST_FRAME;
91239130

91249131
if (settings->bools.menu_materialui_show_nav_bar)
91259132
mui->flags |= MUI_FLAG_LAST_SHOW_NAVBAR;
@@ -9546,6 +9553,26 @@ static void materialui_init_transition_animation(materialui_handle_t *mui,
95469553
uintptr_t x_offset_tag = (uintptr_t)&mui->transition_x_offset;
95479554
unsigned transition_animation = settings->uints.menu_materialui_transition_animation;
95489555

9556+
/* Skip the transition animation on the very first frame after
9557+
* init: materialui_populate_entries() runs from menu_driver_init
9558+
* before the first materialui_frame, and this animation zeros
9559+
* out transition_alpha — which scales the alpha of entry text,
9560+
* icons, the highlight and other UI chrome but NOT the title
9561+
* bar or the nav bar. The result is a few frames of half-
9562+
* rendered menu (header + nav bar but no entries) until the
9563+
* alpha animates up to 1.0.
9564+
*
9565+
* The menu has no prior state to fade in from at startup, so
9566+
* skipping the animation here is the right move; matches the
9567+
* is_first_frame -> animate=false pattern used in ozone. */
9568+
if (mui->flags & MUI_FLAG_FIRST_FRAME)
9569+
{
9570+
mui->transition_alpha = 1.0f;
9571+
mui->transition_x_offset = 0.0f;
9572+
mui->last_stack_size = stack_size;
9573+
return;
9574+
}
9575+
95499576
/* If animations are disabled, reset alpha/x offset
95509577
* values and return immediately */
95519578
if (transition_animation == MATERIALUI_TRANSITION_ANIM_NONE)

0 commit comments

Comments
 (0)