Simulator: improve simulation of transflective screens

This patch simulates the three possible states of a transflective
LCD: backlight on (bright screen as usual), backlight off (dimmed
screen) and LCD off (black screen).
Makes use of already defined 'BACKLIGHT_OFF_ALPHA'.

Change-Id: I9b0fc79b8d50c29e024ba1e6d9c2501119a7e0e0
This commit is contained in:
Sebastian Leonhardt 2018-04-04 16:28:53 +02:00 committed by Solomon Peachy
parent 287685932e
commit 666405f346
2 changed files with 11 additions and 0 deletions

View file

@ -162,7 +162,15 @@ void sim_backlight(int value)
#endif
}
#else /* LCD_DEPTH > 8 */
#ifdef HAVE_TRANSFLECTIVE_LCD
if (!lcd_active())
SDL_SetAlpha(lcd_surface, SDL_SRCALPHA, 0);
else
SDL_SetAlpha(lcd_surface, SDL_SRCALPHA,
MAX(BACKLIGHT_OFF_ALPHA, (value * 255) / 100));
#else
SDL_SetAlpha(lcd_surface, SDL_SRCALPHA, (value * 255) / 100);
#endif
#endif /* LCD_DEPTH */
sdl_gui_update(lcd_surface, 0, 0, SIM_LCD_WIDTH, SIM_LCD_HEIGHT,

View file

@ -78,6 +78,9 @@ void lcd_remote_set_invert_display(bool invert)
void lcd_sleep(void)
{
lcd_sleeping = true;
#ifdef HAVE_TRANSFLECTIVE_LCD
sim_backlight(0); /* completely blacken the screen */
#endif
}
void lcd_awake(void)