summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--firmware/drivers/lcd.c50
-rw-r--r--firmware/drivers/lcd.h1
2 files changed, 39 insertions, 12 deletions
diff --git a/firmware/drivers/lcd.c b/firmware/drivers/lcd.c
index 1984f66617..4bdecd41f5 100644
--- a/firmware/drivers/lcd.c
+++ b/firmware/drivers/lcd.c
@@ -1027,11 +1027,29 @@ void lcd_bitmap (unsigned char *src, int x, int y, int nx, int ny,
1027 */ 1027 */
1028void lcd_drawrect (int x, int y, int nx, int ny) 1028void lcd_drawrect (int x, int y, int nx, int ny)
1029{ 1029{
1030 lcd_drawline(x, y, nx, y); 1030 int i;
1031 lcd_drawline(x, ny, nx, ny); 1031
1032 if (x > LCD_WIDTH)
1033 return;
1034 if (y > LCD_HEIGHT)
1035 return;
1036
1037 if (x + nx > LCD_WIDTH)
1038 nx = LCD_WIDTH - x;
1039 if (y + ny > LCD_HEIGHT)
1040 ny = LCD_HEIGHT - y;
1041
1042 /* vertical lines */
1043 for (i = 0; i < ny; i++) {
1044 DRAW_PIXEL(x, (y + i));
1045 DRAW_PIXEL((x + nx - 1), (y + i));
1046 }
1032 1047
1033 lcd_drawline(x, y, x, ny); 1048 /* horizontal lines */
1034 lcd_drawline(nx, y, nx, ny); 1049 for (i = 0; i < nx; i++) {
1050 DRAW_PIXEL((x + i),y);
1051 DRAW_PIXEL((x + i),(y + ny - 1));
1052 }
1035} 1053}
1036 1054
1037/* 1055/*
@@ -1057,21 +1075,21 @@ void lcd_fillrect (int x, int y, int nx, int ny)
1057/* Invert a rectangular area at (x, y), size (nx, ny) */ 1075/* Invert a rectangular area at (x, y), size (nx, ny) */
1058void lcd_invertrect (int x, int y, int nx, int ny) 1076void lcd_invertrect (int x, int y, int nx, int ny)
1059{ 1077{
1060 int i,j; 1078 int i, j;
1061 1079
1062 if (x>LCD_WIDTH) 1080 if (x > LCD_WIDTH)
1063 return; 1081 return;
1064 if (y>LCD_HEIGHT) 1082 if (y > LCD_HEIGHT)
1065 return; 1083 return;
1066 1084
1067 if (x+nx>LCD_WIDTH) 1085 if (x + nx > LCD_WIDTH)
1068 nx=LCD_WIDTH-x; 1086 nx = LCD_WIDTH - x;
1069 if (y+ny>LCD_HEIGHT) 1087 if (y + ny > LCD_HEIGHT)
1070 ny=LCD_HEIGHT-y; 1088 ny = LCD_HEIGHT - y;
1071 1089
1072 for (i = 0; i < nx; i++) 1090 for (i = 0; i < nx; i++)
1073 for (j = 0; j < ny; j++) 1091 for (j = 0; j < ny; j++)
1074 INVERT_PIXEL((x+i),(y+j)); 1092 INVERT_PIXEL((x + i), (y + j));
1075} 1093}
1076 1094
1077void lcd_drawline( int x1, int y1, int x2, int y2 ) 1095void lcd_drawline( int x1, int y1, int x2, int y2 )
@@ -1231,6 +1249,14 @@ void lcd_clearpixel(int x, int y)
1231} 1249}
1232 1250
1233/* 1251/*
1252 * Invert a single pixel
1253 */
1254void lcd_invertpixel(int x, int y)
1255{
1256 INVERT_PIXEL(x,y);
1257}
1258
1259/*
1234 * Return width and height of a given font. 1260 * Return width and height of a given font.
1235 */ 1261 */
1236void lcd_getfontsize(unsigned int font, int *width, int *height) 1262void lcd_getfontsize(unsigned int font, int *width, int *height)
diff --git a/firmware/drivers/lcd.h b/firmware/drivers/lcd.h
index b99fa54389..1e623a7d09 100644
--- a/firmware/drivers/lcd.h
+++ b/firmware/drivers/lcd.h
@@ -113,6 +113,7 @@ extern void lcd_drawline( int x1, int y1, int x2, int y2 );
113extern void lcd_clearline( int x1, int y1, int x2, int y2 ); 113extern void lcd_clearline( int x1, int y1, int x2, int y2 );
114extern void lcd_drawpixel(int x, int y); 114extern void lcd_drawpixel(int x, int y);
115extern void lcd_clearpixel(int x, int y); 115extern void lcd_clearpixel(int x, int y);
116extern void lcd_invertpixel(int x, int y);
116 117
117#endif /* CHARCELLS / BITMAP */ 118#endif /* CHARCELLS / BITMAP */
118 119