diff options
author | michael <michael@3ae390bd-cb1e-0410-b409-cd5a39f66f1f> | 2008-12-27 08:14:21 +0000 |
---|---|---|
committer | michael <michael@3ae390bd-cb1e-0410-b409-cd5a39f66f1f> | 2008-12-27 08:14:21 +0000 |
commit | 426e8c3cae8d64abc629da147f26344b87a26799 (patch) | |
tree | 60f93653fa6204943f24e1e37a08d69970b45c9c | |
parent | 86bd0d06e81a18de3e5d330eae4ebddcb756d8c3 (diff) | |
download | lcd4linux-426e8c3cae8d64abc629da147f26344b87a26799.tar.gz |
ported r819 from volker_dev
git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@915 3ae390bd-cb1e-0410-b409-cd5a39f66f1f
-rw-r--r-- | drv_X11.c | 38 |
1 files changed, 21 insertions, 17 deletions
@@ -148,26 +148,30 @@ static int drv_X11_brightness(int brightness) brightness = 0; if (brightness > 255) brightness = 255; - Brightness = brightness; - dim = Brightness / 255.0; - col.R *= dim; - col.G *= dim; - col.B *= dim; - - debug("%s: set backlight to %d%%, original backlight color: 0x%02x%02x%02x%02x, dimmed: 0x%02x%02x%02x%02x", - Name, (int) (dim * 100), BL_COL.R, BL_COL.G, BL_COL.B, BL_COL.A, col.R, col.G, col.B, col.A); - for (i = 0; i < DCOLS * DROWS; i++) { - drv_X11_FB[i] = col; - } - drv_X11_color(col); + if (Brightness != brightness) { - XFillRectangle(dp, pm, gc, 0, 0, dimx + 2 * border + btnwidth, dimy + 2 * border); - XSetWindowBackground(dp, w, xc.pixel); - XClearWindow(dp, w); + Brightness = brightness; + dim = Brightness / 255.0; + col.R *= dim; + col.G *= dim; + col.B *= dim; - /* redraw every LCD pixel */ - drv_X11_blit(0, 0, LROWS, LCOLS); + debug("%s: set backlight to %d%%, original backlight color: 0x%02x%02x%02x%02x, dimmed: 0x%02x%02x%02x%02x", + Name, (int) (dim * 100), BL_COL.R, BL_COL.G, BL_COL.B, BL_COL.A, col.R, col.G, col.B, col.A); + for (i = 0; i < DCOLS * DROWS; i++) { + drv_X11_FB[i] = col; + } + + drv_X11_color(col); + + XFillRectangle(dp, pm, gc, 0, 0, dimx + 2 * border + btnwidth, dimy + 2 * border); + XSetWindowBackground(dp, w, xc.pixel); + XClearWindow(dp, w); + + /* redraw every LCD pixel */ + drv_X11_blit(0, 0, LROWS, LCOLS); + } return Brightness; } |