forked from len0rd/rockbox
Enable backlight brightness in simulator
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@24042 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
6c683d449e
commit
5d96c3ba71
3 changed files with 10 additions and 9 deletions
|
@ -558,8 +558,8 @@ Lyre prototype 1 */
|
|||
#define CONFIG_TUNER_MULTI
|
||||
#endif
|
||||
|
||||
/* deactivate fading in bootloader/sim */
|
||||
#if defined(BOOTLOADER) || defined(SIMULATOR)
|
||||
/* deactivate fading in bootloader */
|
||||
#if defined(BOOTLOADER)
|
||||
#undef CONFIG_BACKLIGHT_FADING
|
||||
#define CONFIG_BACKLIGHT_FADING BACKLIGHT_NO_FADING
|
||||
#endif
|
||||
|
|
|
@ -30,6 +30,8 @@ extern void lcd_awake(void);
|
|||
/* in uisimulator/sdl/lcd-bitmap.c and lcd-charcell.c */
|
||||
extern void sim_backlight(int value);
|
||||
|
||||
static int old_val = 100;
|
||||
|
||||
bool _backlight_init(void)
|
||||
{
|
||||
return true;
|
||||
|
@ -37,7 +39,7 @@ bool _backlight_init(void)
|
|||
|
||||
void _backlight_on(void)
|
||||
{
|
||||
sim_backlight(100);
|
||||
sim_backlight(old_val);
|
||||
#if defined(HAVE_LCD_ENABLE)
|
||||
lcd_enable(true);
|
||||
#elif defined(HAVE_LCD_SLEEP)
|
||||
|
@ -56,7 +58,10 @@ void _backlight_off(void)
|
|||
#ifdef HAVE_BACKLIGHT_BRIGHTNESS
|
||||
void _backlight_set_brightness(int val)
|
||||
{
|
||||
(void)val;
|
||||
int normalized = ((val - MIN_BRIGHTNESS_SETTING + 1) * 100) / MAX_BRIGHTNESS_SETTING;
|
||||
sim_backlight(normalized);
|
||||
|
||||
old_val = normalized;
|
||||
}
|
||||
#endif /* HAVE_BACKLIGHT_BRIGHTNESS */
|
||||
#ifdef HAVE_BUTTON_LIGHT
|
||||
|
|
|
@ -149,11 +149,7 @@ void sim_backlight(int value)
|
|||
#endif
|
||||
}
|
||||
#else /* LCD_DEPTH > 8 */
|
||||
if (value > 0) {
|
||||
SDL_SetAlpha(lcd_surface, 0, SDL_ALPHA_OPAQUE); /* full on */
|
||||
} else {
|
||||
SDL_SetAlpha(lcd_surface, SDL_SRCALPHA, BACKLIGHT_OFF_ALPHA);
|
||||
}
|
||||
SDL_SetAlpha(lcd_surface, SDL_SRCALPHA, (value * 255) / 100);
|
||||
#endif /* LCD_DEPTH */
|
||||
|
||||
sdl_gui_update(lcd_surface, 0, 0, SIM_LCD_WIDTH, SIM_LCD_HEIGHT,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue