From 426e8c3cae8d64abc629da147f26344b87a26799 Mon Sep 17 00:00:00 2001 From: michael Date: Sat, 27 Dec 2008 08:14:21 +0000 Subject: ported r819 from volker_dev git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@915 3ae390bd-cb1e-0410-b409-cd5a39f66f1f --- drv_X11.c | 38 +++++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/drv_X11.c b/drv_X11.c index e676b90..0c6e41b 100644 --- a/drv_X11.c +++ b/drv_X11.c @@ -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; } -- cgit v1.2.3