From b5e1a1cc59fbba215b5e6c4f493800405787cd99 Mon Sep 17 00:00:00 2001 From: Thomas Martitz Date: Tue, 19 Jan 2010 22:56:37 +0000 Subject: [PATCH] Fix red, moved around a bit to much. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@24291 a1c6a512-1295-4272-9138-f99709370657 --- uisimulator/common/backlight-sim.c | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/uisimulator/common/backlight-sim.c b/uisimulator/common/backlight-sim.c index aa8fe8e844..f5da77a782 100644 --- a/uisimulator/common/backlight-sim.c +++ b/uisimulator/common/backlight-sim.c @@ -30,17 +30,28 @@ extern void lcd_awake(void); /* in uisimulator/sdl/lcd-bitmap.c and lcd-charcell.c */ extern void sim_backlight(int value); +bool _backlight_init(void) +{ + return true; +} + + +#ifdef HAVE_BACKLIGHT_BRIGHTNESS + static inline int normalize_backlight(int val) { /* normalize to xx% brightness for sdl */ return ((val - MIN_BRIGHTNESS_SETTING + 1) * 100)/MAX_BRIGHTNESS_SETTING; } -bool _backlight_init(void) +void _backlight_set_brightness(int val) { - return true; + sim_backlight(normalize_backlight(val)); } +#endif /* HAVE_BACKLIGHT_BRIGHTNESS */ + + void _backlight_on(void) { #if defined(HAVE_LCD_ENABLE) @@ -51,7 +62,12 @@ void _backlight_on(void) #if (CONFIG_BACKLIGHT_FADING != BACKLIGHT_FADING_SW_SETTING) /* if we set the brightness to the settings value, then fading up * is glitchy */ +#ifdef HAVE_BACKLIGHT_BRIGHTNESS sim_backlight(normalize_backlight(backlight_brightness)); +#else + sim_backlight(100); +#endif + #endif } @@ -63,12 +79,7 @@ void _backlight_off(void) #endif } -#ifdef HAVE_BACKLIGHT_BRIGHTNESS -void _backlight_set_brightness(int val) -{ - sim_backlight(normalize_backlight(val)); -} -#endif /* HAVE_BACKLIGHT_BRIGHTNESS */ + #ifdef HAVE_BUTTON_LIGHT void _buttonlight_on(void) {