forked from len0rd/rockbox
lcd_update_rect() added. *please* verify this someone who can actually
run this code. It can still be improved a bit. Also, I code-policed the source somewhat, this is crowded with C++ comments and weirdo indents. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@2256 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
cd864070e4
commit
c25e97f161
1 changed files with 47 additions and 21 deletions
|
|
@ -22,11 +22,6 @@
|
|||
#include "uisw32.h"
|
||||
#include "lcd.h"
|
||||
|
||||
/*
|
||||
* simulator specific code
|
||||
*/
|
||||
|
||||
/* varaibles */
|
||||
extern unsigned char lcd_framebuffer[LCD_WIDTH][LCD_HEIGHT/8]; /* the display */
|
||||
char bitmap[LCD_HEIGHT][LCD_WIDTH]; /* the ui display */
|
||||
|
||||
|
|
@ -37,15 +32,15 @@ BITMAPINFO2 bmi =
|
|||
BI_RGB, 0, 0, 0, 2, 2,
|
||||
},
|
||||
{
|
||||
{UI_LCD_BGCOLOR, 0}, // green background color
|
||||
{UI_LCD_BLACK, 0} // black color
|
||||
{UI_LCD_BGCOLOR, 0}, /* green background color */
|
||||
{UI_LCD_BLACK, 0} /* black color */
|
||||
}
|
||||
|
||||
}; // bitmap information
|
||||
}; /* bitmap information */
|
||||
|
||||
|
||||
// lcd_update
|
||||
// update lcd
|
||||
/* lcd_update()
|
||||
update lcd */
|
||||
void lcd_update()
|
||||
{
|
||||
int x, y;
|
||||
|
|
@ -58,15 +53,40 @@ void lcd_update()
|
|||
|
||||
InvalidateRect (hGUIWnd, NULL, FALSE);
|
||||
|
||||
// natural sleep :)
|
||||
/* natural sleep :) Bagder: why is this here? */
|
||||
Sleep (50);
|
||||
}
|
||||
|
||||
// lcd_backlight
|
||||
// set backlight state of lcd
|
||||
void lcd_backlight (
|
||||
bool on // switch backlight on or off?
|
||||
)
|
||||
void lcd_update_rect(int x_start, int y_start,
|
||||
int width, int height)
|
||||
{
|
||||
int x, y;
|
||||
int xmax, ymax;
|
||||
|
||||
ymax = y_start + height;
|
||||
xmax = x_start + width;
|
||||
|
||||
if (hGUIWnd == NULL)
|
||||
_endthread ();
|
||||
|
||||
if(xmax > LCD_WIDTH)
|
||||
xmax = LCD_WIDTH;
|
||||
if(ymax >= LCD_HEIGHT)
|
||||
ymax = LCD_HEIGHT;
|
||||
|
||||
for (x = x_start; x < xmax; x++)
|
||||
for (y = y_start; y < ymax; y++)
|
||||
bitmap[y][x] = ((lcd_framebuffer[x][y/8] >> (y & 7)) & 1);
|
||||
|
||||
/* Bagder: If I only knew how, I would make this call only invalidate
|
||||
the actual rectangle we want updated here, this NULL thing here will
|
||||
make the full rectangle updated! */
|
||||
InvalidateRect (hGUIWnd, NULL, FALSE);
|
||||
}
|
||||
|
||||
/* lcd_backlight()
|
||||
set backlight state of lcd */
|
||||
void lcd_backlight (bool on)
|
||||
{
|
||||
if (on)
|
||||
{
|
||||
|
|
@ -81,3 +101,9 @@ void lcd_backlight (
|
|||
|
||||
InvalidateRect (hGUIWnd, NULL, FALSE);
|
||||
}
|
||||
|
||||
/* -----------------------------------------------------------------
|
||||
* local variables:
|
||||
* eval: (load-file "../../firmware/rockbox-mode.el")
|
||||
* end:
|
||||
*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue