Skip to content

Commit

Permalink
rg_display: Prevent flicker on forced redraw
Browse files Browse the repository at this point in the history
Previously the screen was cleared when `rg_display_force_redraw` is called and scaling isn't set to fullscreen.

That is because the viewport won't redraw everything so garbage could remain on the sides.

Now instead of checking for scaling mode, we check if the viewport covers everything.

If it does, we don't bother blanking the screen.

This prevents an annoying flicker when leaving the menu in the launcher.
  • Loading branch information
ducalex committed Nov 20, 2024
1 parent d049045 commit 2e778fa
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions components/retro-go/rg_display.c
Original file line number Diff line number Diff line change
Expand Up @@ -310,14 +310,15 @@ static void display_task(void *arg)

if (display.changed)
{
if (config.scaling != RG_DISPLAY_SCALING_FULL)
update_viewport_scaling();
// Clear the screen if the viewport doesn't cover the entire screen because garbage could remain on the sides
if (display.viewport.width < display.screen.width || display.viewport.height < display.screen.height)
{
if (border)
rg_display_write(0, 0, border->width, border->height, 0, border->data, RG_DISPLAY_WRITE_NOSYNC);
else
rg_display_clear(C_BLACK);
}
update_viewport_scaling();
display.changed = false;
}

Expand Down

0 comments on commit 2e778fa

Please sign in to comment.