summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJens Arnold <amiconn@rockbox.org>2006-07-28 07:17:00 +0000
committerJens Arnold <amiconn@rockbox.org>2006-07-28 07:17:00 +0000
commitcb36fec3922cb1317bdb06a6497370f188694d4e (patch)
tree5dfe6aa35f8e55485e18de4c5bdac0ed54e8d80c
parent2d4cfa8738abc42603de8f90e715433bb4345dd7 (diff)
downloadrockbox-cb36fec3922cb1317bdb06a6497370f188694d4e.tar.gz
rockbox-cb36fec3922cb1317bdb06a6497370f188694d4e.zip
LCD drivers: * Slight speedup for 2bit greyscale drivers. Use the same scrolltext drawing anywhere. * Cleanup, fixes and definitions in preparation for X5 remote.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@10346 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--firmware/drivers/lcd-16bit.c3
-rw-r--r--firmware/drivers/lcd-2bit-horz.c71
-rw-r--r--firmware/drivers/lcd-h100-remote.c70
-rw-r--r--firmware/drivers/lcd-h100.c91
-rw-r--r--firmware/export/config-h100.h2
-rw-r--r--firmware/export/config-h120.h2
-rw-r--r--firmware/export/config-h300.h2
-rw-r--r--firmware/export/lcd-remote.h109
-rw-r--r--firmware/export/lcd.h2
9 files changed, 216 insertions, 136 deletions
diff --git a/firmware/drivers/lcd-16bit.c b/firmware/drivers/lcd-16bit.c
index d237dac858..fd95f2aa16 100644
--- a/firmware/drivers/lcd-16bit.c
+++ b/firmware/drivers/lcd-16bit.c
@@ -34,7 +34,7 @@
34#include "rbunicode.h" 34#include "rbunicode.h"
35#include "bidi.h" 35#include "bidi.h"
36 36
37#define SCROLLABLE_LINES 26 37#define SCROLLABLE_LINES ((LCD_HEIGHT+4)/5 < 32 ? (LCD_HEIGHT+4)/5 : 32)
38 38
39enum fill_opt { 39enum fill_opt {
40 OPT_NONE = 0, 40 OPT_NONE = 0,
@@ -972,4 +972,3 @@ static void scroll_thread(void)
972 sleep(scroll_ticks); 972 sleep(scroll_ticks);
973 } 973 }
974} 974}
975
diff --git a/firmware/drivers/lcd-2bit-horz.c b/firmware/drivers/lcd-2bit-horz.c
index 4ee2e2ea28..68074e36e8 100644
--- a/firmware/drivers/lcd-2bit-horz.c
+++ b/firmware/drivers/lcd-2bit-horz.c
@@ -34,7 +34,7 @@
34#include "rbunicode.h" 34#include "rbunicode.h"
35#include "bidi.h" 35#include "bidi.h"
36 36
37#define SCROLLABLE_LINES 26 37#define SCROLLABLE_LINES (((LCD_HEIGHT+4)/5 < 32) ? (LCD_HEIGHT+4)/5 : 32)
38 38
39/*** globals ***/ 39/*** globals ***/
40 40
@@ -148,21 +148,28 @@ int lcd_getstringsize(const unsigned char *str, int *w, int *h)
148 148
149static void setpixel(int x, int y) 149static void setpixel(int x, int y)
150{ 150{
151 unsigned char *data = &lcd_framebuffer[y][x>>2];
152 unsigned mask = pixmask[x & 3]; 151 unsigned mask = pixmask[x & 3];
153 *data = (*data & ~mask) | (fg_pattern & mask); 152 fb_data *address = &lcd_framebuffer[y][x>>2];
153 unsigned data = *address;
154
155 *address = data ^ ((data ^ fg_pattern) & mask);
154} 156}
155 157
156static void clearpixel(int x, int y) 158static void clearpixel(int x, int y)
157{ 159{
158 unsigned char *data = &lcd_framebuffer[y][x>>2];
159 unsigned mask = pixmask[x & 3]; 160 unsigned mask = pixmask[x & 3];
160 *data = (*data & ~mask) | (bg_pattern & mask); 161 fb_data *address = &lcd_framebuffer[y][x>>2];
162 unsigned data = *address;
163
164 *address = data ^ ((data ^ bg_pattern) & mask);
161} 165}
162 166
163static void flippixel(int x, int y) 167static void flippixel(int x, int y)
164{ 168{
165 lcd_framebuffer[y][x>>2] ^= pixmask[x & 3]; 169 unsigned mask = pixmask[x & 3];
170 fb_data *address = &lcd_framebuffer[y][x>>2];
171
172 *address ^= mask;
166} 173}
167 174
168static void nopixel(int x, int y) 175static void nopixel(int x, int y)
@@ -177,34 +184,34 @@ lcd_pixelfunc_type* const lcd_pixelfuncs[8] = {
177}; 184};
178 185
179/* 'mask' and 'bits' contain 2 bits per pixel */ 186/* 'mask' and 'bits' contain 2 bits per pixel */
180static void flipblock(unsigned char *address, unsigned mask, unsigned bits) 187static void flipblock(fb_data *address, unsigned mask, unsigned bits)
181 ICODE_ATTR; 188 ICODE_ATTR;
182static void flipblock(unsigned char *address, unsigned mask, unsigned bits) 189static void flipblock(fb_data *address, unsigned mask, unsigned bits)
183{ 190{
184 *address ^= bits & mask; 191 *address ^= bits & mask;
185} 192}
186 193
187static void bgblock(unsigned char *address, unsigned mask, unsigned bits) 194static void bgblock(fb_data *address, unsigned mask, unsigned bits)
188 ICODE_ATTR; 195 ICODE_ATTR;
189static void bgblock(unsigned char *address, unsigned mask, unsigned bits) 196static void bgblock(fb_data *address, unsigned mask, unsigned bits)
190{ 197{
191 unsigned data = *address; 198 unsigned data = *address;
192 199
193 *address = data ^ ((data ^ bg_pattern) & mask & ~bits); 200 *address = data ^ ((data ^ bg_pattern) & mask & ~bits);
194} 201}
195 202
196static void fgblock(unsigned char *address, unsigned mask, unsigned bits) 203static void fgblock(fb_data *address, unsigned mask, unsigned bits)
197 ICODE_ATTR; 204 ICODE_ATTR;
198static void fgblock(unsigned char *address, unsigned mask, unsigned bits) 205static void fgblock(fb_data *address, unsigned mask, unsigned bits)
199{ 206{
200 unsigned data = *address; 207 unsigned data = *address;
201 208
202 *address = data ^ ((data ^ fg_pattern) & mask & bits); 209 *address = data ^ ((data ^ fg_pattern) & mask & bits);
203} 210}
204 211
205static void solidblock(unsigned char *address, unsigned mask, unsigned bits) 212static void solidblock(fb_data *address, unsigned mask, unsigned bits)
206 ICODE_ATTR; 213 ICODE_ATTR;
207static void solidblock(unsigned char *address, unsigned mask, unsigned bits) 214static void solidblock(fb_data *address, unsigned mask, unsigned bits)
208{ 215{
209 unsigned data = *address; 216 unsigned data = *address;
210 unsigned bgp = bg_pattern; 217 unsigned bgp = bg_pattern;
@@ -213,34 +220,34 @@ static void solidblock(unsigned char *address, unsigned mask, unsigned bits)
213 *address = data ^ ((data ^ bits) & mask); 220 *address = data ^ ((data ^ bits) & mask);
214} 221}
215 222
216static void flipinvblock(unsigned char *address, unsigned mask, unsigned bits) 223static void flipinvblock(fb_data *address, unsigned mask, unsigned bits)
217 ICODE_ATTR; 224 ICODE_ATTR;
218static void flipinvblock(unsigned char *address, unsigned mask, unsigned bits) 225static void flipinvblock(fb_data *address, unsigned mask, unsigned bits)
219{ 226{
220 *address ^= ~bits & mask; 227 *address ^= ~bits & mask;
221} 228}
222 229
223static void bginvblock(unsigned char *address, unsigned mask, unsigned bits) 230static void bginvblock(fb_data *address, unsigned mask, unsigned bits)
224 ICODE_ATTR; 231 ICODE_ATTR;
225static void bginvblock(unsigned char *address, unsigned mask, unsigned bits) 232static void bginvblock(fb_data *address, unsigned mask, unsigned bits)
226{ 233{
227 unsigned data = *address; 234 unsigned data = *address;
228 235
229 *address = data ^ ((data ^ bg_pattern) & mask & bits); 236 *address = data ^ ((data ^ bg_pattern) & mask & bits);
230} 237}
231 238
232static void fginvblock(unsigned char *address, unsigned mask, unsigned bits) 239static void fginvblock(fb_data *address, unsigned mask, unsigned bits)
233 ICODE_ATTR; 240 ICODE_ATTR;
234static void fginvblock(unsigned char *address, unsigned mask, unsigned bits) 241static void fginvblock(fb_data *address, unsigned mask, unsigned bits)
235{ 242{
236 unsigned data = *address; 243 unsigned data = *address;
237 244
238 *address = data ^ ((data ^ fg_pattern) & mask & ~bits); 245 *address = data ^ ((data ^ fg_pattern) & mask & ~bits);
239} 246}
240 247
241static void solidinvblock(unsigned char *address, unsigned mask, unsigned bits) 248static void solidinvblock(fb_data *address, unsigned mask, unsigned bits)
242 ICODE_ATTR; 249 ICODE_ATTR;
243static void solidinvblock(unsigned char *address, unsigned mask, unsigned bits) 250static void solidinvblock(fb_data *address, unsigned mask, unsigned bits)
244{ 251{
245 unsigned data = *address; 252 unsigned data = *address;
246 unsigned fgp = fg_pattern; 253 unsigned fgp = fg_pattern;
@@ -254,7 +261,7 @@ lcd_blockfunc_type* const lcd_blockfuncs[8] = {
254 flipinvblock, bginvblock, fginvblock, solidinvblock 261 flipinvblock, bginvblock, fginvblock, solidinvblock
255}; 262};
256 263
257static inline void setblock(unsigned char *address, unsigned mask, unsigned bits) 264static inline void setblock(fb_data *address, unsigned mask, unsigned bits)
258{ 265{
259 unsigned data = *address; 266 unsigned data = *address;
260 267
@@ -510,11 +517,11 @@ void lcd_fillrect(int x, int y, int width, int height)
510/* About Rockbox' internal monochrome bitmap format: 517/* About Rockbox' internal monochrome bitmap format:
511 * 518 *
512 * A bitmap contains one bit for every pixel that defines if that pixel is 519 * A bitmap contains one bit for every pixel that defines if that pixel is
513 * black (1) or white (0). Bits within a byte are arranged horizontally, LSB 520 * black (1) or white (0). Bits within a byte are arranged vertically, LSB
514 * at top. 521 * at top.
515 * The bytes are stored in row-major order, with byte 0 being top left, 522 * The bytes are stored in row-major order, with byte 0 being top left,
516 * byte 1 2nd from left etc. The first row of bytes defines pixel row 523 * byte 1 2nd from left etc. The first row of bytes defines pixel rows
517 * 0, the second row defines pixel row 1 etc. */ 524 * 0..7, the second row defines pixel row 8..15 etc. */
518 525
519/* Draw a partial monochrome bitmap */ 526/* Draw a partial monochrome bitmap */
520void lcd_mono_bitmap_part(const unsigned char *src, int src_x, int src_y, 527void lcd_mono_bitmap_part(const unsigned char *src, int src_x, int src_y,
@@ -937,15 +944,9 @@ static void scroll_thread(void)
937 } 944 }
938 945
939 lastmode = drawmode; 946 lastmode = drawmode;
940 drawmode = (DRMODE_SOLID|DRMODE_INVERSEVID); 947 drawmode = s->invert ?
941 lcd_fillrect(xpos, ypos, LCD_WIDTH - xpos, pf->height); 948 (DRMODE_SOLID|DRMODE_INVERSEVID) : DRMODE_SOLID;
942 drawmode = DRMODE_SOLID; 949 lcd_putsxyofs(xpos, ypos, s->offset, s->line);
943 lcd_putsxyofs(xpos, ypos, s->offset, (unsigned char *)s->line);
944 if (s->invert)
945 {
946 drawmode = DRMODE_COMPLEMENT;
947 lcd_fillrect(xpos, ypos, LCD_WIDTH - xpos, pf->height);
948 }
949 drawmode = lastmode; 950 drawmode = lastmode;
950 lcd_update_rect(xpos, ypos, LCD_WIDTH - xpos, pf->height); 951 lcd_update_rect(xpos, ypos, LCD_WIDTH - xpos, pf->height);
951 } 952 }
diff --git a/firmware/drivers/lcd-h100-remote.c b/firmware/drivers/lcd-h100-remote.c
index f7b3c21f48..0c71f0b168 100644
--- a/firmware/drivers/lcd-h100-remote.c
+++ b/firmware/drivers/lcd-h100-remote.c
@@ -65,8 +65,8 @@
65 65
66/*** globals ***/ 66/*** globals ***/
67 67
68unsigned char lcd_remote_framebuffer[LCD_REMOTE_HEIGHT/8][LCD_REMOTE_WIDTH] 68fb_remote_data lcd_remote_framebuffer[LCD_REMOTE_HEIGHT/8][LCD_REMOTE_WIDTH]
69 IBSS_ATTR; 69 IBSS_ATTR;
70 70
71static int drawmode = DRMODE_SOLID; 71static int drawmode = DRMODE_SOLID;
72static int xmargin = 0; 72static int xmargin = 0;
@@ -686,35 +686,35 @@ static void nopixel(int x, int y)
686 (void)y; 686 (void)y;
687} 687}
688 688
689lcd_pixelfunc_type* const lcd_remote_pixelfuncs[8] = { 689lcd_remote_pixelfunc_type* const lcd_remote_pixelfuncs[8] = {
690 flippixel, nopixel, setpixel, setpixel, 690 flippixel, nopixel, setpixel, setpixel,
691 nopixel, clearpixel, nopixel, clearpixel 691 nopixel, clearpixel, nopixel, clearpixel
692}; 692};
693 693
694static void flipblock(unsigned char *address, unsigned mask, unsigned bits) 694static void flipblock(fb_remote_data *address, unsigned mask, unsigned bits)
695 ICODE_ATTR; 695 ICODE_ATTR;
696static void flipblock(unsigned char *address, unsigned mask, unsigned bits) 696static void flipblock(fb_remote_data *address, unsigned mask, unsigned bits)
697{ 697{
698 *address ^= bits & mask; 698 *address ^= bits & mask;
699} 699}
700 700
701static void bgblock(unsigned char *address, unsigned mask, unsigned bits) 701static void bgblock(fb_remote_data *address, unsigned mask, unsigned bits)
702 ICODE_ATTR; 702 ICODE_ATTR;
703static void bgblock(unsigned char *address, unsigned mask, unsigned bits) 703static void bgblock(fb_remote_data *address, unsigned mask, unsigned bits)
704{ 704{
705 *address &= bits | ~mask; 705 *address &= bits | ~mask;
706} 706}
707 707
708static void fgblock(unsigned char *address, unsigned mask, unsigned bits) 708static void fgblock(fb_remote_data *address, unsigned mask, unsigned bits)
709 ICODE_ATTR; 709 ICODE_ATTR;
710static void fgblock(unsigned char *address, unsigned mask, unsigned bits) 710static void fgblock(fb_remote_data *address, unsigned mask, unsigned bits)
711{ 711{
712 *address |= bits & mask; 712 *address |= bits & mask;
713} 713}
714 714
715static void solidblock(unsigned char *address, unsigned mask, unsigned bits) 715static void solidblock(fb_remote_data *address, unsigned mask, unsigned bits)
716 ICODE_ATTR; 716 ICODE_ATTR;
717static void solidblock(unsigned char *address, unsigned mask, unsigned bits) 717static void solidblock(fb_remote_data *address, unsigned mask, unsigned bits)
718{ 718{
719 unsigned data = *address; 719 unsigned data = *address;
720 720
@@ -722,30 +722,30 @@ static void solidblock(unsigned char *address, unsigned mask, unsigned bits)
722 *address = data ^ (bits & mask); 722 *address = data ^ (bits & mask);
723} 723}
724 724
725static void flipinvblock(unsigned char *address, unsigned mask, unsigned bits) 725static void flipinvblock(fb_remote_data *address, unsigned mask, unsigned bits)
726 ICODE_ATTR; 726 ICODE_ATTR;
727static void flipinvblock(unsigned char *address, unsigned mask, unsigned bits) 727static void flipinvblock(fb_remote_data *address, unsigned mask, unsigned bits)
728{ 728{
729 *address ^= ~bits & mask; 729 *address ^= ~bits & mask;
730} 730}
731 731
732static void bginvblock(unsigned char *address, unsigned mask, unsigned bits) 732static void bginvblock(fb_remote_data *address, unsigned mask, unsigned bits)
733 ICODE_ATTR; 733 ICODE_ATTR;
734static void bginvblock(unsigned char *address, unsigned mask, unsigned bits) 734static void bginvblock(fb_remote_data *address, unsigned mask, unsigned bits)
735{ 735{
736 *address &= ~(bits & mask); 736 *address &= ~(bits & mask);
737} 737}
738 738
739static void fginvblock(unsigned char *address, unsigned mask, unsigned bits) 739static void fginvblock(fb_remote_data *address, unsigned mask, unsigned bits)
740 ICODE_ATTR; 740 ICODE_ATTR;
741static void fginvblock(unsigned char *address, unsigned mask, unsigned bits) 741static void fginvblock(fb_remote_data *address, unsigned mask, unsigned bits)
742{ 742{
743 *address |= ~bits & mask; 743 *address |= ~bits & mask;
744} 744}
745 745
746static void solidinvblock(unsigned char *address, unsigned mask, unsigned bits) 746static void solidinvblock(fb_remote_data *address, unsigned mask, unsigned bits)
747 ICODE_ATTR; 747 ICODE_ATTR;
748static void solidinvblock(unsigned char *address, unsigned mask, unsigned bits) 748static void solidinvblock(fb_remote_data *address, unsigned mask, unsigned bits)
749{ 749{
750 unsigned data = *address; 750 unsigned data = *address;
751 751
@@ -753,7 +753,7 @@ static void solidinvblock(unsigned char *address, unsigned mask, unsigned bits)
753 *address = data ^ (bits & mask); 753 *address = data ^ (bits & mask);
754} 754}
755 755
756lcd_blockfunc_type* const lcd_remote_blockfuncs[8] = { 756lcd_remote_blockfunc_type* const lcd_remote_blockfuncs[8] = {
757 flipblock, bgblock, fgblock, solidblock, 757 flipblock, bgblock, fgblock, solidblock,
758 flipinvblock, bginvblock, fginvblock, solidinvblock 758 flipinvblock, bginvblock, fginvblock, solidinvblock
759}; 759};
@@ -785,7 +785,7 @@ void lcd_remote_drawline(int x1, int y1, int x2, int y2)
785 int d, dinc1, dinc2; 785 int d, dinc1, dinc2;
786 int x, xinc1, xinc2; 786 int x, xinc1, xinc2;
787 int y, yinc1, yinc2; 787 int y, yinc1, yinc2;
788 lcd_pixelfunc_type *pfunc = lcd_remote_pixelfuncs[drawmode]; 788 lcd_remote_pixelfunc_type *pfunc = lcd_remote_pixelfuncs[drawmode];
789 789
790 deltax = abs(x2 - x1); 790 deltax = abs(x2 - x1);
791 deltay = abs(y2 - y1); 791 deltay = abs(y2 - y1);
@@ -851,9 +851,9 @@ void lcd_remote_drawline(int x1, int y1, int x2, int y2)
851void lcd_remote_hline(int x1, int x2, int y) 851void lcd_remote_hline(int x1, int x2, int y)
852{ 852{
853 int x; 853 int x;
854 unsigned char *dst, *dst_end; 854 fb_remote_data *dst, *dst_end;
855 unsigned mask; 855 unsigned mask;
856 lcd_blockfunc_type *bfunc; 856 lcd_remote_blockfunc_type *bfunc;
857 857
858 /* direction flip */ 858 /* direction flip */
859 if (x2 < x1) 859 if (x2 < x1)
@@ -888,9 +888,9 @@ void lcd_remote_hline(int x1, int x2, int y)
888void lcd_remote_vline(int x, int y1, int y2) 888void lcd_remote_vline(int x, int y1, int y2)
889{ 889{
890 int ny; 890 int ny;
891 unsigned char *dst; 891 fb_remote_data *dst;
892 unsigned mask, mask_bottom; 892 unsigned mask, mask_bottom;
893 lcd_blockfunc_type *bfunc; 893 lcd_remote_blockfunc_type *bfunc;
894 894
895 /* direction flip */ 895 /* direction flip */
896 if (y2 < y1) 896 if (y2 < y1)
@@ -946,10 +946,10 @@ void lcd_remote_drawrect(int x, int y, int width, int height)
946void lcd_remote_fillrect(int x, int y, int width, int height) 946void lcd_remote_fillrect(int x, int y, int width, int height)
947{ 947{
948 int ny; 948 int ny;
949 unsigned char *dst, *dst_end; 949 fb_remote_data *dst, *dst_end;
950 unsigned mask, mask_bottom; 950 unsigned mask, mask_bottom;
951 unsigned bits = 0; 951 unsigned bits = 0;
952 lcd_blockfunc_type *bfunc; 952 lcd_remote_blockfunc_type *bfunc;
953 bool fillopt = false; 953 bool fillopt = false;
954 954
955 /* nothing to draw? */ 955 /* nothing to draw? */
@@ -1000,7 +1000,7 @@ void lcd_remote_fillrect(int x, int y, int width, int height)
1000 memset(dst, bits, width); 1000 memset(dst, bits, width);
1001 else 1001 else
1002 { 1002 {
1003 unsigned char *dst_row = dst; 1003 fb_remote_data *dst_row = dst;
1004 1004
1005 dst_end = dst_row + width; 1005 dst_end = dst_row + width;
1006 do 1006 do
@@ -1043,9 +1043,9 @@ void lcd_remote_bitmap_part(const unsigned char *src, int src_x, int src_y,
1043 int stride, int x, int y, int width, int height) 1043 int stride, int x, int y, int width, int height)
1044{ 1044{
1045 int shift, ny; 1045 int shift, ny;
1046 unsigned char *dst, *dst_end; 1046 fb_remote_data *dst, *dst_end;
1047 unsigned mask, mask_bottom; 1047 unsigned mask, mask_bottom;
1048 lcd_blockfunc_type *bfunc; 1048 lcd_remote_blockfunc_type *bfunc;
1049 1049
1050 /* nothing to draw? */ 1050 /* nothing to draw? */
1051 if ((width <= 0) || (height <= 0) || (x >= LCD_REMOTE_WIDTH) 1051 if ((width <= 0) || (height <= 0) || (x >= LCD_REMOTE_WIDTH)
@@ -1070,9 +1070,9 @@ void lcd_remote_bitmap_part(const unsigned char *src, int src_x, int src_y,
1070 if (y + height > LCD_REMOTE_HEIGHT) 1070 if (y + height > LCD_REMOTE_HEIGHT)
1071 height = LCD_REMOTE_HEIGHT - y; 1071 height = LCD_REMOTE_HEIGHT - y;
1072 1072
1073 src += stride * (src_y >> 3) + src_x; /* move starting point */ 1073 src += stride * (src_y >> 3) + src_x; /* move starting point */
1074 src_y &= 7; 1074 src_y &= 7;
1075 y -= src_y; 1075 y -= src_y;
1076 dst = &lcd_remote_framebuffer[y>>3][x]; 1076 dst = &lcd_remote_framebuffer[y>>3][x];
1077 shift = y & 7; 1077 shift = y & 7;
1078 ny = height - 1 + shift + src_y; 1078 ny = height - 1 + shift + src_y;
@@ -1092,7 +1092,7 @@ void lcd_remote_bitmap_part(const unsigned char *src, int src_x, int src_y,
1092 else 1092 else
1093 { 1093 {
1094 const unsigned char *src_row = src; 1094 const unsigned char *src_row = src;
1095 unsigned char *dst_row = dst; 1095 fb_remote_data *dst_row = dst;
1096 1096
1097 dst_end = dst_row + width; 1097 dst_end = dst_row + width;
1098 do 1098 do
@@ -1122,7 +1122,7 @@ void lcd_remote_bitmap_part(const unsigned char *src, int src_x, int src_y,
1122 do 1122 do
1123 { 1123 {
1124 const unsigned char *src_col = src++; 1124 const unsigned char *src_col = src++;
1125 unsigned char *dst_col = dst++; 1125 fb_remote_data *dst_col = dst++;
1126 unsigned mask_col = mask; 1126 unsigned mask_col = mask;
1127 unsigned data = 0; 1127 unsigned data = 0;
1128 1128
diff --git a/firmware/drivers/lcd-h100.c b/firmware/drivers/lcd-h100.c
index 369833944f..39497cc2ec 100644
--- a/firmware/drivers/lcd-h100.c
+++ b/firmware/drivers/lcd-h100.c
@@ -63,7 +63,7 @@
63 63
64/*** globals ***/ 64/*** globals ***/
65 65
66unsigned char lcd_framebuffer[LCD_HEIGHT/4][LCD_WIDTH] IBSS_ATTR; 66fb_data lcd_framebuffer[LCD_HEIGHT/4][LCD_WIDTH] IBSS_ATTR;
67 67
68static const unsigned char dibits[16] ICONST_ATTR = { 68static const unsigned char dibits[16] ICONST_ATTR = {
69 0x00, 0x03, 0x0C, 0x0F, 0x30, 0x33, 0x3C, 0x3F, 69 0x00, 0x03, 0x0C, 0x0F, 0x30, 0x33, 0x3C, 0x3F,
@@ -357,21 +357,28 @@ int lcd_getstringsize(const unsigned char *str, int *w, int *h)
357 357
358static void setpixel(int x, int y) 358static void setpixel(int x, int y)
359{ 359{
360 unsigned char *data = &lcd_framebuffer[y>>2][x];
361 unsigned mask = pixmask[y & 3]; 360 unsigned mask = pixmask[y & 3];
362 *data = (*data & ~mask) | (fg_pattern & mask); 361 fb_data *address = &lcd_framebuffer[y>>2][x];
362 unsigned data = *address;
363
364 *address = data ^ ((data ^ fg_pattern) & mask);
363} 365}
364 366
365static void clearpixel(int x, int y) 367static void clearpixel(int x, int y)
366{ 368{
367 unsigned char *data = &lcd_framebuffer[y>>2][x];
368 unsigned mask = pixmask[y & 3]; 369 unsigned mask = pixmask[y & 3];
369 *data = (*data & ~mask) | (bg_pattern & mask); 370 fb_data *address = &lcd_framebuffer[y>>2][x];
371 unsigned data = *address;
372
373 *address = data ^ ((data ^ bg_pattern) & mask);
370} 374}
371 375
372static void flippixel(int x, int y) 376static void flippixel(int x, int y)
373{ 377{
374 lcd_framebuffer[y>>2][x] ^= pixmask[y & 3]; 378 unsigned mask = pixmask[y & 3];
379 fb_data *address = &lcd_framebuffer[y>>2][x];
380
381 *address ^= mask;
375} 382}
376 383
377static void nopixel(int x, int y) 384static void nopixel(int x, int y)
@@ -386,34 +393,34 @@ lcd_pixelfunc_type* const lcd_pixelfuncs[8] = {
386}; 393};
387 394
388/* 'mask' and 'bits' contain 2 bits per pixel */ 395/* 'mask' and 'bits' contain 2 bits per pixel */
389static void flipblock(unsigned char *address, unsigned mask, unsigned bits) 396static void flipblock(fb_data *address, unsigned mask, unsigned bits)
390 ICODE_ATTR; 397 ICODE_ATTR;
391static void flipblock(unsigned char *address, unsigned mask, unsigned bits) 398static void flipblock(fb_data *address, unsigned mask, unsigned bits)
392{ 399{
393 *address ^= bits & mask; 400 *address ^= bits & mask;
394} 401}
395 402
396static void bgblock(unsigned char *address, unsigned mask, unsigned bits) 403static void bgblock(fb_data *address, unsigned mask, unsigned bits)
397 ICODE_ATTR; 404 ICODE_ATTR;
398static void bgblock(unsigned char *address, unsigned mask, unsigned bits) 405static void bgblock(fb_data *address, unsigned mask, unsigned bits)
399{ 406{
400 unsigned data = *address; 407 unsigned data = *address;
401 408
402 *address = data ^ ((data ^ bg_pattern) & mask & ~bits); 409 *address = data ^ ((data ^ bg_pattern) & mask & ~bits);
403} 410}
404 411
405static void fgblock(unsigned char *address, unsigned mask, unsigned bits) 412static void fgblock(fb_data *address, unsigned mask, unsigned bits)
406 ICODE_ATTR; 413 ICODE_ATTR;
407static void fgblock(unsigned char *address, unsigned mask, unsigned bits) 414static void fgblock(fb_data *address, unsigned mask, unsigned bits)
408{ 415{
409 unsigned data = *address; 416 unsigned data = *address;
410 417
411 *address = data ^ ((data ^ fg_pattern) & mask & bits); 418 *address = data ^ ((data ^ fg_pattern) & mask & bits);
412} 419}
413 420
414static void solidblock(unsigned char *address, unsigned mask, unsigned bits) 421static void solidblock(fb_data *address, unsigned mask, unsigned bits)
415 ICODE_ATTR; 422 ICODE_ATTR;
416static void solidblock(unsigned char *address, unsigned mask, unsigned bits) 423static void solidblock(fb_data *address, unsigned mask, unsigned bits)
417{ 424{
418 unsigned data = *address; 425 unsigned data = *address;
419 unsigned bgp = bg_pattern; 426 unsigned bgp = bg_pattern;
@@ -422,34 +429,34 @@ static void solidblock(unsigned char *address, unsigned mask, unsigned bits)
422 *address = data ^ ((data ^ bits) & mask); 429 *address = data ^ ((data ^ bits) & mask);
423} 430}
424 431
425static void flipinvblock(unsigned char *address, unsigned mask, unsigned bits) 432static void flipinvblock(fb_data *address, unsigned mask, unsigned bits)
426 ICODE_ATTR; 433 ICODE_ATTR;
427static void flipinvblock(unsigned char *address, unsigned mask, unsigned bits) 434static void flipinvblock(fb_data *address, unsigned mask, unsigned bits)
428{ 435{
429 *address ^= ~bits & mask; 436 *address ^= ~bits & mask;
430} 437}
431 438
432static void bginvblock(unsigned char *address, unsigned mask, unsigned bits) 439static void bginvblock(fb_data *address, unsigned mask, unsigned bits)
433 ICODE_ATTR; 440 ICODE_ATTR;
434static void bginvblock(unsigned char *address, unsigned mask, unsigned bits) 441static void bginvblock(fb_data *address, unsigned mask, unsigned bits)
435{ 442{
436 unsigned data = *address; 443 unsigned data = *address;
437 444
438 *address = data ^ ((data ^ bg_pattern) & mask & bits); 445 *address = data ^ ((data ^ bg_pattern) & mask & bits);
439} 446}
440 447
441static void fginvblock(unsigned char *address, unsigned mask, unsigned bits) 448static void fginvblock(fb_data *address, unsigned mask, unsigned bits)
442 ICODE_ATTR; 449 ICODE_ATTR;
443static void fginvblock(unsigned char *address, unsigned mask, unsigned bits) 450static void fginvblock(fb_data *address, unsigned mask, unsigned bits)
444{ 451{
445 unsigned data = *address; 452 unsigned data = *address;
446 453
447 *address = data ^ ((data ^ fg_pattern) & mask & ~bits); 454 *address = data ^ ((data ^ fg_pattern) & mask & ~bits);
448} 455}
449 456
450static void solidinvblock(unsigned char *address, unsigned mask, unsigned bits) 457static void solidinvblock(fb_data *address, unsigned mask, unsigned bits)
451 ICODE_ATTR; 458 ICODE_ATTR;
452static void solidinvblock(unsigned char *address, unsigned mask, unsigned bits) 459static void solidinvblock(fb_data *address, unsigned mask, unsigned bits)
453{ 460{
454 unsigned data = *address; 461 unsigned data = *address;
455 unsigned fgp = fg_pattern; 462 unsigned fgp = fg_pattern;
@@ -463,7 +470,7 @@ lcd_blockfunc_type* const lcd_blockfuncs[8] = {
463 flipinvblock, bginvblock, fginvblock, solidinvblock 470 flipinvblock, bginvblock, fginvblock, solidinvblock
464}; 471};
465 472
466static inline void setblock(unsigned char *address, unsigned mask, unsigned bits) 473static inline void setblock(fb_data *address, unsigned mask, unsigned bits)
467{ 474{
468 unsigned data = *address; 475 unsigned data = *address;
469 476
@@ -564,7 +571,7 @@ void lcd_drawline(int x1, int y1, int x2, int y2)
564void lcd_hline(int x1, int x2, int y) 571void lcd_hline(int x1, int x2, int y)
565{ 572{
566 int x; 573 int x;
567 unsigned char *dst, *dst_end; 574 fb_data *dst, *dst_end;
568 unsigned mask; 575 unsigned mask;
569 lcd_blockfunc_type *bfunc; 576 lcd_blockfunc_type *bfunc;
570 577
@@ -600,7 +607,7 @@ void lcd_hline(int x1, int x2, int y)
600void lcd_vline(int x, int y1, int y2) 607void lcd_vline(int x, int y1, int y2)
601{ 608{
602 int ny; 609 int ny;
603 unsigned char *dst; 610 fb_data *dst;
604 unsigned mask, mask_bottom; 611 unsigned mask, mask_bottom;
605 lcd_blockfunc_type *bfunc; 612 lcd_blockfunc_type *bfunc;
606 613
@@ -657,7 +664,7 @@ void lcd_drawrect(int x, int y, int width, int height)
657void lcd_fillrect(int x, int y, int width, int height) 664void lcd_fillrect(int x, int y, int width, int height)
658{ 665{
659 int ny; 666 int ny;
660 unsigned char *dst, *dst_end; 667 fb_data *dst, *dst_end;
661 unsigned mask, mask_bottom; 668 unsigned mask, mask_bottom;
662 unsigned bits = 0; 669 unsigned bits = 0;
663 lcd_blockfunc_type *bfunc; 670 lcd_blockfunc_type *bfunc;
@@ -712,7 +719,7 @@ void lcd_fillrect(int x, int y, int width, int height)
712 memset(dst, bits, width); 719 memset(dst, bits, width);
713 else 720 else
714 { 721 {
715 unsigned char *dst_row = dst; 722 fb_data *dst_row = dst;
716 723
717 dst_end = dst_row + width; 724 dst_end = dst_row + width;
718 do 725 do
@@ -755,7 +762,7 @@ void lcd_mono_bitmap_part(const unsigned char *src, int src_x, int src_y,
755 int stride, int x, int y, int width, int height) 762 int stride, int x, int y, int width, int height)
756{ 763{
757 int shift, ny; 764 int shift, ny;
758 unsigned char *dst, *dst_end; 765 fb_data *dst, *dst_end;
759 unsigned mask, mask_bottom; 766 unsigned mask, mask_bottom;
760 lcd_blockfunc_type *bfunc; 767 lcd_blockfunc_type *bfunc;
761 768
@@ -800,7 +807,7 @@ void lcd_mono_bitmap_part(const unsigned char *src, int src_x, int src_y,
800 for (; ny >= 8; ny -= 8) 807 for (; ny >= 8; ny -= 8)
801 { 808 {
802 const unsigned char *src_row = src; 809 const unsigned char *src_row = src;
803 unsigned char *dst_row = dst + LCD_WIDTH; 810 fb_data *dst_row = dst + LCD_WIDTH;
804 811
805 dmask1 = dibits[mask&0x0F]; 812 dmask1 = dibits[mask&0x0F];
806 dmask2 = dibits[(mask>>4)&0x0F]; 813 dmask2 = dibits[(mask>>4)&0x0F];
@@ -863,7 +870,7 @@ void lcd_mono_bitmap_part(const unsigned char *src, int src_x, int src_y,
863 do 870 do
864 { 871 {
865 const unsigned char *src_col = src++; 872 const unsigned char *src_col = src++;
866 unsigned char *dst_col = dst++; 873 fb_data *dst_col = dst++;
867 unsigned mask_col = mask; 874 unsigned mask_col = mask;
868 unsigned data = 0; 875 unsigned data = 0;
869 876
@@ -916,14 +923,14 @@ void lcd_mono_bitmap(const unsigned char *src, int x, int y, int width, int heig
916 * This is the same as the internal lcd hw format. */ 923 * This is the same as the internal lcd hw format. */
917 924
918/* Draw a partial native bitmap */ 925/* Draw a partial native bitmap */
919void lcd_bitmap_part(const unsigned char *src, int src_x, int src_y, 926void lcd_bitmap_part(const fb_data *src, int src_x, int src_y,
920 int stride, int x, int y, int width, int height) 927 int stride, int x, int y, int width, int height)
921 ICODE_ATTR; 928 ICODE_ATTR;
922void lcd_bitmap_part(const unsigned char *src, int src_x, int src_y, 929void lcd_bitmap_part(const fb_data *src, int src_x, int src_y,
923 int stride, int x, int y, int width, int height) 930 int stride, int x, int y, int width, int height)
924{ 931{
925 int shift, ny; 932 int shift, ny;
926 unsigned char *dst, *dst_end; 933 fb_data *dst, *dst_end;
927 unsigned mask, mask_bottom; 934 unsigned mask, mask_bottom;
928 935
929 /* nothing to draw? */ 936 /* nothing to draw? */
@@ -949,9 +956,9 @@ void lcd_bitmap_part(const unsigned char *src, int src_x, int src_y,
949 if (y + height > LCD_HEIGHT) 956 if (y + height > LCD_HEIGHT)
950 height = LCD_HEIGHT - y; 957 height = LCD_HEIGHT - y;
951 958
952 src += stride * (src_y >> 2) + src_x; /* move starting point */ 959 src += stride * (src_y >> 2) + src_x; /* move starting point */
953 src_y &= 3; 960 src_y &= 3;
954 y -= src_y; 961 y -= src_y;
955 dst = &lcd_framebuffer[y>>2][x]; 962 dst = &lcd_framebuffer[y>>2][x];
956 shift = y & 3; 963 shift = y & 3;
957 ny = height - 1 + shift + src_y; 964 ny = height - 1 + shift + src_y;
@@ -967,15 +974,14 @@ void lcd_bitmap_part(const unsigned char *src, int src_x, int src_y,
967 memcpy(dst, src, width); 974 memcpy(dst, src, width);
968 else 975 else
969 { 976 {
970 const unsigned char *src_row = src; 977 const fb_data *src_row = src;
971 unsigned char *dst_row = dst; 978 fb_data *dst_row = dst;
972 979
973 dst_end = dst_row + width; 980 dst_end = dst_row + width;
974 do 981 do
975 setblock(dst_row++, mask, *src_row++); 982 setblock(dst_row++, mask, *src_row++);
976 while (dst_row < dst_end); 983 while (dst_row < dst_end);
977 } 984 }
978
979 src += stride; 985 src += stride;
980 dst += LCD_WIDTH; 986 dst += LCD_WIDTH;
981 mask = 0xFFu; 987 mask = 0xFFu;
@@ -998,8 +1004,8 @@ void lcd_bitmap_part(const unsigned char *src, int src_x, int src_y,
998 dst_end = dst + width; 1004 dst_end = dst + width;
999 do 1005 do
1000 { 1006 {
1001 const unsigned char *src_col = src++; 1007 const fb_data *src_col = src++;
1002 unsigned char *dst_col = dst++; 1008 fb_data *dst_col = dst++;
1003 unsigned mask_col = mask; 1009 unsigned mask_col = mask;
1004 unsigned data = 0; 1010 unsigned data = 0;
1005 1011
@@ -1027,7 +1033,7 @@ void lcd_bitmap_part(const unsigned char *src, int src_x, int src_y,
1027} 1033}
1028 1034
1029/* Draw a full native bitmap */ 1035/* Draw a full native bitmap */
1030void lcd_bitmap(const unsigned char *src, int x, int y, int width, int height) 1036void lcd_bitmap(const fb_data *src, int x, int y, int width, int height)
1031{ 1037{
1032 lcd_bitmap_part(src, 0, 0, width, x, y, width, height); 1038 lcd_bitmap_part(src, 0, 0, width, x, y, width, height);
1033} 1039}
@@ -1290,4 +1296,3 @@ static void scroll_thread(void)
1290 sleep(scroll_ticks); 1296 sleep(scroll_ticks);
1291 } 1297 }
1292} 1298}
1293
diff --git a/firmware/export/config-h100.h b/firmware/export/config-h100.h
index 4461cc2d44..6d204c3d66 100644
--- a/firmware/export/config-h100.h
+++ b/firmware/export/config-h100.h
@@ -31,6 +31,8 @@
31#define LCD_REMOTE_HEIGHT 64 31#define LCD_REMOTE_HEIGHT 64
32#define LCD_REMOTE_DEPTH 1 32#define LCD_REMOTE_DEPTH 1
33 33
34#define LCD_REMOTE_PIXELFORMAT VERTICAL_PACKING
35
34#define CONFIG_KEYPAD IRIVER_H100_PAD 36#define CONFIG_KEYPAD IRIVER_H100_PAD
35 37
36#define CONFIG_REMOTE_KEYPAD H100_REMOTE 38#define CONFIG_REMOTE_KEYPAD H100_REMOTE
diff --git a/firmware/export/config-h120.h b/firmware/export/config-h120.h
index f2cd8c2665..5635a92b51 100644
--- a/firmware/export/config-h120.h
+++ b/firmware/export/config-h120.h
@@ -27,6 +27,8 @@
27#define LCD_REMOTE_HEIGHT 64 27#define LCD_REMOTE_HEIGHT 64
28#define LCD_REMOTE_DEPTH 1 28#define LCD_REMOTE_DEPTH 1
29 29
30#define LCD_REMOTE_PIXELFORMAT VERTICAL_PACKING
31
30#define CONFIG_KEYPAD IRIVER_H100_PAD 32#define CONFIG_KEYPAD IRIVER_H100_PAD
31 33
32#define CONFIG_REMOTE_KEYPAD H100_REMOTE 34#define CONFIG_REMOTE_KEYPAD H100_REMOTE
diff --git a/firmware/export/config-h300.h b/firmware/export/config-h300.h
index 30cca21253..e98b60c9fc 100644
--- a/firmware/export/config-h300.h
+++ b/firmware/export/config-h300.h
@@ -29,6 +29,8 @@
29#define LCD_REMOTE_HEIGHT 64 29#define LCD_REMOTE_HEIGHT 64
30#define LCD_REMOTE_DEPTH 1 30#define LCD_REMOTE_DEPTH 1
31 31
32#define LCD_REMOTE_PIXELFORMAT VERTICAL_PACKING
33
32#define CONFIG_KEYPAD IRIVER_H300_PAD 34#define CONFIG_KEYPAD IRIVER_H300_PAD
33 35
34#define CONFIG_REMOTE_KEYPAD H300_REMOTE 36#define CONFIG_REMOTE_KEYPAD H300_REMOTE
diff --git a/firmware/export/lcd-remote.h b/firmware/export/lcd-remote.h
index c27a0d4e73..031fcdfc0f 100644
--- a/firmware/export/lcd-remote.h
+++ b/firmware/export/lcd-remote.h
@@ -27,9 +27,6 @@
27 27
28#ifdef HAVE_REMOTE_LCD 28#ifdef HAVE_REMOTE_LCD
29 29
30#define STYLE_DEFAULT 0
31#define STYLE_INVERT 1
32
33#if defined(IRIVER_H100_SERIES) || defined(IRIVER_H300_SERIES) 30#if defined(IRIVER_H100_SERIES) || defined(IRIVER_H300_SERIES)
34#define REMOTETYPE_H100_LCD 1 31#define REMOTETYPE_H100_LCD 1
35#define REMOTETYPE_H300_LCD 2 32#define REMOTETYPE_H300_LCD 2
@@ -37,35 +34,82 @@
37extern int remote_type(void); 34extern int remote_type(void);
38#endif 35#endif
39 36
37#define STYLE_DEFAULT 0
38#define STYLE_INVERT 1
39
40#if LCD_REMOTE_DEPTH <= 8
41#if (LCD_REMOTE_PIXELFORMAT == VERTICAL_INTERLEAVED) \
42 || (LCD_REMOTE_PIXELFORMAT == HORIZONTAL_INTERLEAVED)
43typedef unsigned short fb_remote_data;
44#else
45typedef unsigned char fb_remote_data;
46#endif
47#elif LCD_DEPTH <= 16
48typedef unsigned short fb_remote_data;
49#else
50typedef unsigned long fb_remote_data;
51#endif
52
53#ifndef LCD_REMOTE_FBWIDTH
54#define LCD_REMOTE_FBWIDTH LCD_REMOTE_WIDTH
55#endif
56
57/* Low-level drawing function types */
58typedef void lcd_remote_pixelfunc_type(int x, int y);
59typedef void lcd_remote_blockfunc_type(fb_remote_data *address, unsigned mask,
60 unsigned bits);
61
62#if LCD_REMOTE_DEPTH > 1 /* greyscale */
63#define LCD_REMOTE_MAX_LEVEL ((1 << LCD_REMOTE_DEPTH) - 1)
64#define LCD_REMOTE_BRIGHTNESS(y) (((y) * LCD_REMOTE_MAX_LEVEL + 127) / 255)
65
66#define LCD_REMOTE_BLACK LCD_REMOTE_BRIGHTNESS(0)
67#define LCD_REMOTE_DARKGRAY LCD_REMOTE_BRIGHTNESS(85)
68#define LCD_REMOTE_LIGHTGRAY LCD_REMOTE_BRIGHTNESS(170)
69#define LCD_REMOTE_WHITE LCD_REMOTE_BRIGHTNESS(255)
70#define LCD_REMOTE_DEFAULT_FG LCD_REMOTE_BLACK
71#define LCD_REMOTE_DEFAULT_BG LCD_REMOTE_WHITE
72
73#endif
74
75/* Memory copy of display bitmap */
76#if LCD_REMOTE_DEPTH == 1
77extern fb_remote_data lcd_remote_framebuffer[LCD_REMOTE_HEIGHT/8][LCD_REMOTE_WIDTH];
78#elif LCD_REMOTE_DEPTH == 2
79#if LCD_REMOTE_PIXELFORMAT == VERTICAL_INTERLEAVED
80extern fb_remote_data lcd_remote_framebuffer[LCD_REMOTE_HEIGHT/8][LCD_REMOTE_WIDTH];
81#endif
82#endif
83
40extern void lcd_remote_init(void); 84extern void lcd_remote_init(void);
41extern int lcd_remote_default_contrast(void); 85extern int lcd_remote_default_contrast(void);
42extern void lcd_remote_set_contrast(int val); 86extern void lcd_remote_set_contrast(int val);
43extern void lcd_remote_emireduce(bool state); 87extern void lcd_remote_emireduce(bool state);
44 88
45extern void lcd_remote_clear_display(void); 89extern void lcd_remote_clear_display(void);
46extern void lcd_remote_puts(int x, int y, const unsigned char *string); 90extern void lcd_remote_puts(int x, int y, const unsigned char *str);
47extern void lcd_remote_puts_style(int x, int y, const unsigned char *string, 91extern void lcd_remote_puts_style(int x, int y, const unsigned char *str,
48 int style); 92 int style);
49extern void lcd_remote_puts_offset(int x, int y, const unsigned char *str, int offset); 93extern void lcd_remote_puts_offset(int x, int y, const unsigned char *str,
50extern void lcd_remote_puts_style_offset(int x, int y, const unsigned char *str, int style, int offset); 94 int offset);
95extern void lcd_remote_puts_style_offset(int x, int y, const unsigned char *str,
96 int style, int offset);
51extern void lcd_remote_putc(int x, int y, unsigned short ch); 97extern void lcd_remote_putc(int x, int y, unsigned short ch);
52extern void lcd_remote_stop_scroll(void); 98extern void lcd_remote_stop_scroll(void);
53extern void lcd_remote_scroll_speed(int speed); 99extern void lcd_remote_scroll_speed(int speed);
54extern void lcd_remote_scroll_delay(int ms); 100extern void lcd_remote_scroll_delay(int ms);
55extern void lcd_remote_puts_scroll(int x, int y, const unsigned char* string); 101extern void lcd_remote_puts_scroll(int x, int y, const unsigned char *str);
56extern void lcd_remote_puts_scroll_style(int x, int y,const unsigned char* string, 102extern void lcd_remote_puts_scroll_style(int x, int y, const unsigned char *str,
57 int style); 103 int style);
58extern void lcd_remote_puts_scroll_offset(int x, int y, const unsigned char *string, 104extern void lcd_remote_puts_scroll_offset(int x, int y,
59 int offset); 105 const unsigned char *str, int offset);
60extern void lcd_remote_puts_scroll_style_offset(int x, int y, const unsigned char *string, 106extern void lcd_remote_puts_scroll_style_offset(int x, int y,
107 const unsigned char *string,
61 int style, int offset); 108 int style, int offset);
62 109
63extern void lcd_remote_update(void); 110extern void lcd_remote_update(void);
64extern void lcd_remote_update_rect(int x, int y, int width, int height); 111extern void lcd_remote_update_rect(int x, int y, int width, int height);
65 112
66/* Memory copy of display bitmap */
67extern unsigned char lcd_remote_framebuffer[LCD_REMOTE_HEIGHT/8][LCD_REMOTE_WIDTH];
68
69extern void lcd_remote_set_invert_display(bool yesno); 113extern void lcd_remote_set_invert_display(bool yesno);
70extern void lcd_remote_set_flip(bool yesno); 114extern void lcd_remote_set_flip(bool yesno);
71extern void lcd_remote_roll(int pixels); 115extern void lcd_remote_roll(int pixels);
@@ -78,25 +122,50 @@ extern int lcd_remote_getymargin(void);
78extern void lcd_remote_setfont(int font); 122extern void lcd_remote_setfont(int font);
79extern int lcd_remote_getstringsize(const unsigned char *str, int *w, int *h); 123extern int lcd_remote_getstringsize(const unsigned char *str, int *w, int *h);
80 124
125/* low level drawing function pointer arrays */
126extern lcd_remote_pixelfunc_type* const lcd_remote_pixelfuncs[8];
127extern lcd_remote_blockfunc_type* const lcd_remote_blockfuncs[8];
128
81extern void lcd_remote_drawpixel(int x, int y); 129extern void lcd_remote_drawpixel(int x, int y);
82extern void lcd_remote_drawline(int x1, int y1, int x2, int y2); 130extern void lcd_remote_drawline(int x1, int y1, int x2, int y2);
83extern void lcd_remote_hline(int x1, int x2, int y); 131extern void lcd_remote_hline(int x1, int x2, int y);
84extern void lcd_remote_vline(int x, int y1, int y2); 132extern void lcd_remote_vline(int x, int y1, int y2);
85extern void lcd_remote_drawrect(int x, int y, int width, int height); 133extern void lcd_remote_drawrect(int x, int y, int width, int height);
86extern void lcd_remote_fillrect(int x, int y, int width, int height); 134extern void lcd_remote_fillrect(int x, int y, int width, int height);
87extern void lcd_remote_bitmap_part(const unsigned char *src, int src_x, 135extern void lcd_remote_bitmap_part(const fb_remote_data *src, int src_x,
88 int src_y, int stride, int x, int y, 136 int src_y, int stride, int x, int y,
89 int width, int height); 137 int width, int height);
90extern void lcd_remote_bitmap(const unsigned char *src, int x, int y, 138extern void lcd_remote_bitmap(const fb_remote_data *src, int x, int y,
91 int width, int height); 139 int width, int height);
92extern void lcd_remote_putsxy(int x, int y, const unsigned char *string); 140extern void lcd_remote_putsxy(int x, int y, const unsigned char *str);
93 141
94extern void lcd_remote_invertscroll(int x, int y); 142extern void lcd_remote_invertscroll(int x, int y);
95extern void lcd_remote_bidir_scroll(int threshold); 143extern void lcd_remote_bidir_scroll(int threshold);
96extern void lcd_remote_scroll_step(int pixels); 144extern void lcd_remote_scroll_step(int pixels);
97 145
146#if LCD_REMOTE_DEPTH > 1
147extern void lcd_remote_set_foreground(unsigned foreground);
148extern unsigned lcd_remote_get_foreground(void);
149extern void lcd_remote_set_background(unsigned background);
150extern unsigned lcd_remote_get_background(void);
151extern void lcd_remote_set_drawinfo(int mode, unsigned foreground,
152 unsigned background);
153
154extern void lcd_remote_mono_bitmap_part(const unsigned char *src, int src_x,
155 int src_y, int stride, int x, int y,
156 int width, int height);
157extern void lcd_remote_mono_bitmap(const unsigned char *src, int x, int y,
158 int width, int height);
159extern void lcd_remote_bitmap_transparent_part(const fb_remote_data *src,
160 int src_x, int src_y,
161 int stride, int x, int y,
162 int width, int height);
163extern void lcd_bitmap_remote_transparent(const fb_remote_data *src, int x,
164 int y, int width, int height);
165#else /* LCD_REMOTE_DEPTH == 1 */
98#define lcd_remote_mono_bitmap lcd_remote_bitmap 166#define lcd_remote_mono_bitmap lcd_remote_bitmap
99#define lcd_remote_mono_bitmap_part lcd_remote_bitmap_part 167#define lcd_remote_mono_bitmap_part lcd_remote_bitmap_part
168#endif /* LCD_REMOTE_DEPTH */
100 169
101#endif 170#endif
102#endif 171#endif /* __LCD_REMOTE_H__ */
diff --git a/firmware/export/lcd.h b/firmware/export/lcd.h
index 89bf35300c..38561a725e 100644
--- a/firmware/export/lcd.h
+++ b/firmware/export/lcd.h
@@ -138,7 +138,7 @@ extern void lcd_jump_scroll_delay(int ms);
138 138
139/* Low-level drawing function types */ 139/* Low-level drawing function types */
140typedef void lcd_pixelfunc_type(int x, int y); 140typedef void lcd_pixelfunc_type(int x, int y);
141typedef void lcd_blockfunc_type(unsigned char *address, unsigned mask, unsigned bits); 141typedef void lcd_blockfunc_type(fb_data *address, unsigned mask, unsigned bits);
142#if LCD_DEPTH >= 8 142#if LCD_DEPTH >= 8
143typedef void lcd_fastpixelfunc_type(fb_data *address); 143typedef void lcd_fastpixelfunc_type(fb_data *address);
144#endif 144#endif