Second part of graphics api rework. Bitmap drawing and text output converted; some code cleanup and more optimisations.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6906 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Jens Arnold 2005-06-28 23:15:47 +00:00
parent c2bf5dfe12
commit 7e11acbce9
28 changed files with 625 additions and 559 deletions

View File

@ -72,10 +72,10 @@ int show_logo( void )
lcd_clear_display();
#if LCD_WIDTH == 112 || LCD_WIDTH == 128
lcd_bitmap(rockbox112x37, 0, 10, 112, 37, false);
lcd_bitmap(rockbox112x37, 0, 10, 112, 37);
#endif
#if LCD_WIDTH >= 160
lcd_bitmap(rockbox160x53, 0, 10, 160, 53, false);
lcd_bitmap(rockbox160x53, 0, 10, 160, 53);
#endif
#ifdef HAVE_REMOTE_LCD

View File

@ -116,8 +116,7 @@ void put_cursorxy(int x, int y, bool on)
/* place the cursor */
if(on) {
#ifdef HAVE_LCD_BITMAP
lcd_bitmap ( bitmap_icons_6x8[Cursor],
xpos, ypos, 4, 8, true);
lcd_bitmap(bitmap_icons_6x8[Cursor], xpos, ypos, 4, 8);
#else
lcd_putc(x, y, CURSOR_CHAR);
#endif

View File

@ -463,8 +463,7 @@ static void display_playlist(void)
offset = (viewer.line_height - 8) / 2;
lcd_bitmap(bitmap_icons_6x8[File],
CURSOR_X * 6 + CURSOR_WIDTH,
MARGIN_Y+(i*viewer.line_height) + offset,
6, 8, true);
MARGIN_Y+(i*viewer.line_height) + offset, 6, 8);
#else
lcd_putc(LINE_X-1, i, File);
#endif

View File

@ -110,8 +110,11 @@ static const struct plugin_api rockbox_api = {
lcd_getstringsize,
lcd_drawpixel,
lcd_drawline,
lcd_hline,
lcd_vline,
lcd_drawrect,
lcd_fillrect,
lcd_bitmap_part,
lcd_bitmap,
lcd_putsxy,
lcd_puts_style,

View File

@ -87,12 +87,12 @@
#endif
/* increase this every time the api struct changes */
#define PLUGIN_API_VERSION 41
#define PLUGIN_API_VERSION 42
/* update this to latest version if a change to the api struct breaks
backwards compatibility (and please take the opportunity to sort in any
new function which are "waiting" at the end of the function table) */
#define PLUGIN_MIN_API_VERSION 41
#define PLUGIN_MIN_API_VERSION 42
/* plugin return codes */
enum plugin_status {
@ -160,17 +160,21 @@ struct plugin_api {
int (*lcd_getstringsize)(const unsigned char *str, int *w, int *h);
void (*lcd_drawpixel)(int x, int y);
void (*lcd_drawline)(int x1, int y1, int x2, int y2);
void (*lcd_drawrect)(int x, int y, int nx, int ny);
void (*lcd_fillrect)(int x, int y, int nx, int ny);
void (*lcd_hline)(int x1, int x2, int y);
void (*lcd_vline)(int x, int y1, int y2);
void (*lcd_drawrect)(int x, int y, int width, int height);
void (*lcd_fillrect)(int x, int y, int width, int height);
void (*lcd_bitmap_part)(const unsigned char *src, int src_x, int src_y,
int stride, int x, int y, int width, int height);
void (*lcd_bitmap)(const unsigned char *src, int x, int y,
int nx, int ny, bool clear);
int width, int height);
void (*lcd_putsxy)(int x, int y, const unsigned char *string);
void (*lcd_puts_style)(int x, int y, const unsigned char *str, int style);
void (*lcd_puts_scroll_style)(int x, int y, const unsigned char* string,
int style);
unsigned char* lcd_framebuffer;
void (*lcd_blit) (const unsigned char* p_data, int x, int y, int width,
int height, int stride);
void (*lcd_blit) (const unsigned char* data, int x, int by, int width,
int bheight, int stride);
void (*lcd_update)(void);
void (*lcd_update_rect)(int x, int y, int width, int height);
void (*scrollbar)(int x, int y, int width, int height, int items,

View File

@ -269,9 +269,9 @@ static void addclock(void)
/* draw a circle */
for(i=0; i < 60; i+=3) {
rb->lcd_drawline( xminute[i],
yminute[i],
xminute[(i+1)%60],
yminute[(i+1)%60]);
yminute[i],
xminute[(i+1)%60],
yminute[(i+1)%60]);
}
}
#endif /* HAVE_RTC */
@ -303,16 +303,17 @@ static int scrollit(void)
return -1;
rb->lcd_clear_display();
rb->lcd_set_drawmode(DRMODE_FG);
for(i=0, yy=y, xx=x; i< LETTERS_ON_SCREEN; i++) {
letter = rock[(i+textpos) % rocklen ];
rb->lcd_bitmap((char *)char_gen_12x16[letter-0x20],
xx, table[yy&(TABLE_SIZE-1)],
11, 16, false);
xx, table[yy&(TABLE_SIZE-1)], 11, 16);
yy += YADD;
xx+= LCD_WIDTH/LETTERS_ON_SCREEN;
}
rb->lcd_set_drawmode(DRMODE_SOLID);
#ifdef HAVE_RTC
addclock();
#endif
@ -393,13 +394,15 @@ static int loopit(void)
rb->lcd_putsxy(0, LCD_HEIGHT - 8, buffer);
timeout--;
}
rb->lcd_set_drawmode(DRMODE_FG);
for(i=0, yy=y, xx=x;
i<rocklen;
i++, yy+=values[NUM_YDIST].num, xx+=values[NUM_XDIST].num)
rb->lcd_bitmap((char *)char_gen_12x16[rock[i]-0x20],
xtable[xx&(TABLE_SIZE-1)], table[yy&(TABLE_SIZE-1)],
11, 16, false);
11, 16);
rb->lcd_update();
rb->lcd_set_drawmode(DRMODE_SOLID);
ysanke+= values[NUM_YSANKE].num;
xsanke+= values[NUM_XSANKE].num;

View File

@ -214,7 +214,7 @@ static void show_pause_mode(bool enabled)
static const char pause_icon[] = {0x00,0x7f,0x7f,0x00,0x7f,0x7f,0x00};
if (enabled)
rb->lcd_bitmap(pause_icon, 52, 0, 7, 8, true);
rb->lcd_bitmap(pause_icon, 52, 0, 7, 8);
else
{
rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);

View File

@ -788,9 +788,9 @@ bool colon, bool lcd)
if(settings.digital_12h)
{
if(hour > 12)
rb->lcd_bitmap(pm, 97, 55, 15, 8, true);
rb->lcd_bitmap(pm, 97, 55, 15, 8);
else
rb->lcd_bitmap(am, 1, 55, 15, 8, true);
rb->lcd_bitmap(am, 1, 55, 15, 8);
}
}
else
@ -798,9 +798,9 @@ bool colon, bool lcd)
if(settings.lcd_12h)
{
if(hour > 12)
rb->lcd_bitmap(pm, 97, 55, 15, 8, true);
rb->lcd_bitmap(pm, 97, 55, 15, 8);
else
rb->lcd_bitmap(am, 1, 55, 15, 8, true);
rb->lcd_bitmap(am, 1, 55, 15, 8);
}
}
@ -881,138 +881,138 @@ void binary(int hour, int minute, int second)
*****/
if(temphour >= 32)
{
rb->lcd_bitmap(bitmap_1, 0, 1, 15, 20, true);
rb->lcd_bitmap(bitmap_1, 0, 1, 15, 20);
temphour -= 32;
}
else
rb->lcd_bitmap(bitmap_0, 0, 1, 15, 20, true);
rb->lcd_bitmap(bitmap_0, 0, 1, 15, 20);
if(temphour >= 16)
{
rb->lcd_bitmap(bitmap_1, 19, 1, 15, 20, true);
rb->lcd_bitmap(bitmap_1, 19, 1, 15, 20);
temphour -= 16;
}
else
rb->lcd_bitmap(bitmap_0, 19, 1, 15, 20, true);
rb->lcd_bitmap(bitmap_0, 19, 1, 15, 20);
if(temphour >= 8)
{
rb->lcd_bitmap(bitmap_1, 38, 1, 15, 20, true);
rb->lcd_bitmap(bitmap_1, 38, 1, 15, 20);
temphour -= 8;
}
else
rb->lcd_bitmap(bitmap_0, 38, 1, 15, 20, true);
rb->lcd_bitmap(bitmap_0, 38, 1, 15, 20);
if(temphour >= 4)
{
rb->lcd_bitmap(bitmap_1, 57, 1, 15, 20, true);
rb->lcd_bitmap(bitmap_1, 57, 1, 15, 20);
temphour -= 4;
}
else
rb->lcd_bitmap(bitmap_0, 57, 1, 15, 20, true);
rb->lcd_bitmap(bitmap_0, 57, 1, 15, 20);
if(temphour >= 2)
{
rb->lcd_bitmap(bitmap_1, 76, 1, 15, 20, true);
rb->lcd_bitmap(bitmap_1, 76, 1, 15, 20);
temphour -= 2;
}
else
rb->lcd_bitmap(bitmap_0, 76, 1, 15, 20, true);
rb->lcd_bitmap(bitmap_0, 76, 1, 15, 20);
if(temphour >= 1)
{
rb->lcd_bitmap(bitmap_1, 95, 1, 15, 20, true);
rb->lcd_bitmap(bitmap_1, 95, 1, 15, 20);
temphour -= 1;
}
else
rb->lcd_bitmap(bitmap_0, 95, 1, 15, 20, true);
rb->lcd_bitmap(bitmap_0, 95, 1, 15, 20);
/*********
* MINUTES
********/
if(tempmin >= 32)
{
rb->lcd_bitmap(bitmap_1, 0, 21, 15, 20, true);
rb->lcd_bitmap(bitmap_1, 0, 21, 15, 20);
tempmin -= 32;
}
else
rb->lcd_bitmap(bitmap_0, 0, 21, 15, 20, true);
rb->lcd_bitmap(bitmap_0, 0, 21, 15, 20);
if(tempmin >= 16)
{
rb->lcd_bitmap(bitmap_1, 19, 21, 15, 20, true);
rb->lcd_bitmap(bitmap_1, 19, 21, 15, 20);
tempmin -= 16;
}
else
rb->lcd_bitmap(bitmap_0, 19, 21, 15, 20, true);
rb->lcd_bitmap(bitmap_0, 19, 21, 15, 20);
if(tempmin >= 8)
{
rb->lcd_bitmap(bitmap_1, 38, 21, 15, 20, true);
rb->lcd_bitmap(bitmap_1, 38, 21, 15, 20);
tempmin -= 8;
}
else
rb->lcd_bitmap(bitmap_0, 38, 21, 15, 20, true);
rb->lcd_bitmap(bitmap_0, 38, 21, 15, 20);
if(tempmin >= 4)
{
rb->lcd_bitmap(bitmap_1, 57, 21, 15, 20, true);
rb->lcd_bitmap(bitmap_1, 57, 21, 15, 20);
tempmin -= 4;
}
else
rb->lcd_bitmap(bitmap_0, 57, 21, 15, 20, true);
rb->lcd_bitmap(bitmap_0, 57, 21, 15, 20);
if(tempmin >= 2)
{
rb->lcd_bitmap(bitmap_1, 76, 21, 15, 20, true);
rb->lcd_bitmap(bitmap_1, 76, 21, 15, 20);
tempmin -= 2;
}
else
rb->lcd_bitmap(bitmap_0, 76, 21, 15, 20, true);
rb->lcd_bitmap(bitmap_0, 76, 21, 15, 20);
if(tempmin >= 1)
{
rb->lcd_bitmap(bitmap_1, 95, 21, 15, 20, true);
rb->lcd_bitmap(bitmap_1, 95, 21, 15, 20);
tempmin -= 1;
}
else
rb->lcd_bitmap(bitmap_0, 95, 21, 15, 20, true);
rb->lcd_bitmap(bitmap_0, 95, 21, 15, 20);
/*********
* SECONDS
********/
if(tempsec >= 32)
{
rb->lcd_bitmap(bitmap_1, 0, 42, 15, 20, true);
rb->lcd_bitmap(bitmap_1, 0, 42, 15, 20);
tempsec -= 32;
}
else
rb->lcd_bitmap(bitmap_0, 0, 42, 15, 20, true);
rb->lcd_bitmap(bitmap_0, 0, 42, 15, 20);
if(tempsec >= 16)
{
rb->lcd_bitmap(bitmap_1, 19, 42, 15, 20, true);
rb->lcd_bitmap(bitmap_1, 19, 42, 15, 20);
tempsec -= 16;
}
else
rb->lcd_bitmap(bitmap_0, 19, 42, 15, 20, true);
rb->lcd_bitmap(bitmap_0, 19, 42, 15, 20);
if(tempsec >= 8)
{
rb->lcd_bitmap(bitmap_1, 38, 42, 15, 20, true);
rb->lcd_bitmap(bitmap_1, 38, 42, 15, 20);
tempsec -= 8;
}
else
rb->lcd_bitmap(bitmap_0, 38, 42, 15, 20, true);
rb->lcd_bitmap(bitmap_0, 38, 42, 15, 20);
if(tempsec >= 4)
{
rb->lcd_bitmap(bitmap_1, 57, 42, 15, 20, true);
rb->lcd_bitmap(bitmap_1, 57, 42, 15, 20);
tempsec -= 4;
}
else
rb->lcd_bitmap(bitmap_0, 57, 42, 15, 20, true);
rb->lcd_bitmap(bitmap_0, 57, 42, 15, 20);
if(tempsec >= 2)
{
rb->lcd_bitmap(bitmap_1, 76, 42, 15, 20, true);
rb->lcd_bitmap(bitmap_1, 76, 42, 15, 20);
tempsec -= 2;
}
else
rb->lcd_bitmap(bitmap_0, 76, 42, 15, 20, true);
rb->lcd_bitmap(bitmap_0, 76, 42, 15, 20);
if(tempsec >= 1)
{
rb->lcd_bitmap(bitmap_1, 95, 42, 15, 20, true);
rb->lcd_bitmap(bitmap_1, 95, 42, 15, 20);
tempsec -= 1;
}
else
rb->lcd_bitmap(bitmap_0, 95, 42, 15, 20, true);
rb->lcd_bitmap(bitmap_0, 95, 42, 15, 20);
rb->lcd_update();
}
@ -1039,7 +1039,7 @@ void show_logo(bool animate, bool show_clock_text)
rb->lcd_drawline(0, y_position/2-1, 111, y_position/2-1);
rb->lcd_drawline(0, y_position/2+38, 111, y_position/2+38);
rb->lcd_set_drawmode(DRMODE_SOLID);
rb->lcd_bitmap(clogo, 0, y_position/2, 112, 37, true);
rb->lcd_bitmap(clogo, 0, y_position/2, 112, 37);
if(show_clock_text)
rb->lcd_putsxy(LCD_WIDTH/2-buf_w/2, 48, buf);
rb->lcd_update();
@ -1051,7 +1051,7 @@ void show_logo(bool animate, bool show_clock_text)
rb->lcd_drawline(0, y_position/2-1, 111, y_position/2-1);
rb->lcd_drawline(0, y_position/2+38, 111, y_position/2+38);
rb->lcd_set_drawmode(DRMODE_SOLID);
rb->lcd_bitmap(clogo, 0, y_position/2, 112, 37, true);
rb->lcd_bitmap(clogo, 0, y_position/2, 112, 37);
if(show_clock_text)
rb->lcd_putsxy(LCD_WIDTH/2-buf_w/2, 48, buf);
rb->lcd_update();
@ -1063,7 +1063,7 @@ void show_logo(bool animate, bool show_clock_text)
rb->lcd_drawline(0, y_position/2-1, 111, y_position/2-1);
rb->lcd_drawline(0, y_position/2+38, 111, y_position/2+38);
rb->lcd_set_drawmode(DRMODE_SOLID);
rb->lcd_bitmap(clogo, 0, y_position/2, 112, 37, true);
rb->lcd_bitmap(clogo, 0, y_position/2, 112, 37);
if(show_clock_text)
rb->lcd_putsxy(LCD_WIDTH/2-buf_w/2, 48, buf);
rb->lcd_update();
@ -1071,7 +1071,7 @@ void show_logo(bool animate, bool show_clock_text)
}
else /* don't animate, just show */
{
rb->lcd_bitmap(clogo, 0, 10, 112, 37, true);
rb->lcd_bitmap(clogo, 0, 10, 112, 37);
if(show_clock_text)
rb->lcd_putsxy(LCD_WIDTH/2-buf_w/2, 48, buf);
rb->lcd_update();
@ -1094,7 +1094,7 @@ void exit_logo(void)
rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
rb->lcd_drawline(0, y_position/2-1, 111, y_position/2-1);
rb->lcd_set_drawmode(DRMODE_SOLID);
rb->lcd_bitmap(clogo, 0, y_position/2, 112, 37, true);
rb->lcd_bitmap(clogo, 0, y_position/2, 112, 37);
rb->lcd_update();
}
}
@ -1511,9 +1511,9 @@ bool f1_screen(void)
void draw_checkbox(bool setting, int x, int y)
{
if(setting) /* checkbox is on */
rb->lcd_bitmap(checkbox_full, x, y, 8, 6, true);
rb->lcd_bitmap(checkbox_full, x, y, 8, 6);
else /* checkbox is off */
rb->lcd_bitmap(checkbox_empty, x, y, 8, 6, true);
rb->lcd_bitmap(checkbox_empty, x, y, 8, 6);
}
void draw_settings(void)
@ -1544,18 +1544,18 @@ void draw_settings(void)
draw_checkbox(settings.analog_digits, 1, 33);
if(settings.analog_date == 0)
rb->lcd_bitmap(checkbox_empty, 1, 41, 8, 6, true);
rb->lcd_bitmap(checkbox_empty, 1, 41, 8, 6);
else if(settings.analog_date == 1)
rb->lcd_bitmap(checkbox_half, 1, 41, 8, 6, true);
rb->lcd_bitmap(checkbox_half, 1, 41, 8, 6);
else
rb->lcd_bitmap(checkbox_full, 1, 41, 8, 6, true);
rb->lcd_bitmap(checkbox_full, 1, 41, 8, 6);
if(settings.analog_time == 0)
rb->lcd_bitmap(checkbox_empty, 1, 49, 8, 6, true);
rb->lcd_bitmap(checkbox_empty, 1, 49, 8, 6);
else if(settings.analog_time == 1)
rb->lcd_bitmap(checkbox_half, 1, 49, 8, 6, true);
rb->lcd_bitmap(checkbox_half, 1, 49, 8, 6);
else
rb->lcd_bitmap(checkbox_full, 1, 49, 8, 6, true);
rb->lcd_bitmap(checkbox_full, 1, 49, 8, 6);
draw_checkbox(settings.analog_secondhand, 1, 57);
}
@ -1584,20 +1584,20 @@ void draw_settings(void)
/* Draw checkboxes */
if(settings.digital_date == 0)
rb->lcd_bitmap(checkbox_empty, 1, 33, 8, 6, true);
rb->lcd_bitmap(checkbox_empty, 1, 33, 8, 6);
else if(settings.digital_date == 1)
rb->lcd_bitmap(checkbox_half, 1, 33, 8, 6, true);
rb->lcd_bitmap(checkbox_half, 1, 33, 8, 6);
else
rb->lcd_bitmap(checkbox_full, 1, 33, 8, 6, true);
rb->lcd_bitmap(checkbox_full, 1, 33, 8, 6);
if(settings.digital_seconds == 0)
rb->lcd_bitmap(checkbox_empty, 1, 41, 8, 6, true);
rb->lcd_bitmap(checkbox_empty, 1, 41, 8, 6);
else if(settings.digital_seconds == 1)
rb->lcd_bitmap(checkbox_onethird, 1, 41, 8, 6, true);
rb->lcd_bitmap(checkbox_onethird, 1, 41, 8, 6);
else if(settings.digital_seconds == 2)
rb->lcd_bitmap(checkbox_twothird, 1, 41, 8, 6, true);
rb->lcd_bitmap(checkbox_twothird, 1, 41, 8, 6);
else
rb->lcd_bitmap(checkbox_full, 1, 41, 8, 6, true);
rb->lcd_bitmap(checkbox_full, 1, 41, 8, 6);
draw_checkbox(settings.digital_blinkcolon, 1, 49);
draw_checkbox(settings.digital_12h, 1, 57);
@ -1627,20 +1627,20 @@ void draw_settings(void)
/* Draw checkboxes */
if(settings.lcd_date == 0)
rb->lcd_bitmap(checkbox_empty, 1, 33, 8, 6, true);
rb->lcd_bitmap(checkbox_empty, 1, 33, 8, 6);
else if(settings.lcd_date == 1)
rb->lcd_bitmap(checkbox_half, 1, 33, 8, 6, true);
rb->lcd_bitmap(checkbox_half, 1, 33, 8, 6);
else
rb->lcd_bitmap(checkbox_full, 1, 33, 8, 6, true);
rb->lcd_bitmap(checkbox_full, 1, 33, 8, 6);
if(settings.lcd_seconds == 0)
rb->lcd_bitmap(checkbox_empty, 1, 41, 8, 6, true);
rb->lcd_bitmap(checkbox_empty, 1, 41, 8, 6);
else if(settings.lcd_seconds == 1)
rb->lcd_bitmap(checkbox_onethird, 1, 41, 8, 6, true);
rb->lcd_bitmap(checkbox_onethird, 1, 41, 8, 6);
else if(settings.lcd_seconds == 2)
rb->lcd_bitmap(checkbox_twothird, 1, 41, 8, 6, true);
rb->lcd_bitmap(checkbox_twothird, 1, 41, 8, 6);
else
rb->lcd_bitmap(checkbox_full, 1, 41, 8, 6, true);
rb->lcd_bitmap(checkbox_full, 1, 41, 8, 6);
draw_checkbox(settings.lcd_blinkcolon, 1, 49);
draw_checkbox(settings.lcd_12h, 1, 57);
@ -2131,16 +2131,16 @@ void general_settings(void)
rb->lcd_getstringsize(buf, &buf_w, &buf_h);
rb->lcd_putsxy(LCD_WIDTH/2-buf_w/2, 56, buf);
rb->lcd_bitmap(arrow, 1, 17, 8, 6, true);
rb->lcd_bitmap(arrow, 1, 25, 8, 6, true);
rb->lcd_bitmap(arrow, 1, 17, 8, 6);
rb->lcd_bitmap(arrow, 1, 25, 8, 6);
draw_checkbox(settings.display_counter, 1, 33);
if(settings.save_mode == 1)
rb->lcd_bitmap(checkbox_onethird, 1, 41, 8, 6, true);
rb->lcd_bitmap(checkbox_onethird, 1, 41, 8, 6);
else if(settings.save_mode == 2)
rb->lcd_bitmap(checkbox_twothird, 1, 41, 8, 6, true);
rb->lcd_bitmap(checkbox_twothird, 1, 41, 8, 6);
else
rb->lcd_bitmap(checkbox_full, 1, 41, 8, 6, true);
rb->lcd_bitmap(checkbox_full, 1, 41, 8, 6);
switch(cursorpos)
{
@ -2181,15 +2181,15 @@ void general_settings(void)
rb->lcd_puts(2, 5, "Save: Automatic");
else
rb->lcd_puts(2, 5, "Save: Manually");
rb->lcd_bitmap(arrow, 1, 17, 8, 6, true);
rb->lcd_bitmap(arrow, 1, 25, 8, 6, true);
rb->lcd_bitmap(arrow, 1, 17, 8, 6);
rb->lcd_bitmap(arrow, 1, 25, 8, 6);
draw_checkbox(settings.display_counter, 1, 33);
if(settings.save_mode == 1)
rb->lcd_bitmap(checkbox_onethird, 1, 41, 8, 6, true);
rb->lcd_bitmap(checkbox_onethird, 1, 41, 8, 6);
else if(settings.save_mode == 2)
rb->lcd_bitmap(checkbox_twothird, 1, 41, 8, 6, true);
rb->lcd_bitmap(checkbox_twothird, 1, 41, 8, 6);
else
rb->lcd_bitmap(checkbox_full, 1, 41, 8, 6, true);
rb->lcd_bitmap(checkbox_full, 1, 41, 8, 6);
cursor(0, cursor_y, 112, 8);
rb->lcd_update();
@ -2218,15 +2218,15 @@ void general_settings(void)
rb->lcd_puts(2, 5, "Save: Automatic");
else
rb->lcd_puts(2, 5, "Save: Manually");
rb->lcd_bitmap(arrow, 1, 17, 8, 6, true);
rb->lcd_bitmap(arrow, 1, 25, 8, 6, true);
rb->lcd_bitmap(arrow, 1, 17, 8, 6);
rb->lcd_bitmap(arrow, 1, 25, 8, 6);
draw_checkbox(settings.display_counter, 1, 33);
if(settings.save_mode == 1)
rb->lcd_bitmap(checkbox_onethird, 1, 41, 8, 6, true);
rb->lcd_bitmap(checkbox_onethird, 1, 41, 8, 6);
else if(settings.save_mode == 2)
rb->lcd_bitmap(checkbox_twothird, 1, 41, 8, 6, true);
rb->lcd_bitmap(checkbox_twothird, 1, 41, 8, 6);
else
rb->lcd_bitmap(checkbox_full, 1, 41, 8, 6, true);
rb->lcd_bitmap(checkbox_full, 1, 41, 8, 6);
cursor(0, cursor_y, 112, 8);
rb->lcd_update();
@ -2323,9 +2323,9 @@ void draw_extras(int year, int day, int month, int hour, int minute, int second)
if(settings.analog_time == 2)
{
if(current_time->tm_hour > 12) /* PM */
rb->lcd_bitmap(pm, 96, 1, 15, 8, true);
rb->lcd_bitmap(pm, 96, 1, 15, 8);
else /* AM */
rb->lcd_bitmap(am, 96, 1, 15, 8, true);
rb->lcd_bitmap(am, 96, 1, 15, 8);
}
}
@ -2460,11 +2460,11 @@ void select_mode(void)
rb->lcd_puts(0, 7, "PLAY:Go|OFF:Cancel");
/* draw an arrow next to all of them */
rb->lcd_bitmap(arrow, 1, 9, 8, 6, true);
rb->lcd_bitmap(arrow, 1, 17, 8, 6, true);
rb->lcd_bitmap(arrow, 1, 25, 8, 6, true);
rb->lcd_bitmap(arrow, 1, 33, 8, 6, true);
rb->lcd_bitmap(arrow, 1, 41, 8, 6, true);
rb->lcd_bitmap(arrow, 1, 9, 8, 6);
rb->lcd_bitmap(arrow, 1, 17, 8, 6);
rb->lcd_bitmap(arrow, 1, 25, 8, 6);
rb->lcd_bitmap(arrow, 1, 33, 8, 6);
rb->lcd_bitmap(arrow, 1, 41, 8, 6);
/* draw line selector */
switch(cursorpos)
@ -2501,11 +2501,11 @@ void select_mode(void)
rb->lcd_puts(0, 7, "PLAY:Go|OFF:Cancel");
/* draw an arrow next to all of them */
rb->lcd_bitmap(arrow, 1, 9, 8, 6, true);
rb->lcd_bitmap(arrow, 1, 17, 8, 6, true);
rb->lcd_bitmap(arrow, 1, 25, 8, 6, true);
rb->lcd_bitmap(arrow, 1, 33, 8, 6, true);
rb->lcd_bitmap(arrow, 1, 41, 8, 6, true);
rb->lcd_bitmap(arrow, 1, 9, 8, 6);
rb->lcd_bitmap(arrow, 1, 17, 8, 6);
rb->lcd_bitmap(arrow, 1, 25, 8, 6);
rb->lcd_bitmap(arrow, 1, 33, 8, 6);
rb->lcd_bitmap(arrow, 1, 41, 8, 6);
cursor(0, cursor_y, 112, 8);
rb->lcd_update();
@ -2535,11 +2535,11 @@ void select_mode(void)
rb->lcd_puts(0, 7, "PLAY:Go|OFF:Cancel");
/* draw an arrow next to all of them */
rb->lcd_bitmap(arrow, 1, 9, 8, 6, true);
rb->lcd_bitmap(arrow, 1, 17, 8, 6, true);
rb->lcd_bitmap(arrow, 1, 25, 8, 6, true);
rb->lcd_bitmap(arrow, 1, 33, 8, 6, true);
rb->lcd_bitmap(arrow, 1, 41, 8, 6, true);
rb->lcd_bitmap(arrow, 1, 9, 8, 6);
rb->lcd_bitmap(arrow, 1, 17, 8, 6);
rb->lcd_bitmap(arrow, 1, 25, 8, 6);
rb->lcd_bitmap(arrow, 1, 33, 8, 6);
rb->lcd_bitmap(arrow, 1, 41, 8, 6);
cursor(0, cursor_y, 112, 8);
rb->lcd_update();
@ -2580,7 +2580,7 @@ void counter_finished(void)
rb->lcd_clear_display();
/* draw "TIME'S UP" text */
rb->lcd_bitmap(times_up, 0, xpos, 112, 50, true);
rb->lcd_bitmap(times_up, 0, xpos, 112, 50);
/* invert lcd */
rb->lcd_set_drawmode(DRMODE_COMPLEMENT);

View File

@ -71,9 +71,9 @@ static unsigned char cursor_pic[32] = {
/* draw a spot at the coordinates (x,y), range of p is 0-19 */
static void draw_spot(int p) {
ptr = spot_pic[spots[p]];
rb->lcd_bitmap (ptr, (p%5)*16+1, (p/5)*16+1, 14, 8, true);
rb->lcd_bitmap (ptr, (p%5)*16+1, (p/5)*16+1, 14, 8);
ptr += 14;
rb->lcd_bitmap (ptr, (p%5)*16+1, (p/5)*16+9, 14, 6, true);
rb->lcd_bitmap (ptr, (p%5)*16+1, (p/5)*16+9, 14, 6);
}
/* draw the cursor at the current cursor position */
@ -81,10 +81,12 @@ static void draw_cursor(void) {
int i,j;
i = (cursor_pos%5)*16;
j = (cursor_pos/5)*16;
rb->lcd_set_drawmode(DRMODE_FG);
ptr = cursor_pic;
rb->lcd_bitmap (ptr, i, j, 16, 8, false);
rb->lcd_bitmap (ptr, i, j, 16, 8);
ptr += 16;
rb->lcd_bitmap (ptr, i, j+8, 16, 8, false);
rb->lcd_bitmap (ptr, i, j+8, 16, 8);
rb->lcd_set_drawmode(DRMODE_SOLID);
}
/* clear the cursor where it is */

View File

@ -229,7 +229,7 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) {
while (1) {
#ifdef HAVE_LCD_BITMAP
rb->lcd_clear_display();
rb->lcd_bitmap(LOGO, x, y, LOGO_WIDTH, LOGO_HEIGHT, false);
rb->lcd_bitmap(LOGO, x, y, LOGO_WIDTH, LOGO_HEIGHT);
#ifdef REMOTE_LOGO
rb->remote_clear_display();
rb->remote_bitmap(REMOTE_LOGO,

View File

@ -379,7 +379,9 @@ int minesweeper(void)
if(minefield[i][j].mine){
rb->lcd_putsxy(j*8+1,i*8+1,"b");
} else if(minefield[i][j].neighbors){
rb->lcd_bitmap(num[minefield[i][j].neighbors],j*8,i*8,8,8,false);
rb->lcd_set_drawmode(DRMODE_FG);
rb->lcd_bitmap(num[minefield[i][j].neighbors],j*8,i*8,8,8);
rb->lcd_set_drawmode(DRMODE_SOLID);
}
} else if(minefield[i][j].flag) {
rb->lcd_drawline(j*8+2,i*8+2,j*8+5,i*8+5);

View File

@ -148,7 +148,7 @@ static unsigned char picture[20][32] = {
static void draw_spot(int p, int x, int y)
{
if (pic || p==20) {
rb->lcd_bitmap (picture[p-1], x, y, 16, 16, true);
rb->lcd_bitmap (picture[p-1], x, y, 16, 16);
} else {
rb->lcd_drawrect(x, y, 16, 16);
rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);

View File

@ -619,11 +619,13 @@ void draw_apple( void )
#if LCD_WIDTH >= 160 && LCD_HEIGHT >= 128
char pscore[5], counter[4];
rb->lcd_bitmap(snakebmp,0,0,BMPWIDTH_snakebmp,BMPHEIGHT_snakebmp,false);
rb->lcd_set_drawmode(DRMODE_FG);
rb->lcd_bitmap(snakebmp,0,0,BMPWIDTH_snakebmp,BMPHEIGHT_snakebmp);
rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
rb->lcd_fillrect(0,0,BMPWIDTH_snakeupbmp,BMPHEIGHT_snakeupbmp);
rb->lcd_set_drawmode(DRMODE_FG);
rb->lcd_bitmap(snakeupbmp,0,0,BMPWIDTH_snakeupbmp,BMPHEIGHT_snakeupbmp);
rb->lcd_set_drawmode(DRMODE_SOLID);
rb->lcd_bitmap(snakeupbmp,0,0,BMPWIDTH_snakeupbmp,BMPHEIGHT_snakeupbmp,false);
rb->snprintf(counter,sizeof(counter),"%d",applecount);
rb->lcd_getstringsize(counter,&strwdt,&strhgt);
@ -1295,8 +1297,10 @@ void game_init(void)
#if LCD_WIDTH >= 160 && LCD_HEIGHT >= 128
rb->lcd_bitmap(snakebmp,0,0,BMPWIDTH_snakebmp,BMPWIDTH_snakebmp,false);
rb->lcd_set_drawmode(DRMODE_FG);
rb->lcd_bitmap(snakebmp,0,0,BMPWIDTH_snakebmp,BMPWIDTH_snakebmp);
rb->lcd_set_drawmode(DRMODE_SOLID);
rb->snprintf(plevel,sizeof(plevel),"%d",level);
rb->lcd_getstringsize(plevel,&strwdt,&strhgt);
rb->lcd_putsxy(42-strwdt/2,25, plevel);

View File

@ -115,7 +115,7 @@ static void snow_move(void)
if (particle_exists(i))
#ifdef HAVE_LCD_BITMAP
rb->lcd_bitmap(flake,particles[i][0],particles[i][1],
FLAKE_WIDTH,FLAKE_WIDTH,true);
FLAKE_WIDTH,FLAKE_WIDTH);
#else
pgfx_drawpixel(particles[i][0],particles[i][1]);
#endif

View File

@ -900,8 +900,8 @@ int solitaire(void){
rb->lcd_set_drawmode(DRMODE_SOLID);
/* known card */
if(deck[c].known){
rb->lcd_bitmap(numbers[deck[c].num], i*(LCD_WIDTH - CARD_WIDTH)/COL_NUM+1, j, 8, 8, true);
rb->lcd_bitmap(colors[deck[c].color], i*(LCD_WIDTH - CARD_WIDTH)/COL_NUM+7, j, 8, 8, true);
rb->lcd_bitmap(numbers[deck[c].num], i*(LCD_WIDTH - CARD_WIDTH)/COL_NUM+1, j, 8, 8);
rb->lcd_bitmap(colors[deck[c].color], i*(LCD_WIDTH - CARD_WIDTH)/COL_NUM+7, j, 8, 8);
}
/* draw top line of the card */
rb->lcd_drawline(i*(LCD_WIDTH - CARD_WIDTH)/COL_NUM+1,j,i*(LCD_WIDTH - CARD_WIDTH)/COL_NUM+CARD_WIDTH-1,j);
@ -944,9 +944,9 @@ int solitaire(void){
}
}
if(c != NOT_A_CARD) {
rb->lcd_bitmap(numbers[deck[c].num], LCD_WIDTH2 - CARD_WIDTH+1, i*CARD_HEIGHT, 8, 8, true);
rb->lcd_bitmap(numbers[deck[c].num], LCD_WIDTH2 - CARD_WIDTH+1, i*CARD_HEIGHT, 8, 8);
}
rb->lcd_bitmap(colors[i], LCD_WIDTH2 - CARD_WIDTH+7, i*CARD_HEIGHT, 8, 8, true);
rb->lcd_bitmap(colors[i], LCD_WIDTH2 - CARD_WIDTH+7, i*CARD_HEIGHT, 8, 8);
/* draw a selected card */
if(c != NOT_A_CARD) {
if(sel_card == c){
@ -976,8 +976,8 @@ int solitaire(void){
rb->lcd_drawline(LCD_WIDTH2,LCD_HEIGHT-CARD_HEIGHT,LCD_WIDTH2,LCD_HEIGHT-2);
#endif
if(cur_rem != NOT_A_CARD){
rb->lcd_bitmap(numbers[deck[cur_rem].num], LCD_WIDTH2 - CARD_WIDTH+1, LCD_HEIGHT-CARD_HEIGHT, 8, 8, true);
rb->lcd_bitmap(colors[deck[cur_rem].color], LCD_WIDTH2 - CARD_WIDTH+7, LCD_HEIGHT-CARD_HEIGHT, 8, 8, true);
rb->lcd_bitmap(numbers[deck[cur_rem].num], LCD_WIDTH2 - CARD_WIDTH+1, LCD_HEIGHT-CARD_HEIGHT, 8, 8);
rb->lcd_bitmap(colors[deck[cur_rem].color], LCD_WIDTH2 - CARD_WIDTH+7, LCD_HEIGHT-CARD_HEIGHT, 8, 8);
/* draw a selected card */
if(sel_card == cur_rem){
rb->lcd_drawrect(LCD_WIDTH2 - CARD_WIDTH+1, LCD_HEIGHT-CARD_HEIGHT,CARD_WIDTH-1, CARD_HEIGHT-1);

View File

@ -262,18 +262,18 @@ static void update_icons(void)
/* The CUT icon */
rb->lcd_bitmap(CUT_BMP,
LCD_WIDTH / 3 / 2 - BMPWIDTH / 2, LCD_HEIGHT - BMPHEIGHT,
BMPWIDTH, BMPHEIGHT, true);
BMPWIDTH, BMPHEIGHT);
/* The loop mode icon */
rb->lcd_bitmap(LOOP_BMP[splitedit_get_loop_mode()],
LCD_WIDTH/3 + LCD_WIDTH/3 / 2 - BMPWIDTH/2, LCD_HEIGHT - BMPHEIGHT,
BMPWIDTH, BMPHEIGHT, true);
BMPWIDTH, BMPHEIGHT);
#if (CONFIG_HWCODEC == MAS3587F) || (CONFIG_HWCODEC == MAS3539F)
/* The scale icon */
rb->lcd_bitmap(SCALE_BMP[rb->peak_meter_get_use_dbfs()],
2 *LCD_WIDTH/3 + LCD_WIDTH/3 / 2 - BMPWIDTH/2, LCD_HEIGHT - BMPHEIGHT,
BMPWIDTH, BMPHEIGHT, true);
BMPWIDTH, BMPHEIGHT);
#else
{
static int idx;
@ -281,7 +281,7 @@ static void update_icons(void)
idx = 1 - idx;
rb->lcd_bitmap(SCALE_BMP[idx],
2 *LCD_WIDTH/3 + LCD_WIDTH/3 / 2 - BMPWIDTH/2, LCD_HEIGHT - BMPHEIGHT,
BMPWIDTH, BMPHEIGHT, true);
BMPWIDTH, BMPHEIGHT);
}
#endif

View File

@ -485,10 +485,10 @@ static void star_display_board_info(void)
if (control == STAR_CONTROL_BALL)
rb->lcd_bitmap (ball_bmp, 103, label_offset_y + 1, STAR_TILE_SIZE,
STAR_TILE_SIZE, true);
STAR_TILE_SIZE);
else
rb->lcd_bitmap (block_bmp, 103, label_offset_y + 1, STAR_TILE_SIZE,
STAR_TILE_SIZE, true);
STAR_TILE_SIZE);
rb->lcd_update_rect(0, label_offset_y, LCD_WIDTH, char_height);
}
@ -522,14 +522,14 @@ static int star_load_level(int current_level)
rb->lcd_bitmap (wall_bmp,
STAR_OFFSET_X + x * STAR_TILE_SIZE,
STAR_OFFSET_Y + y * STAR_TILE_SIZE,
STAR_TILE_SIZE, STAR_TILE_SIZE, false);
STAR_TILE_SIZE, STAR_TILE_SIZE);
break;
case STAR_STAR:
rb->lcd_bitmap (star_bmp,
STAR_OFFSET_X + x * STAR_TILE_SIZE,
STAR_OFFSET_Y + y * STAR_TILE_SIZE,
STAR_TILE_SIZE, STAR_TILE_SIZE, false);
STAR_TILE_SIZE, STAR_TILE_SIZE);
star_count++;
break;
@ -539,7 +539,7 @@ static int star_load_level(int current_level)
rb->lcd_bitmap (ball_bmp,
STAR_OFFSET_X + x * STAR_TILE_SIZE,
STAR_OFFSET_Y + y * STAR_TILE_SIZE,
STAR_TILE_SIZE, STAR_TILE_SIZE, false);
STAR_TILE_SIZE, STAR_TILE_SIZE);
break;
@ -549,7 +549,7 @@ static int star_load_level(int current_level)
rb->lcd_bitmap (block_bmp,
STAR_OFFSET_X + x * STAR_TILE_SIZE,
STAR_OFFSET_Y + y * STAR_TILE_SIZE,
STAR_TILE_SIZE, STAR_TILE_SIZE, false);
STAR_TILE_SIZE, STAR_TILE_SIZE);
break;
}
ptr_tab++;
@ -668,7 +668,7 @@ static int star_run_game(void)
ball_bmp,
STAR_OFFSET_X + ball_x * STAR_TILE_SIZE + move_x * i,
STAR_OFFSET_Y + ball_y * STAR_TILE_SIZE + move_y * i,
STAR_TILE_SIZE, STAR_TILE_SIZE, true);
STAR_TILE_SIZE, STAR_TILE_SIZE);
rb->lcd_update_rect(
STAR_OFFSET_X + ball_x * STAR_TILE_SIZE + move_x * i,
@ -700,7 +700,7 @@ static int star_run_game(void)
block_bmp,
STAR_OFFSET_X + block_x * STAR_TILE_SIZE + move_x * i,
STAR_OFFSET_Y + block_y * STAR_TILE_SIZE + move_y * i,
STAR_TILE_SIZE, STAR_TILE_SIZE, true);
STAR_TILE_SIZE, STAR_TILE_SIZE);
rb->lcd_update_rect(
STAR_OFFSET_X + block_x * STAR_TILE_SIZE + move_x * i,
@ -766,7 +766,7 @@ static int star_menu(void)
move_y = 0;
rb->lcd_bitmap(arrow_bmp[anim_arrow[(anim_state & 0x38) >> 3]],
2, menu_offset_y + menu_y * char_height, 7, 8, true);
2, menu_offset_y + menu_y * char_height, 7, 8);
rb->lcd_update_rect (2, menu_offset_y + menu_y * 8, 8, 8);
rb->sleep(STAR_SLEEP);
anim_state++;
@ -840,14 +840,14 @@ static int star_menu(void)
{
rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
rb->lcd_fillrect (2, 30, 7, 4 * 8);
rb->lcd_set_drawmode(DRMODE_SOLID);
rb->lcd_set_drawmode(DRMODE_FG);
rb->lcd_bitmap(arrow_bmp[anim_arrow[(anim_state & 0x38) >> 3]],
2, menu_offset_y + menu_y * 8 + move_y * i, 7, 8,
false);
2, menu_offset_y + menu_y * 8 + move_y * i, 7, 8);
rb->lcd_update_rect(2, 30, 8, 4 * 8);
anim_state++;
rb->sleep(STAR_SLEEP);
}
rb->lcd_set_drawmode(DRMODE_SOLID);
menu_y += move_y;
}
}

View File

@ -278,47 +278,55 @@ void change_settings(void)
}
void draw_analog_minimeters(void) {
rb->lcd_bitmap(sound_speaker, 0, 12, 4, 8, true);
rb->lcd_bitmap(sound_speaker, 0, 12, 4, 8);
rb->lcd_set_drawmode(DRMODE_FG);
if(5<left_needle_top_x)
rb->lcd_bitmap(sound_low_level, 5, 12, 2, 8, false);
rb->lcd_bitmap(sound_low_level, 5, 12, 2, 8);
if(12<left_needle_top_x)
rb->lcd_bitmap(sound_med_level, 7, 12, 2, 8, false);
rb->lcd_bitmap(sound_med_level, 7, 12, 2, 8);
if(24<left_needle_top_x)
rb->lcd_bitmap(sound_high_level, 9, 12, 2, 8, false);
rb->lcd_bitmap(sound_high_level, 9, 12, 2, 8);
if(40<left_needle_top_x)
rb->lcd_bitmap(sound_max_level, 12, 12, 3, 8, false);
rb->lcd_bitmap(sound_max_level, 12, 12, 3, 8);
rb->lcd_bitmap(sound_speaker, 54, 12, 4, 8, true);
rb->lcd_set_drawmode(DRMODE_SOLID);
rb->lcd_bitmap(sound_speaker, 54, 12, 4, 8);
rb->lcd_set_drawmode(DRMODE_FG);
if(5<(right_needle_top_x-56))
rb->lcd_bitmap(sound_low_level, 59, 12, 2, 8, false);
rb->lcd_bitmap(sound_low_level, 59, 12, 2, 8);
if(12<(right_needle_top_x-56))
rb->lcd_bitmap(sound_med_level, 61, 12, 2, 8, false);
rb->lcd_bitmap(sound_med_level, 61, 12, 2, 8);
if(24<(right_needle_top_x-56))
rb->lcd_bitmap(sound_high_level, 63, 12, 2, 8, false);
rb->lcd_bitmap(sound_high_level, 63, 12, 2, 8);
if(40<(right_needle_top_x-56))
rb->lcd_bitmap(sound_max_level, 66, 12, 3, 8, false);
rb->lcd_bitmap(sound_max_level, 66, 12, 3, 8);
rb->lcd_set_drawmode(DRMODE_SOLID);
}
void draw_digital_minimeters(void) {
rb->lcd_bitmap(sound_speaker, 34, 24, 4, 8, true);
rb->lcd_bitmap(sound_speaker, 34, 24, 4, 8);
rb->lcd_set_drawmode(DRMODE_FG);
if(1<num_left_leds)
rb->lcd_bitmap(sound_low_level, 39, 24, 2, 8, false);
rb->lcd_bitmap(sound_low_level, 39, 24, 2, 8);
if(2<num_left_leds)
rb->lcd_bitmap(sound_med_level, 41, 24, 2, 8, false);
rb->lcd_bitmap(sound_med_level, 41, 24, 2, 8);
if(5<num_left_leds)
rb->lcd_bitmap(sound_high_level, 43, 24, 2, 8, false);
rb->lcd_bitmap(sound_high_level, 43, 24, 2, 8);
if(8<num_left_leds)
rb->lcd_bitmap(sound_max_level, 46, 24, 3, 8, false);
rb->lcd_bitmap(sound_max_level, 46, 24, 3, 8);
rb->lcd_bitmap(sound_speaker, 34, 40, 4, 8, true);
rb->lcd_set_drawmode(DRMODE_SOLID);
rb->lcd_bitmap(sound_speaker, 34, 40, 4, 8);
rb->lcd_set_drawmode(DRMODE_FG);
if(1<(num_right_leds))
rb->lcd_bitmap(sound_low_level, 39, 40, 2, 8, false);
rb->lcd_bitmap(sound_low_level, 39, 40, 2, 8);
if(2<(num_right_leds))
rb->lcd_bitmap(sound_med_level, 41, 40, 2, 8, false);
rb->lcd_bitmap(sound_med_level, 41, 40, 2, 8);
if(5<(num_right_leds))
rb->lcd_bitmap(sound_high_level, 43, 40, 2, 8, false);
rb->lcd_bitmap(sound_high_level, 43, 40, 2, 8);
if(8<(num_right_leds))
rb->lcd_bitmap(sound_max_level, 46, 40, 3, 8, false);
rb->lcd_bitmap(sound_max_level, 46, 40, 3, 8);
rb->lcd_set_drawmode(DRMODE_SOLID);
}
void analog_meter(void) {
@ -350,8 +358,10 @@ void analog_meter(void) {
draw_analog_minimeters();
/* Needle covers */
rb->lcd_bitmap(needle_cover, 22, 59, 13, 5, false);
rb->lcd_bitmap(needle_cover, 78, 59, 13, 5, false);
rb->lcd_set_drawmode(DRMODE_FG);
rb->lcd_bitmap(needle_cover, 22, 59, 13, 5);
rb->lcd_bitmap(needle_cover, 78, 59, 13, 5);
rb->lcd_set_drawmode(DRMODE_SOLID);
/* Show Left/Right */
rb->lcd_putsxy(16, 12, "Left");
@ -383,12 +393,15 @@ void digital_meter(void) {
last_num_left_leds = num_left_leds;
last_num_right_leds = num_right_leds;
rb->lcd_set_drawmode(DRMODE_FG);
/* LEDS */
for(i=0; i<num_left_leds; i++)
rb->lcd_bitmap(led, i*9+2+i, 14, 9, 5, false);
rb->lcd_bitmap(led, i*9+2+i, 14, 9, 5);
for(i=0; i<num_right_leds; i++)
rb->lcd_bitmap(led, i*9+2+i, 52, 9, 5, false);
rb->lcd_bitmap(led, i*9+2+i, 52, 9, 5);
rb->lcd_set_drawmode(DRMODE_SOLID);
if(settings.digital_minimeters)
draw_digital_minimeters();

View File

@ -323,7 +323,7 @@ bool statusbar_icon_volume(int percent)
if (volume==0) {
lcd_bitmap(bitmap_icons_7x8[Icon_Mute],
ICON_VOLUME_X_POS + ICON_VOLUME_WIDTH / 2 - 4,
STATUSBAR_Y_POS, 7, STATUSBAR_HEIGHT, false);
STATUSBAR_Y_POS, 7, STATUSBAR_HEIGHT);
}
else {
/* We want to redraw the icon later on */
@ -371,7 +371,7 @@ bool statusbar_icon_volume(int percent)
void statusbar_icon_play_state(int state)
{
lcd_bitmap(bitmap_icons_7x8[state], ICON_PLAY_STATE_X_POS, STATUSBAR_Y_POS,
ICON_PLAY_STATE_WIDTH, STATUSBAR_HEIGHT, false);
ICON_PLAY_STATE_WIDTH, STATUSBAR_HEIGHT);
}
/*
@ -380,7 +380,7 @@ void statusbar_icon_play_state(int state)
void statusbar_icon_play_mode(int mode)
{
lcd_bitmap(bitmap_icons_7x8[mode], ICON_PLAY_MODE_X_POS, STATUSBAR_Y_POS,
ICON_PLAY_MODE_WIDTH, STATUSBAR_HEIGHT, false);
ICON_PLAY_MODE_WIDTH, STATUSBAR_HEIGHT);
}
/*
@ -389,7 +389,7 @@ void statusbar_icon_play_mode(int mode)
void statusbar_icon_shuffle(void)
{
lcd_bitmap(bitmap_icons_7x8[Icon_Shuffle], ICON_SHUFFLE_X_POS,
STATUSBAR_Y_POS, ICON_SHUFFLE_WIDTH, STATUSBAR_HEIGHT, false);
STATUSBAR_Y_POS, ICON_SHUFFLE_WIDTH, STATUSBAR_HEIGHT);
}
/*
@ -398,7 +398,7 @@ void statusbar_icon_shuffle(void)
void statusbar_icon_lock(void)
{
lcd_bitmap(bitmap_icons_5x8[Icon_Lock], LOCK_X_POS,
STATUSBAR_Y_POS, 5, 8, false);
STATUSBAR_Y_POS, 5, 8);
}
#if CONFIG_LED == LED_VIRTUAL
@ -408,7 +408,7 @@ void statusbar_icon_lock(void)
void statusbar_led(void)
{
lcd_bitmap(bitmap_icon_disk, ICON_DISK_X_POS,
STATUSBAR_Y_POS, ICON_DISK_WIDTH, STATUSBAR_HEIGHT, false);
STATUSBAR_Y_POS, ICON_DISK_WIDTH, STATUSBAR_HEIGHT);
}
#endif

View File

@ -1108,7 +1108,7 @@ void peak_meter_draw_trig(int xpos, int ypos) {
scrollbar(x, ypos + 1, TRIGBAR_WIDTH, TRIG_HEIGHT - 2,
TRIGBAR_WIDTH, 0, 0, HORIZONTAL);
lcd_bitmap(bitmap_icons_7x8[Icon_Stop], xpos, ypos,
ICON_PLAY_STATE_WIDTH, STATUSBAR_HEIGHT, false);
ICON_PLAY_STATE_WIDTH, STATUSBAR_HEIGHT);
break;
case TRIG_STEADY:
@ -1118,7 +1118,7 @@ void peak_meter_draw_trig(int xpos, int ypos) {
scrollbar(x, ypos + 1, TRIGBAR_WIDTH, TRIG_HEIGHT - 2,
TRIGBAR_WIDTH, 0, TRIGBAR_WIDTH - time_left, HORIZONTAL);
lcd_bitmap(bitmap_icons_7x8[Icon_Stop], xpos, ypos,
ICON_PLAY_STATE_WIDTH, STATUSBAR_HEIGHT, false);
ICON_PLAY_STATE_WIDTH, STATUSBAR_HEIGHT);
break;
case TRIG_GO:
@ -1127,7 +1127,7 @@ void peak_meter_draw_trig(int xpos, int ypos) {
TRIGBAR_WIDTH, TRIGBAR_WIDTH, TRIGBAR_WIDTH, HORIZONTAL);
lcd_bitmap(bitmap_icons_7x8[Icon_Record],
TRIG_WIDTH - ICON_PLAY_STATE_WIDTH, ypos,
ICON_PLAY_STATE_WIDTH, STATUSBAR_HEIGHT, false);
ICON_PLAY_STATE_WIDTH, STATUSBAR_HEIGHT);
break;
case TRIG_POSTREC:
@ -1137,7 +1137,7 @@ void peak_meter_draw_trig(int xpos, int ypos) {
TRIGBAR_WIDTH, time_left, TRIGBAR_WIDTH, HORIZONTAL);
lcd_bitmap(bitmap_icons_7x8[Icon_Record],
TRIG_WIDTH - ICON_PLAY_STATE_WIDTH, ypos,
ICON_PLAY_STATE_WIDTH, STATUSBAR_HEIGHT, false);
ICON_PLAY_STATE_WIDTH, STATUSBAR_HEIGHT);
break;
}

View File

@ -870,7 +870,7 @@ bool f2_rec_screen(void)
snprintf(buf, 32, "%d", global_settings.rec_quality);
lcd_putsxy(0, LCD_HEIGHT/2-h, buf);
lcd_bitmap(bitmap_icons_7x8[Icon_FastBackward],
LCD_WIDTH/2 - 16, LCD_HEIGHT/2 - 4, 7, 8, true);
LCD_WIDTH/2 - 16, LCD_HEIGHT/2 - 4, 7, 8);
/* Frequency */
snprintf(buf, sizeof buf, "%s:", str(LANG_RECORDING_FREQUENCY));
@ -880,7 +880,7 @@ bool f2_rec_screen(void)
lcd_getstringsize(ptr, &w, &h);
lcd_putsxy((LCD_WIDTH-w)/2, LCD_HEIGHT - h, ptr);
lcd_bitmap(bitmap_icons_7x8[Icon_DownArrow],
LCD_WIDTH/2 - 3, LCD_HEIGHT - h*3, 7, 8, true);
LCD_WIDTH/2 - 3, LCD_HEIGHT - h*3, 7, 8);
/* Channel mode */
switch ( global_settings.rec_channels ) {
@ -901,7 +901,7 @@ bool f2_rec_screen(void)
lcd_getstringsize(ptr, &w, &h);
lcd_putsxy(LCD_WIDTH - w, LCD_HEIGHT/2, ptr);
lcd_bitmap(bitmap_icons_7x8[Icon_FastForward],
LCD_WIDTH/2 + 8, LCD_HEIGHT/2 - 4, 7, 8, true);
LCD_WIDTH/2 + 8, LCD_HEIGHT/2 - 4, 7, 8);
lcd_update();
@ -995,14 +995,14 @@ bool f3_rec_screen(void)
lcd_getstringsize(ptr, &w, &h);
lcd_putsxy(0, LCD_HEIGHT/2-h, ptr);
lcd_bitmap(bitmap_icons_7x8[Icon_FastBackward],
LCD_WIDTH/2 - 16, LCD_HEIGHT/2 - 4, 7, 8, true);
LCD_WIDTH/2 - 16, LCD_HEIGHT/2 - 4, 7, 8);
/* trigger setup */
ptr = str(LANG_RECORD_TRIGGER);
lcd_getstringsize(ptr,&w,&h);
lcd_putsxy((LCD_WIDTH-w)/2, LCD_HEIGHT - h*2, ptr);
lcd_bitmap(bitmap_icons_7x8[Icon_DownArrow],
LCD_WIDTH/2 - 3, LCD_HEIGHT - h*3, 7, 8, true);
LCD_WIDTH/2 - 3, LCD_HEIGHT - h*3, 7, 8);
lcd_update();

View File

@ -94,7 +94,9 @@ void usb_display_info(void)
#ifdef HAVE_LCD_BITMAP
/* Center bitmap on screen */
lcd_bitmap(usb_logo, LCD_WIDTH/2-BMPWIDTH_usb_logo/2, LCD_HEIGHT/2-BMPHEIGHT_usb_logo/2, BMPWIDTH_usb_logo, BMPHEIGHT_usb_logo, false);
lcd_bitmap(usb_logo, LCD_WIDTH/2-BMPWIDTH_usb_logo/2,
LCD_HEIGHT/2-BMPHEIGHT_usb_logo/2, BMPWIDTH_usb_logo,
BMPHEIGHT_usb_logo);
status_draw(true);
lcd_update();
#else
@ -231,14 +233,16 @@ void charging_display_info(bool animate)
if (!animate)
{ /* draw the outline */
/* middle part */
lcd_bitmap(charging_logo, pox_x, pox_y + 8, sizeof(charging_logo), 8, true);
lcd_bitmap(charging_logo, pox_x, pox_y + 8, sizeof(charging_logo), 8);
lcd_set_drawmode(DRMODE_FG);
/* upper line */
charging_logo[0] = charging_logo[1] = 0x00;
memset(charging_logo+2, 0x80, 34);
lcd_bitmap(charging_logo, pox_x, pox_y, sizeof(charging_logo), 8, false);
lcd_bitmap(charging_logo, pox_x, pox_y, sizeof(charging_logo), 8);
/* lower line */
memset(charging_logo+2, 0x01, 34);
lcd_bitmap(charging_logo, pox_x, pox_y + 16, sizeof(charging_logo), 8, false);
lcd_bitmap(charging_logo, pox_x, pox_y + 16, sizeof(charging_logo), 8);
lcd_set_drawmode(DRMODE_SOLID);
}
else
{ /* animate the middle part */
@ -253,7 +257,7 @@ void charging_display_info(bool animate)
charging_logo[i] = 0x01 << bitpos;
}
}
lcd_bitmap(charging_logo, pox_x, pox_y + 8, sizeof(charging_logo), 8, true);
lcd_bitmap(charging_logo, pox_x, pox_y + 8, sizeof(charging_logo), 8);
phase++;
}
lcd_update();
@ -411,7 +415,7 @@ int pitch_screen(void)
lcd_getstringsize(ptr,&w,&h);
lcd_putsxy((LCD_WIDTH-w)/2, 0, ptr);
lcd_bitmap(bitmap_icons_7x8[Icon_UpArrow],
LCD_WIDTH/2 - 3, h*2, 7, 8, true);
LCD_WIDTH/2 - 3, h*2, 7, 8);
snprintf(buf, sizeof buf, "%d.%d%%", pitch / 10, pitch % 10 );
lcd_getstringsize(buf,&w,&h);
@ -421,13 +425,13 @@ int pitch_screen(void)
lcd_getstringsize(ptr,&w,&h);
lcd_putsxy((LCD_WIDTH-w)/2, LCD_HEIGHT - h, ptr);
lcd_bitmap(bitmap_icons_7x8[Icon_DownArrow],
LCD_WIDTH/2 - 3, LCD_HEIGHT - h*3, 7, 8, true);
LCD_WIDTH/2 - 3, LCD_HEIGHT - h*3, 7, 8);
ptr = str(LANG_PAUSE);
lcd_getstringsize(ptr,&w,&h);
lcd_putsxy((LCD_WIDTH-(w/2))/2, LCD_HEIGHT/2 - h/2, ptr);
lcd_bitmap(bitmap_icons_7x8[Icon_Pause],
(LCD_WIDTH-(w/2))/2-10, LCD_HEIGHT/2 - h/2, 7, 8, true);
(LCD_WIDTH-(w/2))/2-10, LCD_HEIGHT/2 - h/2, 7, 8);
lcd_update();
}
@ -632,11 +636,11 @@ bool quick_screen(int context, int button)
}
lcd_bitmap(bitmap_icons_7x8[Icon_FastBackward],
LCD_WIDTH/2 - 16, LCD_HEIGHT/2 - 4, 7, 8, true);
LCD_WIDTH/2 - 16, LCD_HEIGHT/2 - 4, 7, 8);
lcd_bitmap(bitmap_icons_7x8[Icon_DownArrow],
LCD_WIDTH/2 - 3, LCD_HEIGHT - h*3, 7, 8, true);
LCD_WIDTH/2 - 3, LCD_HEIGHT - h*3, 7, 8);
lcd_bitmap(bitmap_icons_7x8[Icon_FastForward],
LCD_WIDTH/2 + 8, LCD_HEIGHT/2 - 4, 7, 8, true);
LCD_WIDTH/2 + 8, LCD_HEIGHT/2 - 4, 7, 8);
lcd_update();
key = button_get(true);

View File

@ -245,11 +245,11 @@ void status_draw(bool force_redraw)
/* draw power plug if charging */
if (info.inserted)
lcd_bitmap(bitmap_icons_7x8[Icon_Plug], ICON_PLUG_X_POS,
STATUSBAR_Y_POS, ICON_PLUG_WIDTH, STATUSBAR_HEIGHT, false);
STATUSBAR_Y_POS, ICON_PLUG_WIDTH, STATUSBAR_HEIGHT);
#ifdef HAVE_USB_POWER
else if (info.usb_power)
lcd_bitmap(bitmap_icons_7x8[Icon_USBPlug], ICON_PLUG_X_POS,
STATUSBAR_Y_POS, ICON_PLUG_WIDTH, STATUSBAR_HEIGHT, false);
STATUSBAR_Y_POS, ICON_PLUG_WIDTH, STATUSBAR_HEIGHT);
#endif
info.redraw_volume = statusbar_icon_volume(info.volume);

View File

@ -395,8 +395,7 @@ static int showdir(void)
offset = (line_height - 8) / 2;
lcd_bitmap(icon,
CURSOR_X * 6 + CURSOR_WIDTH,
MARGIN_Y+(i-start)*line_height + offset,
6, 8, true);
MARGIN_Y+(i-start)*line_height + offset, 6, 8);
#else
if (icon < 0 )
icon = Unknown;

View File

@ -112,11 +112,13 @@ static bool wps_loaded = false;
/* Display images */
static void wps_display_images(void) {
int n;
lcd_set_drawmode(DRMODE_FG);
for (n = 0; n < MAX_IMAGES; n++) {
if (img[n].loaded) {
lcd_bitmap(img[n].ptr, img[n].x, img[n].y, img[n].w, img[n].h, false);
lcd_bitmap(img[n].ptr, img[n].x, img[n].y, img[n].w, img[n].h);
}
}
lcd_set_drawmode(DRMODE_SOLID);
}
#endif

View File

@ -208,19 +208,19 @@ void lcd_init(void)
/*** update functions ***/
/* Performance function that works with an external buffer
note that y and height are in 8-pixel units! */
void lcd_blit(const unsigned char* p_data, int x, int y, int width,
int height, int stride)
note that by and bheight are in 8-pixel units! */
void lcd_blit(const unsigned char* data, int x, int by, int width,
int bheight, int stride)
{
/* Copy display bitmap to hardware */
while (height--)
while (bheight--)
{
lcd_write_command_ex(LCD_CNTL_PAGE, y++ & 0xf, -1);
lcd_write_command_ex(LCD_CNTL_PAGE, by++ & 0xf, -1);
lcd_write_command_ex(LCD_CNTL_COLUMN, x, -1);
lcd_write_command(LCD_CNTL_DATA_WRITE);
lcd_write_data(p_data, width);
p_data += stride;
lcd_write_data(data, width);
data += stride;
}
}
@ -245,16 +245,16 @@ void lcd_update(void)
/* Update a fraction of the display. */
void lcd_update_rect(int, int, int, int) __attribute__ ((section (".icode")));
void lcd_update_rect(int x_start, int y, int width, int height)
void lcd_update_rect(int x, int y, int width, int height)
{
int ymax;
/* The Y coordinates have to work on even 8 pixel rows */
ymax = (y + height-1)/8;
y /= 8;
ymax = (y + height-1) >> 3;
y >>= 3;
if(x_start + width > LCD_WIDTH)
width = LCD_WIDTH - x_start;
if(x + width > LCD_WIDTH)
width = LCD_WIDTH - x;
if (width <= 0)
return; /* nothing left to do, 0 is harmful to lcd_write_data() */
if(ymax >= LCD_HEIGHT/8)
@ -264,10 +264,10 @@ void lcd_update_rect(int x_start, int y, int width, int height)
for (; y <= ymax; y++)
{
lcd_write_command_ex(LCD_CNTL_PAGE, y, -1);
lcd_write_command_ex(LCD_CNTL_COLUMN, x_start, -1);
lcd_write_command_ex(LCD_CNTL_COLUMN, x, -1);
lcd_write_command(LCD_CNTL_DATA_WRITE);
lcd_write_data (&lcd_framebuffer[y][x_start], width);
lcd_write_data (&lcd_framebuffer[y][x], width);
}
}
#endif /* !SIMULATOR */
@ -333,8 +333,10 @@ static void nopixel(int x, int y)
(void)y;
}
lcd_pixelfunc_type* pixelfunc[8] = {flippixel, nopixel, setpixel, setpixel,
nopixel, clearpixel, nopixel, clearpixel};
lcd_pixelfunc_type* pixelfunc[8] = {
flippixel, nopixel, setpixel, setpixel,
nopixel, clearpixel, nopixel, clearpixel
};
static void flipblock(unsigned char *address, unsigned mask, unsigned bits)
{
@ -356,7 +358,30 @@ static void solidblock(unsigned char *address, unsigned mask, unsigned bits)
*address = (*address & ~mask) | (bits & mask);
}
lcd_blockfunc_type* blockfunc[4] = {flipblock, bgblock, fgblock, solidblock};
static void flipinvblock(unsigned char *address, unsigned mask, unsigned bits)
{
*address ^= (~bits & mask);
}
static void bginvblock(unsigned char *address, unsigned mask, unsigned bits)
{
*address &= ~(bits & mask);
}
static void fginvblock(unsigned char *address, unsigned mask, unsigned bits)
{
*address |= (~bits & mask);
}
static void solidinvblock(unsigned char *address, unsigned mask, unsigned bits)
{
*address = (*address & ~mask) | (~bits & mask);
}
lcd_blockfunc_type* blockfunc[8] = {
flipblock, bgblock, fgblock, solidblock,
flipinvblock, bginvblock, fginvblock, solidinvblock
};
/*** drawing functions ***/
@ -452,7 +477,7 @@ void lcd_hline(int x1, int x2, int y)
{
int x;
unsigned char *dst;
unsigned char mask, bits;
unsigned mask;
lcd_blockfunc_type *bfunc;
/* direction flip */
@ -473,13 +498,12 @@ void lcd_hline(int x1, int x2, int y)
if (x2 >= LCD_WIDTH)
x2 = LCD_WIDTH-1;
bfunc = blockfunc[drawmode & ~DRMODE_INVERSEVID];
bits = (drawmode & DRMODE_INVERSEVID) ? 0x00 : 0xFFu;
dst = &lcd_framebuffer[y/8][x1];
bfunc = blockfunc[drawmode];
dst = &lcd_framebuffer[y>>3][x1];
mask = 1 << (y & 7);
for (x = x1; x <= x2; x++)
bfunc(dst++, mask, bits);
bfunc(dst++, mask, 0xFFu);
}
/* Draw a vertical line (optimised) */
@ -487,7 +511,7 @@ void lcd_vline(int x, int y1, int y2)
{
int ny;
unsigned char *dst;
unsigned char mask_top, mask_bottom, bits;
unsigned mask, mask_bottom;
lcd_blockfunc_type *bfunc;
/* direction flip */
@ -508,28 +532,20 @@ void lcd_vline(int x, int y1, int y2)
if (y2 >= LCD_HEIGHT)
y2 = LCD_HEIGHT-1;
bfunc = blockfunc[drawmode & ~DRMODE_INVERSEVID];
bits = (drawmode & DRMODE_INVERSEVID) ? 0x00 : 0xFFu;
dst = &lcd_framebuffer[y1/8][x];
bfunc = blockfunc[drawmode];
dst = &lcd_framebuffer[y1>>3][x];
ny = y2 - (y1 & ~7);
mask_top = 0xFFu << (y1 & 7);
mask = 0xFFu << (y1 & 7);
mask_bottom = 0xFFu >> (7 - (ny & 7));
if (ny >= 8)
for (; ny >= 8; ny -= 8)
{
bfunc(dst, mask_top, bits);
bfunc(dst, mask, 0xFFu);
dst += LCD_WIDTH;
for (; ny > 15; ny -= 8)
{
bfunc(dst, 0xFFu, bits);
dst += LCD_WIDTH;
}
mask = 0xFFu;
}
else
mask_bottom &= mask_top;
bfunc(dst, mask_bottom, bits);
mask_bottom &= mask;
bfunc(dst, mask_bottom, 0xFFu);
}
/* Draw a rectangular box */
@ -547,29 +563,19 @@ void lcd_drawrect(int x, int y, int width, int height)
lcd_hline(x, x2, y2);
}
/* helper function for lcd_fillrect() */
static void fillrow(lcd_blockfunc_type *bfunc, unsigned char *address,
int width, unsigned mask, unsigned bits)
{
int i;
for (i = 0; i < width; i++)
bfunc(address++, mask, bits);
}
/* Fill a rectangular area */
void lcd_fillrect(int x, int y, int width, int height)
{
int ny;
int ny, i;
unsigned char *dst;
unsigned char mask_top, mask_bottom, bits;
unsigned mask, mask_bottom;
unsigned bits = 0xFFu;
lcd_blockfunc_type *bfunc;
bool fillopt = (drawmode & DRMODE_INVERSEVID) ?
(drawmode & DRMODE_BG) : (drawmode & DRMODE_FG);
bool fillopt;
/* nothing to draw? */
if ((width <= 0) || (height <= 0) || (x >= LCD_WIDTH) || (y >= LCD_HEIGHT)
|| (x + width < 0) || (y + height < 0))
|| (x + width <= 0) || (y + height <= 0))
return;
/* clipping */
@ -587,38 +593,41 @@ void lcd_fillrect(int x, int y, int width, int height)
width = LCD_WIDTH - x;
if (y + height > LCD_HEIGHT)
height = LCD_HEIGHT - y;
bfunc = blockfunc[drawmode & ~DRMODE_INVERSEVID];
bits = (drawmode & DRMODE_INVERSEVID) ? 0x00 : 0xFFu;
dst = &lcd_framebuffer[y/8][x];
fillopt = (drawmode & DRMODE_INVERSEVID) ?
(drawmode & DRMODE_BG) : (drawmode & DRMODE_FG);
if (fillopt &&(drawmode & DRMODE_INVERSEVID))
bits = 0;
bfunc = blockfunc[drawmode];
dst = &lcd_framebuffer[y>>3][x];
ny = height - 1 + (y & 7);
mask_top = 0xFFu << (y & 7);
mask = 0xFFu << (y & 7);
mask_bottom = 0xFFu >> (7 - (ny & 7));
if (ny >= 8)
for (; ny >= 8; ny -= 8)
{
if (fillopt && mask_top == 0xFF)
if (fillopt && (mask == 0xFFu))
memset(dst, bits, width);
else
fillrow(bfunc, dst, width, mask_top, bits);
dst += LCD_WIDTH;
for (; ny > 15; ny -= 8)
{
if (fillopt)
memset(dst, bits, width);
else
fillrow(bfunc, dst, width, 0xFFu, bits);
dst += LCD_WIDTH;
unsigned char *dst_row = dst;
for (i = width; i > 0; i--)
bfunc(dst_row++, mask, 0xFFu);
}
dst += LCD_WIDTH;
mask = 0xFFu;
}
else
mask_bottom &= mask_top;
if (fillopt && mask_bottom == 0xFF)
mask_bottom &= mask;
if (fillopt && (mask_bottom == 0xFFu))
memset(dst, bits, width);
else
fillrow(bfunc, dst, width, mask_bottom, bits);
{
for (i = width; i > 0; i--)
bfunc(dst++, mask_bottom, 0xFFu);
}
}
/* About Rockbox' internal bitmap format:
@ -632,95 +641,120 @@ void lcd_fillrect(int x, int y, int width, int height)
*
* This is the same as the internal lcd hw format. */
/* Draw a bitmap at (x, y), size (nx, ny)
if 'clear' is true, clear destination area first */
void lcd_bitmap(const unsigned char *src, int x, int y, int nx, int ny,
bool clear) __attribute__ ((section (".icode")));
void lcd_bitmap(const unsigned char *src, int x, int y, int nx, int ny,
bool clear)
/* Draw a partial bitmap */
void lcd_bitmap_part(const unsigned char *src, int src_x, int src_y,
int stride, int x, int y, int width, int height)
__attribute__ ((section(".icode")));
void lcd_bitmap_part(const unsigned char *src, int src_x, int src_y,
int stride, int x, int y, int width, int height)
{
const unsigned char *src_col;
unsigned char *dst, *dst_col;
unsigned int data, mask1, mask2, mask3, mask4;
int stride, shift;
int shift, ny, i;
unsigned char *dst;
unsigned mask, mask_bottom;
lcd_blockfunc_type *bfunc;
if (((unsigned) x >= LCD_WIDTH) || ((unsigned) y >= LCD_HEIGHT))
/* nothing to draw? */
if ((width <= 0) || (height <= 0) || (x >= LCD_WIDTH) || (y >= LCD_HEIGHT)
|| (x + width <= 0) || (y + height <= 0))
return;
stride = nx; /* otherwise right-clipping will destroy the image */
if (((unsigned) (x + nx)) >= LCD_WIDTH)
nx = LCD_WIDTH - x;
if (((unsigned) (y + ny)) >= LCD_HEIGHT)
ny = LCD_HEIGHT - y;
dst = &lcd_framebuffer[y >> 3][x];
shift = y & 7;
if (!shift && clear) /* shortcut for byte aligned match with clear */
/* clipping */
if (x < 0)
{
while (ny >= 8) /* all full rows */
width += x;
src_x -= x;
x = 0;
}
if (y < 0)
{
height += y;
src_y -= y;
y = 0;
}
if (x + width > LCD_WIDTH)
width = LCD_WIDTH - x;
if (y + height > LCD_HEIGHT)
height = LCD_HEIGHT - y;
src += stride * (src_y >> 3) + src_x; /* move starting point */
src_y &= 7;
y -= src_y;
dst = &lcd_framebuffer[y>>3][x];
shift = y & 7;
ny = height - 1 + shift + src_y;
bfunc = blockfunc[drawmode];
mask = 0xFFu << (shift + src_y);
mask_bottom = 0xFFu >> (7 - (ny & 7));
if (shift == 0)
{
bool copyopt = (drawmode == DRMODE_SOLID);
for (; ny >= 8; ny -= 8)
{
memcpy(dst, src, nx);
if (copyopt && (mask == 0xFFu))
memcpy(dst, src, width);
else
{
const unsigned char *src_row = src;
unsigned char *dst_row = dst;
for (i = width; i > 0; i--)
bfunc(dst_row++, mask, *src_row++);
}
src += stride;
dst += LCD_WIDTH;
ny -= 8;
mask = 0xFFu;
}
if (ny == 0) /* nothing left to do? */
return;
/* last partial row to do by default routine */
}
mask_bottom &= mask;
ny += shift;
/* Calculate bit masks */
mask4 = ~(0xfe << ((ny-1) & 7)); /* data mask for last partial row */
if (clear)
{
mask1 = ~(0xff << shift); /* clearing of first partial row */
mask2 = 0; /* clearing of intermediate (full) rows */
mask3 = ~mask4; /* clearing of last partial row */
if (ny <= 8)
mask3 |= mask1;
if (copyopt && (mask_bottom == 0xFFu))
memcpy(dst, src, width);
else
{
for (i = width; i > 0; i--)
bfunc(dst++, mask_bottom, *src++);
}
}
else
mask1 = mask2 = mask3 = 0xff;
/* Loop for each column */
for (x = 0; x < nx; x++)
{
src_col = src++;
dst_col = dst++;
data = 0;
y = 0;
if (ny > 8)
for (x = 0; x < width; x++)
{
/* First partial row */
data = *src_col << shift;
*dst_col = (*dst_col & mask1) | data;
src_col += stride;
dst_col += LCD_WIDTH;
data >>= 8;
/* Intermediate rows */
for (y = 8; y < ny-8; y += 8)
const unsigned char *src_col = src++;
unsigned char *dst_col = dst++;
unsigned mask_col = mask;
unsigned data = 0;
for (y = ny; y >= 8; y -= 8)
{
data |= *src_col << shift;
*dst_col = (*dst_col & mask2) | data;
if (mask_col & 0xFFu)
{
bfunc(dst_col, mask_col, data);
mask_col = 0xFFu;
}
else
mask_col >>= 8;
src_col += stride;
dst_col += LCD_WIDTH;
data >>= 8;
}
}
/* Last partial row */
if (y + shift < ny)
data |= *src_col << shift;
*dst_col = (*dst_col & mask3) | (data & mask4);
bfunc(dst_col, mask_col & mask_bottom, data);
}
}
}
/* Draw a full bitmap */
void lcd_bitmap(const unsigned char *src, int x, int y, int width, int height)
{
lcd_bitmap_part(src, 0, 0, width, x, y, width, height);
}
/* put a string at a given pixel position, skipping first ofs pixel columns */
static void lcd_putsxyofs(int x, int y, int ofs, const unsigned char *str)
{
@ -729,7 +763,8 @@ static void lcd_putsxyofs(int x, int y, int ofs, const unsigned char *str)
while ((ch = *str++) != '\0' && x < LCD_WIDTH)
{
int gwidth, width;
int width;
const unsigned char *bits;
/* check input range */
if (ch < pf->firstchar || ch >= pf->firstchar+pf->size)
@ -737,40 +772,20 @@ static void lcd_putsxyofs(int x, int y, int ofs, const unsigned char *str)
ch -= pf->firstchar;
/* get proportional width and glyph bits */
gwidth = pf->width ? pf->width[ch] : pf->maxwidth;
width = MIN (gwidth, LCD_WIDTH - x);
width = pf->width ? pf->width[ch] : pf->maxwidth;
if (ofs != 0)
if (ofs > width)
{
if (ofs > width)
{
ofs -= width;
continue;
}
width -= ofs;
ofs -= width;
continue;
}
bits = pf->bits + (pf->offset ?
pf->offset[ch] : ((pf->height + 7) / 8 * pf->maxwidth * ch));
if (width > 0)
{
unsigned int i;
const unsigned char* bits = pf->bits +
(pf->offset ? pf->offset[ch]
: ((pf->height + 7) / 8 * pf->maxwidth * ch));
if (ofs != 0)
{
for (i = 0; i < pf->height; i += 8)
{
lcd_bitmap (bits + ofs, x, y + i, width,
MIN(8, pf->height - i), true);
bits += gwidth;
}
}
else
lcd_bitmap ((unsigned char*) bits, x, y, gwidth,
pf->height, true);
x += width;
}
lcd_bitmap_part(bits, ofs, 0, width, x, y, width - ofs, pf->height);
x += width - ofs;
ofs = 0;
}
}

View File

@ -265,20 +265,20 @@ void lcd_init(void)
/*** Update functions ***/
/* Performance function that works with an external buffer
note that y and height are in 8-pixel units! */
void lcd_blit(const unsigned char* p_data, int x, int y, int width,
int height, int stride)
note that by and bheight are in 8-pixel units! */
void lcd_blit(const unsigned char* data, int x, int by, int width,
int bheight, int stride)
{
/* Copy display bitmap to hardware */
while (height--)
while (bheight--)
{
lcd_write_command (LCD_CNTL_PAGE | (y++ & 0xf));
lcd_write_command (LCD_CNTL_PAGE | (by++ & 0xf));
lcd_write_command (LCD_CNTL_HIGHCOL | (((x+xoffset)>>4) & 0xf));
lcd_write_command (LCD_CNTL_LOWCOL | ((x+xoffset) & 0xf));
lcd_write_data(p_data, width);
p_data += stride;
}
lcd_write_data(data, width);
data += stride;
}
}
@ -302,29 +302,31 @@ void lcd_update(void)
/* Update a fraction of the display. */
void lcd_update_rect(int, int, int, int) __attribute__ ((section (".icode")));
void lcd_update_rect(int x_start, int y, int width, int height)
void lcd_update_rect(int x, int y, int width, int height)
{
int ymax;
/* The Y coordinates have to work on even 8 pixel rows */
ymax = (y + height-1)/8;
y /= 8;
ymax = (y + height-1) >> 3;
y >>= 3;
if(x_start + width > LCD_WIDTH)
width = LCD_WIDTH - x_start;
if(x + width > LCD_WIDTH)
width = LCD_WIDTH - x;
if (width <= 0)
return; /* nothing left to do, 0 is harmful to lcd_write_data() */
if(ymax >= LCD_HEIGHT/8)
ymax = LCD_HEIGHT/8-1;
x += xoffset;
/* Copy specified rectange bitmap to hardware */
for (; y <= ymax; y++)
{
lcd_write_command (LCD_CNTL_PAGE | (y & 0xf));
lcd_write_command (LCD_CNTL_HIGHCOL | (((x_start+xoffset)>>4) & 0xf));
lcd_write_command (LCD_CNTL_LOWCOL | ((x_start+xoffset) & 0xf));
lcd_write_command (LCD_CNTL_HIGHCOL | ((x >> 4) & 0xf));
lcd_write_command (LCD_CNTL_LOWCOL | (x & 0xf));
lcd_write_data (&lcd_framebuffer[y][x_start], width);
lcd_write_data (&lcd_framebuffer[y][x], width);
}
}
#endif /* !SIMULATOR */
@ -390,8 +392,10 @@ static void nopixel(int x, int y)
(void)y;
}
lcd_pixelfunc_type* pixelfunc[8] = {flippixel, nopixel, setpixel, setpixel,
nopixel, clearpixel, nopixel, clearpixel};
lcd_pixelfunc_type* pixelfunc[8] = {
flippixel, nopixel, setpixel, setpixel,
nopixel, clearpixel, nopixel, clearpixel
};
static void flipblock(unsigned char *address, unsigned mask, unsigned bits)
{
@ -413,7 +417,30 @@ static void solidblock(unsigned char *address, unsigned mask, unsigned bits)
*address = (*address & ~mask) | (bits & mask);
}
lcd_blockfunc_type* blockfunc[4] = {flipblock, bgblock, fgblock, solidblock};
static void flipinvblock(unsigned char *address, unsigned mask, unsigned bits)
{
*address ^= (~bits & mask);
}
static void bginvblock(unsigned char *address, unsigned mask, unsigned bits)
{
*address &= ~(bits & mask);
}
static void fginvblock(unsigned char *address, unsigned mask, unsigned bits)
{
*address |= (~bits & mask);
}
static void solidinvblock(unsigned char *address, unsigned mask, unsigned bits)
{
*address = (*address & ~mask) | (~bits & mask);
}
lcd_blockfunc_type* blockfunc[8] = {
flipblock, bgblock, fgblock, solidblock,
flipinvblock, bginvblock, fginvblock, solidinvblock
};
/*** drawing functions ***/
@ -509,7 +536,7 @@ void lcd_hline(int x1, int x2, int y)
{
int x;
unsigned char *dst;
unsigned char mask, bits;
unsigned mask;
lcd_blockfunc_type *bfunc;
/* direction flip */
@ -530,13 +557,12 @@ void lcd_hline(int x1, int x2, int y)
if (x2 >= LCD_WIDTH)
x2 = LCD_WIDTH-1;
bfunc = blockfunc[drawmode & ~DRMODE_INVERSEVID];
bits = (drawmode & DRMODE_INVERSEVID) ? 0x00 : 0xFFu;
dst = &lcd_framebuffer[y/8][x1];
bfunc = blockfunc[drawmode];
dst = &lcd_framebuffer[y>>3][x1];
mask = 1 << (y & 7);
for (x = x1; x <= x2; x++)
bfunc(dst++, mask, bits);
bfunc(dst++, mask, 0xFFu);
}
/* Draw a vertical line (optimised) */
@ -544,7 +570,7 @@ void lcd_vline(int x, int y1, int y2)
{
int ny;
unsigned char *dst;
unsigned char mask_top, mask_bottom, bits;
unsigned mask, mask_bottom;
lcd_blockfunc_type *bfunc;
/* direction flip */
@ -565,28 +591,20 @@ void lcd_vline(int x, int y1, int y2)
if (y2 >= LCD_HEIGHT)
y2 = LCD_HEIGHT-1;
bfunc = blockfunc[drawmode & ~DRMODE_INVERSEVID];
bits = (drawmode & DRMODE_INVERSEVID) ? 0x00 : 0xFFu;
dst = &lcd_framebuffer[y1/8][x];
bfunc = blockfunc[drawmode];
dst = &lcd_framebuffer[y1>>3][x];
ny = y2 - (y1 & ~7);
mask_top = 0xFFu << (y1 & 7);
mask = 0xFFu << (y1 & 7);
mask_bottom = 0xFFu >> (7 - (ny & 7));
if (ny >= 8)
for (; ny >= 8; ny -= 8)
{
bfunc(dst, mask_top, bits);
bfunc(dst, mask, 0xFFu);
dst += LCD_WIDTH;
for (; ny > 15; ny -= 8)
{
bfunc(dst, 0xFFu, bits);
dst += LCD_WIDTH;
}
mask = 0xFFu;
}
else
mask_bottom &= mask_top;
bfunc(dst, mask_bottom, bits);
mask_bottom &= mask;
bfunc(dst, mask_bottom, 0xFFu);
}
/* Draw a rectangular box */
@ -604,29 +622,19 @@ void lcd_drawrect(int x, int y, int width, int height)
lcd_hline(x, x2, y2);
}
/* helper function for lcd_fillrect() */
static void fillrow(lcd_blockfunc_type *bfunc, unsigned char *address,
int width, unsigned mask, unsigned bits)
{
int i;
for (i = 0; i < width; i++)
bfunc(address++, mask, bits);
}
/* Fill a rectangular area */
void lcd_fillrect(int x, int y, int width, int height)
{
int ny;
int ny, i;
unsigned char *dst;
unsigned char mask_top, mask_bottom, bits;
unsigned mask, mask_bottom;
unsigned bits = 0xFFu;
lcd_blockfunc_type *bfunc;
bool fillopt = (drawmode & DRMODE_INVERSEVID) ?
(drawmode & DRMODE_BG) : (drawmode & DRMODE_FG);
bool fillopt;
/* nothing to draw? */
if ((width <= 0) || (height <= 0) || (x >= LCD_WIDTH) || (y >= LCD_HEIGHT)
|| (x + width < 0) || (y + height < 0))
|| (x + width <= 0) || (y + height <= 0))
return;
/* clipping */
@ -644,38 +652,41 @@ void lcd_fillrect(int x, int y, int width, int height)
width = LCD_WIDTH - x;
if (y + height > LCD_HEIGHT)
height = LCD_HEIGHT - y;
bfunc = blockfunc[drawmode & ~DRMODE_INVERSEVID];
bits = (drawmode & DRMODE_INVERSEVID) ? 0x00 : 0xFFu;
dst = &lcd_framebuffer[y/8][x];
fillopt = (drawmode & DRMODE_INVERSEVID) ?
(drawmode & DRMODE_BG) : (drawmode & DRMODE_FG);
if (fillopt &&(drawmode & DRMODE_INVERSEVID))
bits = 0;
bfunc = blockfunc[drawmode];
dst = &lcd_framebuffer[y>>3][x];
ny = height - 1 + (y & 7);
mask_top = 0xFFu << (y & 7);
mask = 0xFFu << (y & 7);
mask_bottom = 0xFFu >> (7 - (ny & 7));
if (ny >= 8)
for (; ny >= 8; ny -= 8)
{
if (fillopt && mask_top == 0xFF)
if (fillopt && (mask == 0xFFu))
memset(dst, bits, width);
else
fillrow(bfunc, dst, width, mask_top, bits);
dst += LCD_WIDTH;
for (; ny > 15; ny -= 8)
{
if (fillopt)
memset(dst, bits, width);
else
fillrow(bfunc, dst, width, 0xFFu, bits);
dst += LCD_WIDTH;
unsigned char *dst_row = dst;
for (i = width; i > 0; i--)
bfunc(dst_row++, mask, 0xFFu);
}
dst += LCD_WIDTH;
mask = 0xFFu;
}
else
mask_bottom &= mask_top;
if (fillopt && mask_bottom == 0xFF)
mask_bottom &= mask;
if (fillopt && (mask_bottom == 0xFFu))
memset(dst, bits, width);
else
fillrow(bfunc, dst, width, mask_bottom, bits);
{
for (i = width; i > 0; i--)
bfunc(dst++, mask_bottom, 0xFFu);
}
}
/* About Rockbox' internal bitmap format:
@ -689,95 +700,120 @@ void lcd_fillrect(int x, int y, int width, int height)
*
* This is the same as the internal lcd hw format. */
/* Draw a bitmap at (x, y), size (nx, ny)
if 'clear' is true, clear destination area first */
void lcd_bitmap(const unsigned char *src, int x, int y, int nx, int ny,
bool clear) __attribute__ ((section (".icode")));
void lcd_bitmap(const unsigned char *src, int x, int y, int nx, int ny,
bool clear)
/* Draw a partial bitmap */
void lcd_bitmap_part(const unsigned char *src, int src_x, int src_y,
int stride, int x, int y, int width, int height)
__attribute__ ((section(".icode")));
void lcd_bitmap_part(const unsigned char *src, int src_x, int src_y,
int stride, int x, int y, int width, int height)
{
const unsigned char *src_col;
unsigned char *dst, *dst_col;
unsigned int data, mask1, mask2, mask3, mask4;
int stride, shift;
int shift, ny, i;
unsigned char *dst;
unsigned mask, mask_bottom;
lcd_blockfunc_type *bfunc;
if (((unsigned) x >= LCD_WIDTH) || ((unsigned) y >= LCD_HEIGHT))
/* nothing to draw? */
if ((width <= 0) || (height <= 0) || (x >= LCD_WIDTH) || (y >= LCD_HEIGHT)
|| (x + width <= 0) || (y + height <= 0))
return;
stride = nx; /* otherwise right-clipping will destroy the image */
if (((unsigned) (x + nx)) >= LCD_WIDTH)
nx = LCD_WIDTH - x;
if (((unsigned) (y + ny)) >= LCD_HEIGHT)
ny = LCD_HEIGHT - y;
dst = &lcd_framebuffer[y >> 3][x];
shift = y & 7;
if (!shift && clear) /* shortcut for byte aligned match with clear */
/* clipping */
if (x < 0)
{
while (ny >= 8) /* all full rows */
width += x;
src_x -= x;
x = 0;
}
if (y < 0)
{
height += y;
src_y -= y;
y = 0;
}
if (x + width > LCD_WIDTH)
width = LCD_WIDTH - x;
if (y + height > LCD_HEIGHT)
height = LCD_HEIGHT - y;
src += stride * (src_y >> 3) + src_x; /* move starting point */
src_y &= 7;
y -= src_y;
dst = &lcd_framebuffer[y>>3][x];
shift = y & 7;
ny = height - 1 + shift + src_y;
bfunc = blockfunc[drawmode];
mask = 0xFFu << (shift + src_y);
mask_bottom = 0xFFu >> (7 - (ny & 7));
if (shift == 0)
{
bool copyopt = (drawmode == DRMODE_SOLID);
for (; ny >= 8; ny -= 8)
{
memcpy(dst, src, nx);
if (copyopt && (mask == 0xFFu))
memcpy(dst, src, width);
else
{
const unsigned char *src_row = src;
unsigned char *dst_row = dst;
for (i = width; i > 0; i--)
bfunc(dst_row++, mask, *src_row++);
}
src += stride;
dst += LCD_WIDTH;
ny -= 8;
mask = 0xFFu;
}
if (ny == 0) /* nothing left to do? */
return;
/* last partial row to do by default routine */
}
mask_bottom &= mask;
ny += shift;
/* Calculate bit masks */
mask4 = ~(0xfe << ((ny-1) & 7)); /* data mask for last partial row */
if (clear)
{
mask1 = ~(0xff << shift); /* clearing of first partial row */
mask2 = 0; /* clearing of intermediate (full) rows */
mask3 = ~mask4; /* clearing of last partial row */
if (ny <= 8)
mask3 |= mask1;
if (copyopt && (mask_bottom == 0xFFu))
memcpy(dst, src, width);
else
{
for (i = width; i > 0; i--)
bfunc(dst++, mask_bottom, *src++);
}
}
else
mask1 = mask2 = mask3 = 0xff;
/* Loop for each column */
for (x = 0; x < nx; x++)
{
src_col = src++;
dst_col = dst++;
data = 0;
y = 0;
if (ny > 8)
for (x = 0; x < width; x++)
{
/* First partial row */
data = *src_col << shift;
*dst_col = (*dst_col & mask1) | data;
src_col += stride;
dst_col += LCD_WIDTH;
data >>= 8;
/* Intermediate rows */
for (y = 8; y < ny-8; y += 8)
const unsigned char *src_col = src++;
unsigned char *dst_col = dst++;
unsigned mask_col = mask;
unsigned data = 0;
for (y = ny; y >= 8; y -= 8)
{
data |= *src_col << shift;
*dst_col = (*dst_col & mask2) | data;
if (mask_col & 0xFFu)
{
bfunc(dst_col, mask_col, data);
mask_col = 0xFFu;
}
else
mask_col >>= 8;
src_col += stride;
dst_col += LCD_WIDTH;
data >>= 8;
}
}
/* Last partial row */
if (y + shift < ny)
data |= *src_col << shift;
*dst_col = (*dst_col & mask3) | (data & mask4);
bfunc(dst_col, mask_col & mask_bottom, data);
}
}
}
/* Draw a full bitmap */
void lcd_bitmap(const unsigned char *src, int x, int y, int width, int height)
{
lcd_bitmap_part(src, 0, 0, width, x, y, width, height);
}
/* put a string at a given pixel position, skipping first ofs pixel columns */
static void lcd_putsxyofs(int x, int y, int ofs, const unsigned char *str)
{
@ -786,7 +822,8 @@ static void lcd_putsxyofs(int x, int y, int ofs, const unsigned char *str)
while ((ch = *str++) != '\0' && x < LCD_WIDTH)
{
int gwidth, width;
int width;
const unsigned char *bits;
/* check input range */
if (ch < pf->firstchar || ch >= pf->firstchar+pf->size)
@ -794,44 +831,23 @@ static void lcd_putsxyofs(int x, int y, int ofs, const unsigned char *str)
ch -= pf->firstchar;
/* get proportional width and glyph bits */
gwidth = pf->width ? pf->width[ch] : pf->maxwidth;
width = MIN (gwidth, LCD_WIDTH - x);
width = pf->width ? pf->width[ch] : pf->maxwidth;
if (ofs != 0)
if (ofs > width)
{
if (ofs > width)
{
ofs -= width;
continue;
}
width -= ofs;
ofs -= width;
continue;
}
if (width > 0)
{
unsigned int i;
const unsigned char* bits = pf->bits +
(pf->offset ? pf->offset[ch]
: ((pf->height + 7) / 8 * pf->maxwidth * ch));
bits = pf->bits + (pf->offset ?
pf->offset[ch] : ((pf->height + 7) / 8 * pf->maxwidth * ch));
if (ofs != 0)
{
for (i = 0; i < pf->height; i += 8)
{
lcd_bitmap (bits + ofs, x, y + i, width,
MIN(8, pf->height - i), true);
bits += gwidth;
}
}
else
lcd_bitmap ((unsigned char*) bits, x, y, gwidth,
pf->height, true);
x += width;
}
lcd_bitmap_part(bits, ofs, 0, width, x, y, width - ofs, pf->height);
x += width - ofs;
ofs = 0;
}
}
/* put a string at a given pixel position */
void lcd_putsxy(int x, int y, const unsigned char *str)
{

View File

@ -57,8 +57,8 @@ extern void lcd_icon(int icon, bool enable);
#if defined(SIMULATOR) || defined(HAVE_LCD_BITMAP)
/* performance function */
extern void lcd_blit(const unsigned char* p_data, int x, int y, int width,
int height, int stride);
extern void lcd_blit(const unsigned char* data, int x, int by, int width,
int bheight, int stride);
extern void lcd_update(void);
/* update a fraction of the screen */
@ -150,8 +150,9 @@ extern void lcd_hline(int x1, int x2, int y);
extern void lcd_vline(int x, int y1, int y2);
extern void lcd_drawrect(int x, int y, int width, int height);
extern void lcd_fillrect(int x, int y, int width, int height);
extern void lcd_bitmap(const unsigned char *src, int x, int y, int nx, int ny,
bool clear);
extern void lcd_bitmap_part(const unsigned char *src, int src_x, int src_y,
int stride, int x, int y, int width, int height);
extern void lcd_bitmap(const unsigned char *src, int x, int y, int nx, int ny);
extern void lcd_putsxy(int x, int y, const unsigned char *string);
extern void lcd_invertscroll(int x, int y);