GFX_DISPLAY_GET_UPDATE_PENDING - turn function into macro

This commit is contained in:
twinaphex 2020-09-24 05:59:14 +02:00
parent c040e4cd08
commit 37237db804
4 changed files with 16 additions and 18 deletions

View File

@ -1540,21 +1540,6 @@ void gfx_display_set_msg_force(bool state)
p_disp->msg_force = state;
}
/* Returns true if an animation is still active or
* when the display framebuffer still is dirty and
* therefore it still needs to be rendered onscreen.
*
* This function can be used for optimization purposes
* so that we don't have to render the display graphics per-frame
* unless a change has happened.
* */
bool gfx_display_get_update_pending(void)
{
gfx_display_t *p_disp = disp_get_ptr();
gfx_animation_t *p_anim = anim_get_ptr();
return (ANIM_IS_ACTIVE(p_anim) || p_disp->framebuf_dirty);
}
/* Checks if the display framebuffer has its 'dirty flag' set. This
* means that the current contents of the framebuffer has changed
* and that it has to be rendered to the screen. */

View File

@ -50,6 +50,16 @@ RETRO_BEGIN_DECLS
#define gfx_display_set_alpha(color, alpha_value) (color[3] = color[7] = color[11] = color[15] = (alpha_value))
/* Returns true if an animation is still active or
* when the display framebuffer still is dirty and
* therefore it still needs to be rendered onscreen.
*
* This macro can be used for optimization purposes
* so that we don't have to render the display graphics per-frame
* unless a change has happened.
* */
#define GFX_DISPLAY_GET_UPDATE_PENDING(p_anim, p_disp) (ANIM_IS_ACTIVE(p_anim) || p_disp->framebuf_dirty)
enum menu_driver_id_type
{
MENU_DRIVER_ID_UNKNOWN = 0,
@ -261,7 +271,6 @@ void gfx_display_set_framebuffer_pitch(size_t pitch);
bool gfx_display_get_msg_force(void);
void gfx_display_set_msg_force(bool state);
bool gfx_display_get_update_pending(void);
bool gfx_display_get_framebuffer_dirty_flag(void);
void gfx_display_set_framebuffer_dirty_flag(void);
void gfx_display_unset_framebuffer_dirty_flag(void);

View File

@ -3437,6 +3437,8 @@ static void rgui_render(void *data,
rgui->show_fs_thumbnail &&
rgui->entry_has_thumbnail &&
(fs_thumbnail.is_valid || (rgui->thumbnail_queue_size > 0));
gfx_animation_t *p_anim = anim_get_ptr();
gfx_display_t *p_disp = disp_get_ptr();
/* Sanity check */
if (!rgui || !rgui_frame_buf.data)
@ -3461,7 +3463,7 @@ static void rgui_render(void *data,
if ( !display_kb &&
!current_display_cb &&
(is_idle || !gfx_display_get_update_pending()))
(is_idle || !GFX_DISPLAY_GET_UPDATE_PENDING(p_anim, p_disp)))
return;
}

View File

@ -4433,6 +4433,8 @@ static int generic_menu_iterate(
const char *label = NULL;
menu_handle_t *menu = (menu_handle_t*)data;
struct menu_state *menu_st = &p_rarch->menu_driver_state;
gfx_display_t *p_disp = &p_rarch->dispgfx;
gfx_animation_t *p_anim = &p_rarch->anim;
if (!menu)
return 0;
@ -4447,7 +4449,7 @@ static int generic_menu_iterate(
if ( action != MENU_ACTION_NOOP
|| menu_entries_ctl(MENU_ENTRIES_CTL_NEEDS_REFRESH, NULL)
|| gfx_display_get_update_pending())
|| GFX_DISPLAY_GET_UPDATE_PENDING(p_anim, p_disp))
{
BIT64_SET(menu->state, MENU_STATE_RENDER_FRAMEBUFFER);
}