From cd469d3fb2c980703053583329390ac43a1803e1 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Fri, 2 Oct 2020 13:33:05 +0200 Subject: [PATCH] gfx_widgets_draw_regular_msg - optimization - only set alpha colors again if alpha hasn't already been applied --- gfx/gfx_widgets.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/gfx/gfx_widgets.c b/gfx/gfx_widgets.c index fe05f5383a..9f5c444a43 100644 --- a/gfx/gfx_widgets.c +++ b/gfx/gfx_widgets.c @@ -1277,11 +1277,16 @@ static void gfx_widgets_draw_regular_msg( unsigned text_color; uintptr_t icon = p_dispwidget->gfx_widgets_icons_textures[ MENU_WIDGETS_ICON_INFO]; /* TODO: Real icon logic here */ + static float last_alpha = 0.0f; - /* Icon */ - gfx_display_set_alpha(msg_queue_info, msg->alpha); - gfx_display_set_alpha(gfx_widgets_pure_white, msg->alpha); - gfx_display_set_alpha(msg_queue_background, msg->alpha); + if (last_alpha != msg->alpha) + { + /* Icon */ + gfx_display_set_alpha(msg_queue_info, msg->alpha); + gfx_display_set_alpha(gfx_widgets_pure_white, msg->alpha); + gfx_display_set_alpha(msg_queue_background, msg->alpha); + last_alpha = msg->alpha; + } if (!msg->unfolded || msg->unfolding) {