summaryrefslogtreecommitdiff
path: root/firmware
diff options
context:
space:
mode:
authorJens Arnold <amiconn@rockbox.org>2008-04-12 07:53:33 +0000
committerJens Arnold <amiconn@rockbox.org>2008-04-12 07:53:33 +0000
commit00ac809cc71e3747c81bf01be95d5cf21d93d9a0 (patch)
tree4d79755bdc07bdad65e9a524ac8fab572564494d /firmware
parent02eb1d83a79c265b0273e18630553efcf8b9196c (diff)
downloadrockbox-00ac809cc71e3747c81bf01be95d5cf21d93d9a0.tar.gz
rockbox-00ac809cc71e3747c81bf01be95d5cf21d93d9a0.zip
LCD drivers: * Automatically optimise horizontal and vertical lines drawn via _drawline(), with debug message to show possible optimisations in the caller. * Get rid of the extra ICODE function declarations by putting the attribute into the definition.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17081 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware')
-rw-r--r--firmware/drivers/lcd-16bit.c54
-rw-r--r--firmware/drivers/lcd-1bit-vert.c13
-rw-r--r--firmware/drivers/lcd-2bit-horz.c90
-rw-r--r--firmware/drivers/lcd-2bit-vert.c88
-rw-r--r--firmware/drivers/lcd-2bit-vi.c13
-rw-r--r--firmware/drivers/lcd-remote-1bit-v.c1
-rw-r--r--firmware/drivers/lcd-remote-2bit-vi.c1
7 files changed, 140 insertions, 120 deletions
diff --git a/firmware/drivers/lcd-16bit.c b/firmware/drivers/lcd-16bit.c
index 20d30c572c..dab29efef7 100644
--- a/firmware/drivers/lcd-16bit.c
+++ b/firmware/drivers/lcd-16bit.c
@@ -204,32 +204,27 @@ int lcd_getstringsize(const unsigned char *str, int *w, int *h)
204 204
205#define LCDADDR(x, y) (&lcd_framebuffer[(y)][(x)]) 205#define LCDADDR(x, y) (&lcd_framebuffer[(y)][(x)])
206 206
207static void setpixel(fb_data *address) ICODE_ATTR; 207static void ICODE_ATTR setpixel(fb_data *address)
208static void setpixel(fb_data *address)
209{ 208{
210 *address = current_vp->fg_pattern; 209 *address = current_vp->fg_pattern;
211} 210}
212 211
213static void clearpixel(fb_data *address) ICODE_ATTR; 212static void ICODE_ATTR clearpixel(fb_data *address)
214static void clearpixel(fb_data *address)
215{ 213{
216 *address = current_vp->bg_pattern; 214 *address = current_vp->bg_pattern;
217} 215}
218 216
219static void clearimgpixel(fb_data *address) ICODE_ATTR; 217static void ICODE_ATTR clearimgpixel(fb_data *address)
220static void clearimgpixel(fb_data *address)
221{ 218{
222 *address = *(fb_data *)((long)address + lcd_backdrop_offset); 219 *address = *(fb_data *)((long)address + lcd_backdrop_offset);
223} 220}
224 221
225static void flippixel(fb_data *address) ICODE_ATTR; 222static void ICODE_ATTR flippixel(fb_data *address)
226static void flippixel(fb_data *address)
227{ 223{
228 *address = ~(*address); 224 *address = ~(*address);
229} 225}
230 226
231static void nopixel(fb_data *address) ICODE_ATTR; 227static void ICODE_ATTR nopixel(fb_data *address)
232static void nopixel(fb_data *address)
233{ 228{
234 (void)address; 229 (void)address;
235} 230}
@@ -349,8 +344,20 @@ void lcd_drawline(int x1, int y1, int x2, int y2)
349 int y, yinc1, yinc2; 344 int y, yinc1, yinc2;
350 lcd_fastpixelfunc_type *pfunc = lcd_fastpixelfuncs[current_vp->drawmode]; 345 lcd_fastpixelfunc_type *pfunc = lcd_fastpixelfuncs[current_vp->drawmode];
351 346
352 deltax = abs(x2 - x1);
353 deltay = abs(y2 - y1); 347 deltay = abs(y2 - y1);
348 if (deltay == 0)
349 {
350 DEBUGF("lcd_drawline() called for horizontal line - optimisation.\n");
351 lcd_hline(x1, x2, y1);
352 return;
353 }
354 deltax = abs(x2 - x1);
355 if (deltax == 0)
356 {
357 DEBUGF("lcd_drawline() called for vertical line - optimisation.\n");
358 lcd_vline(x1, y1, y2);
359 return;
360 }
354 xinc2 = 1; 361 xinc2 = 1;
355 yinc2 = 1; 362 yinc2 = 1;
356 363
@@ -699,11 +706,9 @@ static void lcd_gradient_rect_scroll(int x1, int x2, int y, int h,
699 706
700/* Draw a partial monochrome bitmap */ 707/* Draw a partial monochrome bitmap */
701 708
702void lcd_mono_bitmap_part(const unsigned char *src, int src_x, int src_y, 709void ICODE_ATTR lcd_mono_bitmap_part(const unsigned char *src, int src_x,
703 int stride, int x, int y, int width, int height) 710 int src_y, int stride, int x, int y,
704 ICODE_ATTR; 711 int width, int height)
705void lcd_mono_bitmap_part(const unsigned char *src, int src_x, int src_y,
706 int stride, int x, int y, int width, int height)
707{ 712{
708 const unsigned char *src_end; 713 const unsigned char *src_end;
709 bool has_backdrop; 714 bool has_backdrop;
@@ -798,11 +803,9 @@ void lcd_mono_bitmap(const unsigned char *src, int x, int y, int width, int heig
798} 803}
799 804
800/* Draw a partial native bitmap */ 805/* Draw a partial native bitmap */
801void lcd_bitmap_part(const fb_data *src, int src_x, int src_y, 806void ICODE_ATTR lcd_bitmap_part(const fb_data *src, int src_x, int src_y,
802 int stride, int x, int y, int width, int height) 807 int stride, int x, int y, int width,
803 ICODE_ATTR; 808 int height)
804void lcd_bitmap_part(const fb_data *src, int src_x, int src_y,
805 int stride, int x, int y, int width, int height)
806{ 809{
807 fb_data *dst, *dst_end; 810 fb_data *dst, *dst_end;
808 811
@@ -851,12 +854,9 @@ void lcd_bitmap(const fb_data *src, int x, int y, int width, int height)
851#if !defined(TOSHIBA_GIGABEAT_F) && !defined(TOSHIBA_GIGABEAT_S) \ 854#if !defined(TOSHIBA_GIGABEAT_F) && !defined(TOSHIBA_GIGABEAT_S) \
852 || defined(SIMULATOR) 855 || defined(SIMULATOR)
853/* Draw a partial native bitmap */ 856/* Draw a partial native bitmap */
854void lcd_bitmap_transparent_part(const fb_data *src, int src_x, int src_y, 857void ICODE_ATTR lcd_bitmap_transparent_part(const fb_data *src, int src_x,
855 int stride, int x, int y, int width, 858 int src_y, int stride, int x,
856 int height) ICODE_ATTR; 859 int y, int width, int height)
857void lcd_bitmap_transparent_part(const fb_data *src, int src_x, int src_y,
858 int stride, int x, int y, int width,
859 int height)
860{ 860{
861 fb_data *dst, *dst_end; 861 fb_data *dst, *dst_end;
862 862
diff --git a/firmware/drivers/lcd-1bit-vert.c b/firmware/drivers/lcd-1bit-vert.c
index 3a6e59c461..c6fe40cdb7 100644
--- a/firmware/drivers/lcd-1bit-vert.c
+++ b/firmware/drivers/lcd-1bit-vert.c
@@ -36,6 +36,7 @@
36#define LCDFN(fn) lcd_ ## fn 36#define LCDFN(fn) lcd_ ## fn
37#define FBFN(fn) fb_ ## fn 37#define FBFN(fn) fb_ ## fn
38#define LCDM(ma) LCD_ ## ma 38#define LCDM(ma) LCD_ ## ma
39#define LCDNAME "lcd_"
39#define MAIN_LCD 40#define MAIN_LCD
40#endif 41#endif
41 42
@@ -290,7 +291,19 @@ void LCDFN(drawline)(int x1, int y1, int x2, int y2)
290 LCDFN(pixelfunc_type) *pfunc = LCDFN(pixelfuncs)[current_vp->drawmode]; 291 LCDFN(pixelfunc_type) *pfunc = LCDFN(pixelfuncs)[current_vp->drawmode];
291 292
292 deltax = abs(x2 - x1); 293 deltax = abs(x2 - x1);
294 if (deltax == 0)
295 {
296 DEBUGF(LCDNAME "drawline() called for vertical line - optimisation.\n");
297 LCDFN(vline)(x1, y1, y2);
298 return;
299 }
293 deltay = abs(y2 - y1); 300 deltay = abs(y2 - y1);
301 if (deltay == 0)
302 {
303 DEBUGF(LCDNAME "drawline() called for horizontal line - optimisation.\n");
304 LCDFN(hline)(x1, x2, y1);
305 return;
306 }
294 xinc2 = 1; 307 xinc2 = 1;
295 yinc2 = 1; 308 yinc2 = 1;
296 309
diff --git a/firmware/drivers/lcd-2bit-horz.c b/firmware/drivers/lcd-2bit-horz.c
index 195885c072..30901efb98 100644
--- a/firmware/drivers/lcd-2bit-horz.c
+++ b/firmware/drivers/lcd-2bit-horz.c
@@ -239,43 +239,38 @@ lcd_pixelfunc_type* const * lcd_pixelfuncs = lcd_pixelfuncs_bgcolor;
239 239
240 240
241/* 'mask' and 'bits' contain 2 bits per pixel */ 241/* 'mask' and 'bits' contain 2 bits per pixel */
242static void flipblock(fb_data *address, unsigned mask, unsigned bits) 242static void ICODE_ATTR flipblock(fb_data *address, unsigned mask,
243 ICODE_ATTR; 243 unsigned bits)
244static void flipblock(fb_data *address, unsigned mask, unsigned bits)
245{ 244{
246 *address ^= bits & mask; 245 *address ^= bits & mask;
247} 246}
248 247
249static void bgblock(fb_data *address, unsigned mask, unsigned bits) 248static void ICODE_ATTR bgblock(fb_data *address, unsigned mask,
250 ICODE_ATTR; 249 unsigned bits)
251static void bgblock(fb_data *address, unsigned mask, unsigned bits)
252{ 250{
253 unsigned data = *address; 251 unsigned data = *address;
254 252
255 *address = data ^ ((data ^ bg_pattern) & mask & ~bits); 253 *address = data ^ ((data ^ bg_pattern) & mask & ~bits);
256} 254}
257 255
258static void bgimgblock(fb_data *address, unsigned mask, unsigned bits) 256static void ICODE_ATTR bgimgblock(fb_data *address, unsigned mask,
259 ICODE_ATTR; 257 unsigned bits)
260static void bgimgblock(fb_data *address, unsigned mask, unsigned bits)
261{ 258{
262 unsigned data = *address; 259 unsigned data = *address;
263 260
264 *address = data ^ ((data ^ *(address + lcd_backdrop_offset)) & mask & ~bits); 261 *address = data ^ ((data ^ *(address + lcd_backdrop_offset)) & mask & ~bits);
265} 262}
266 263
267static void fgblock(fb_data *address, unsigned mask, unsigned bits) 264static void ICODE_ATTR fgblock(fb_data *address, unsigned mask,
268 ICODE_ATTR; 265 unsigned bits)
269static void fgblock(fb_data *address, unsigned mask, unsigned bits)
270{ 266{
271 unsigned data = *address; 267 unsigned data = *address;
272 268
273 *address = data ^ ((data ^ fg_pattern) & mask & bits); 269 *address = data ^ ((data ^ fg_pattern) & mask & bits);
274} 270}
275 271
276static void solidblock(fb_data *address, unsigned mask, unsigned bits) 272static void ICODE_ATTR solidblock(fb_data *address, unsigned mask,
277 ICODE_ATTR; 273 unsigned bits)
278static void solidblock(fb_data *address, unsigned mask, unsigned bits)
279{ 274{
280 unsigned data = *address; 275 unsigned data = *address;
281 unsigned bgp = bg_pattern; 276 unsigned bgp = bg_pattern;
@@ -284,9 +279,8 @@ static void solidblock(fb_data *address, unsigned mask, unsigned bits)
284 *address = data ^ ((data ^ bits) & mask); 279 *address = data ^ ((data ^ bits) & mask);
285} 280}
286 281
287static void solidimgblock(fb_data *address, unsigned mask, unsigned bits) 282static void ICODE_ATTR solidimgblock(fb_data *address, unsigned mask,
288 ICODE_ATTR; 283 unsigned bits)
289static void solidimgblock(fb_data *address, unsigned mask, unsigned bits)
290{ 284{
291 unsigned data = *address; 285 unsigned data = *address;
292 unsigned bgp = *(address + lcd_backdrop_offset); 286 unsigned bgp = *(address + lcd_backdrop_offset);
@@ -295,43 +289,38 @@ static void solidimgblock(fb_data *address, unsigned mask, unsigned bits)
295 *address = data ^ ((data ^ bits) & mask); 289 *address = data ^ ((data ^ bits) & mask);
296} 290}
297 291
298static void flipinvblock(fb_data *address, unsigned mask, unsigned bits) 292static void ICODE_ATTR flipinvblock(fb_data *address, unsigned mask,
299 ICODE_ATTR; 293 unsigned bits)
300static void flipinvblock(fb_data *address, unsigned mask, unsigned bits)
301{ 294{
302 *address ^= ~bits & mask; 295 *address ^= ~bits & mask;
303} 296}
304 297
305static void bginvblock(fb_data *address, unsigned mask, unsigned bits) 298static void ICODE_ATTR bginvblock(fb_data *address, unsigned mask,
306 ICODE_ATTR; 299 unsigned bits)
307static void bginvblock(fb_data *address, unsigned mask, unsigned bits)
308{ 300{
309 unsigned data = *address; 301 unsigned data = *address;
310 302
311 *address = data ^ ((data ^ bg_pattern) & mask & bits); 303 *address = data ^ ((data ^ bg_pattern) & mask & bits);
312} 304}
313 305
314static void bgimginvblock(fb_data *address, unsigned mask, unsigned bits) 306static void ICODE_ATTR bgimginvblock(fb_data *address, unsigned mask,
315 ICODE_ATTR; 307 unsigned bits)
316static void bgimginvblock(fb_data *address, unsigned mask, unsigned bits)
317{ 308{
318 unsigned data = *address; 309 unsigned data = *address;
319 310
320 *address = data ^ ((data ^ *(address + lcd_backdrop_offset)) & mask & bits); 311 *address = data ^ ((data ^ *(address + lcd_backdrop_offset)) & mask & bits);
321} 312}
322 313
323static void fginvblock(fb_data *address, unsigned mask, unsigned bits) 314static void ICODE_ATTR fginvblock(fb_data *address, unsigned mask,
324 ICODE_ATTR; 315 unsigned bits)
325static void fginvblock(fb_data *address, unsigned mask, unsigned bits)
326{ 316{
327 unsigned data = *address; 317 unsigned data = *address;
328 318
329 *address = data ^ ((data ^ fg_pattern) & mask & ~bits); 319 *address = data ^ ((data ^ fg_pattern) & mask & ~bits);
330} 320}
331 321
332static void solidinvblock(fb_data *address, unsigned mask, unsigned bits) 322static void ICODE_ATTR solidinvblock(fb_data *address, unsigned mask,
333 ICODE_ATTR; 323 unsigned bits)
334static void solidinvblock(fb_data *address, unsigned mask, unsigned bits)
335{ 324{
336 unsigned data = *address; 325 unsigned data = *address;
337 unsigned fgp = fg_pattern; 326 unsigned fgp = fg_pattern;
@@ -340,9 +329,8 @@ static void solidinvblock(fb_data *address, unsigned mask, unsigned bits)
340 *address = data ^ ((data ^ bits) & mask); 329 *address = data ^ ((data ^ bits) & mask);
341} 330}
342 331
343static void solidimginvblock(fb_data *address, unsigned mask, unsigned bits) 332static void ICODE_ATTR solidimginvblock(fb_data *address, unsigned mask,
344 ICODE_ATTR; 333 unsigned bits)
345static void solidimginvblock(fb_data *address, unsigned mask, unsigned bits)
346{ 334{
347 unsigned data = *address; 335 unsigned data = *address;
348 unsigned fgp = fg_pattern; 336 unsigned fgp = fg_pattern;
@@ -459,8 +447,20 @@ void lcd_drawline(int x1, int y1, int x2, int y2)
459 int y, yinc1, yinc2; 447 int y, yinc1, yinc2;
460 lcd_pixelfunc_type *pfunc = lcd_pixelfuncs[current_vp->drawmode]; 448 lcd_pixelfunc_type *pfunc = lcd_pixelfuncs[current_vp->drawmode];
461 449
462 deltax = abs(x2 - x1);
463 deltay = abs(y2 - y1); 450 deltay = abs(y2 - y1);
451 if (deltay == 0)
452 {
453 DEBUGF("lcd_drawline() called for horizontal line - optimisation.\n");
454 lcd_hline(x1, x2, y1);
455 return;
456 }
457 deltax = abs(x2 - x1);
458 if (deltax == 0)
459 {
460 DEBUGF("lcd_drawline() called for vertical line - optimisation.\n");
461 lcd_vline(x1, y1, y2);
462 return;
463 }
464 xinc2 = 1; 464 xinc2 = 1;
465 yinc2 = 1; 465 yinc2 = 1;
466 466
@@ -702,11 +702,9 @@ void lcd_fillrect(int x, int y, int width, int height)
702 * 0..7, the second row defines pixel row 8..15 etc. */ 702 * 0..7, the second row defines pixel row 8..15 etc. */
703 703
704/* Draw a partial monochrome bitmap */ 704/* Draw a partial monochrome bitmap */
705void lcd_mono_bitmap_part(const unsigned char *src, int src_x, int src_y, 705void ICODE_ATTR lcd_mono_bitmap_part(const unsigned char *src, int src_x,
706 int stride, int x, int y, int width, int height) 706 int src_y, int stride, int x, int y,
707 ICODE_ATTR; 707 int width, int height)
708void lcd_mono_bitmap_part(const unsigned char *src, int src_x, int src_y,
709 int stride, int x, int y, int width, int height)
710{ 708{
711 int ny, nx, ymax; 709 int ny, nx, ymax;
712 const unsigned char * src_end; 710 const unsigned char * src_end;
@@ -795,11 +793,9 @@ void lcd_mono_bitmap(const unsigned char *src, int x, int y, int width, int heig
795 * This is the same as the internal lcd hw format. */ 793 * This is the same as the internal lcd hw format. */
796 794
797/* Draw a partial native bitmap */ 795/* Draw a partial native bitmap */
798void lcd_bitmap_part(const unsigned char *src, int src_x, int src_y, 796void ICODE_ATTR lcd_bitmap_part(const unsigned char *src, int src_x,
799 int stride, int x, int y, int width, int height) 797 int src_y, int stride, int x, int y,
800 ICODE_ATTR; 798 int width, int height)
801void lcd_bitmap_part(const unsigned char *src, int src_x, int src_y,
802 int stride, int x, int y, int width, int height)
803{ 799{
804 int shift, nx; 800 int shift, nx;
805 unsigned char *dst, *dst_end; 801 unsigned char *dst, *dst_end;
diff --git a/firmware/drivers/lcd-2bit-vert.c b/firmware/drivers/lcd-2bit-vert.c
index 5373bb9f0a..d43bf6cc81 100644
--- a/firmware/drivers/lcd-2bit-vert.c
+++ b/firmware/drivers/lcd-2bit-vert.c
@@ -242,43 +242,38 @@ lcd_pixelfunc_type* const lcd_pixelfuncs_backdrop[8] = {
242lcd_pixelfunc_type* const * lcd_pixelfuncs = lcd_pixelfuncs_bgcolor; 242lcd_pixelfunc_type* const * lcd_pixelfuncs = lcd_pixelfuncs_bgcolor;
243 243
244/* 'mask' and 'bits' contain 2 bits per pixel */ 244/* 'mask' and 'bits' contain 2 bits per pixel */
245static void flipblock(fb_data *address, unsigned mask, unsigned bits) 245static void ICODE_ATTR flipblock(fb_data *address, unsigned mask,
246 ICODE_ATTR; 246 unsigned bits)
247static void flipblock(fb_data *address, unsigned mask, unsigned bits)
248{ 247{
249 *address ^= bits & mask; 248 *address ^= bits & mask;
250} 249}
251 250
252static void bgblock(fb_data *address, unsigned mask, unsigned bits) 251static void ICODE_ATTR bgblock(fb_data *address, unsigned mask,
253 ICODE_ATTR; 252 unsigned bits)
254static void bgblock(fb_data *address, unsigned mask, unsigned bits)
255{ 253{
256 unsigned data = *address; 254 unsigned data = *address;
257 255
258 *address = data ^ ((data ^ bg_pattern) & mask & ~bits); 256 *address = data ^ ((data ^ bg_pattern) & mask & ~bits);
259} 257}
260 258
261static void bgimgblock(fb_data *address, unsigned mask, unsigned bits) 259static void ICODE_ATTR bgimgblock(fb_data *address, unsigned mask,
262 ICODE_ATTR; 260 unsigned bits)
263static void bgimgblock(fb_data *address, unsigned mask, unsigned bits)
264{ 261{
265 unsigned data = *address; 262 unsigned data = *address;
266 263
267 *address = data ^ ((data ^ *(address + lcd_backdrop_offset)) & mask & ~bits); 264 *address = data ^ ((data ^ *(address + lcd_backdrop_offset)) & mask & ~bits);
268} 265}
269 266
270static void fgblock(fb_data *address, unsigned mask, unsigned bits) 267static void ICODE_ATTR fgblock(fb_data *address, unsigned mask,
271 ICODE_ATTR; 268 unsigned bits)
272static void fgblock(fb_data *address, unsigned mask, unsigned bits)
273{ 269{
274 unsigned data = *address; 270 unsigned data = *address;
275 271
276 *address = data ^ ((data ^ fg_pattern) & mask & bits); 272 *address = data ^ ((data ^ fg_pattern) & mask & bits);
277} 273}
278 274
279static void solidblock(fb_data *address, unsigned mask, unsigned bits) 275static void ICODE_ATTR solidblock(fb_data *address, unsigned mask,
280 ICODE_ATTR; 276 unsigned bits)
281static void solidblock(fb_data *address, unsigned mask, unsigned bits)
282{ 277{
283 unsigned data = *address; 278 unsigned data = *address;
284 unsigned bgp = bg_pattern; 279 unsigned bgp = bg_pattern;
@@ -287,9 +282,8 @@ static void solidblock(fb_data *address, unsigned mask, unsigned bits)
287 *address = data ^ ((data ^ bits) & mask); 282 *address = data ^ ((data ^ bits) & mask);
288} 283}
289 284
290static void solidimgblock(fb_data *address, unsigned mask, unsigned bits) 285static void ICODE_ATTR solidimgblock(fb_data *address, unsigned mask,
291 ICODE_ATTR; 286 unsigned bits)
292static void solidimgblock(fb_data *address, unsigned mask, unsigned bits)
293{ 287{
294 unsigned data = *address; 288 unsigned data = *address;
295 unsigned bgp = *(address + lcd_backdrop_offset); 289 unsigned bgp = *(address + lcd_backdrop_offset);
@@ -298,43 +292,38 @@ static void solidimgblock(fb_data *address, unsigned mask, unsigned bits)
298 *address = data ^ ((data ^ bits) & mask); 292 *address = data ^ ((data ^ bits) & mask);
299} 293}
300 294
301static void flipinvblock(fb_data *address, unsigned mask, unsigned bits) 295static void ICODE_ATTR flipinvblock(fb_data *address, unsigned mask,
302 ICODE_ATTR; 296 unsigned bits)
303static void flipinvblock(fb_data *address, unsigned mask, unsigned bits)
304{ 297{
305 *address ^= ~bits & mask; 298 *address ^= ~bits & mask;
306} 299}
307 300
308static void bginvblock(fb_data *address, unsigned mask, unsigned bits) 301static void ICODE_ATTR bginvblock(fb_data *address, unsigned mask,
309 ICODE_ATTR; 302 unsigned bits)
310static void bginvblock(fb_data *address, unsigned mask, unsigned bits)
311{ 303{
312 unsigned data = *address; 304 unsigned data = *address;
313 305
314 *address = data ^ ((data ^ bg_pattern) & mask & bits); 306 *address = data ^ ((data ^ bg_pattern) & mask & bits);
315} 307}
316 308
317static void bgimginvblock(fb_data *address, unsigned mask, unsigned bits) 309static void ICODE_ATTR bgimginvblock(fb_data *address, unsigned mask,
318 ICODE_ATTR; 310 unsigned bits)
319static void bgimginvblock(fb_data *address, unsigned mask, unsigned bits)
320{ 311{
321 unsigned data = *address; 312 unsigned data = *address;
322 313
323 *address = data ^ ((data ^ *(address + lcd_backdrop_offset)) & mask & bits); 314 *address = data ^ ((data ^ *(address + lcd_backdrop_offset)) & mask & bits);
324} 315}
325 316
326static void fginvblock(fb_data *address, unsigned mask, unsigned bits) 317static void ICODE_ATTR fginvblock(fb_data *address, unsigned mask,
327 ICODE_ATTR; 318 unsigned bits)
328static void fginvblock(fb_data *address, unsigned mask, unsigned bits)
329{ 319{
330 unsigned data = *address; 320 unsigned data = *address;
331 321
332 *address = data ^ ((data ^ fg_pattern) & mask & ~bits); 322 *address = data ^ ((data ^ fg_pattern) & mask & ~bits);
333} 323}
334 324
335static void solidinvblock(fb_data *address, unsigned mask, unsigned bits) 325static void ICODE_ATTR solidinvblock(fb_data *address, unsigned mask,
336 ICODE_ATTR; 326 unsigned bits)
337static void solidinvblock(fb_data *address, unsigned mask, unsigned bits)
338{ 327{
339 unsigned data = *address; 328 unsigned data = *address;
340 unsigned fgp = fg_pattern; 329 unsigned fgp = fg_pattern;
@@ -343,9 +332,8 @@ static void solidinvblock(fb_data *address, unsigned mask, unsigned bits)
343 *address = data ^ ((data ^ bits) & mask); 332 *address = data ^ ((data ^ bits) & mask);
344} 333}
345 334
346static void solidimginvblock(fb_data *address, unsigned mask, unsigned bits) 335static void ICODE_ATTR solidimginvblock(fb_data *address, unsigned mask,
347 ICODE_ATTR; 336 unsigned bits)
348static void solidimginvblock(fb_data *address, unsigned mask, unsigned bits)
349{ 337{
350 unsigned data = *address; 338 unsigned data = *address;
351 unsigned fgp = fg_pattern; 339 unsigned fgp = fg_pattern;
@@ -463,7 +451,19 @@ void lcd_drawline(int x1, int y1, int x2, int y2)
463 lcd_pixelfunc_type *pfunc = lcd_pixelfuncs[current_vp->drawmode]; 451 lcd_pixelfunc_type *pfunc = lcd_pixelfuncs[current_vp->drawmode];
464 452
465 deltax = abs(x2 - x1); 453 deltax = abs(x2 - x1);
454 if (deltax == 0)
455 {
456 DEBUGF("lcd_drawline() called for vertical line - optimisation.\n");
457 lcd_vline(x1, y1, y2);
458 return;
459 }
466 deltay = abs(y2 - y1); 460 deltay = abs(y2 - y1);
461 if (deltay == 0)
462 {
463 DEBUGF("lcd_drawline() called for horizontal line - optimisation.\n");
464 lcd_hline(x1, x2, y1);
465 return;
466 }
467 xinc2 = 1; 467 xinc2 = 1;
468 yinc2 = 1; 468 yinc2 = 1;
469 469
@@ -729,11 +729,9 @@ void lcd_fillrect(int x, int y, int width, int height)
729 * This is similar to the internal lcd hw format. */ 729 * This is similar to the internal lcd hw format. */
730 730
731/* Draw a partial monochrome bitmap */ 731/* Draw a partial monochrome bitmap */
732void lcd_mono_bitmap_part(const unsigned char *src, int src_x, int src_y, 732void ICODE_ATTR lcd_mono_bitmap_part(const unsigned char *src, int src_x,
733 int stride, int x, int y, int width, int height) 733 int src_y, int stride, int x, int y,
734 ICODE_ATTR; 734 int width, int height)
735void lcd_mono_bitmap_part(const unsigned char *src, int src_x, int src_y,
736 int stride, int x, int y, int width, int height)
737{ 735{
738 int shift, ny; 736 int shift, ny;
739 fb_data *dst, *dst_end; 737 fb_data *dst, *dst_end;
@@ -901,11 +899,9 @@ void lcd_mono_bitmap(const unsigned char *src, int x, int y, int width, int heig
901 * This is the same as the internal lcd hw format. */ 899 * This is the same as the internal lcd hw format. */
902 900
903/* Draw a partial native bitmap */ 901/* Draw a partial native bitmap */
904void lcd_bitmap_part(const fb_data *src, int src_x, int src_y, 902void ICODE_ATTR lcd_bitmap_part(const fb_data *src, int src_x, int src_y,
905 int stride, int x, int y, int width, int height) 903 int stride, int x, int y, int width,
906 ICODE_ATTR; 904 int height)
907void lcd_bitmap_part(const fb_data *src, int src_x, int src_y,
908 int stride, int x, int y, int width, int height)
909{ 905{
910 int shift, ny; 906 int shift, ny;
911 fb_data *dst, *dst_end; 907 fb_data *dst, *dst_end;
diff --git a/firmware/drivers/lcd-2bit-vi.c b/firmware/drivers/lcd-2bit-vi.c
index 0878258e84..7d97f19174 100644
--- a/firmware/drivers/lcd-2bit-vi.c
+++ b/firmware/drivers/lcd-2bit-vi.c
@@ -39,6 +39,7 @@
39#define LCDFN(fn) lcd_ ## fn 39#define LCDFN(fn) lcd_ ## fn
40#define FBFN(fn) fb_ ## fn 40#define FBFN(fn) fb_ ## fn
41#define LCDM(ma) LCD_ ## ma 41#define LCDM(ma) LCD_ ## ma
42#define LCDNAME "lcd_"
42#define MAIN_LCD 43#define MAIN_LCD
43#endif 44#endif
44 45
@@ -476,7 +477,19 @@ void LCDFN(drawline)(int x1, int y1, int x2, int y2)
476 LCDFN(pixelfunc_type) *pfunc = LCDFN(pixelfuncs)[current_vp->drawmode]; 477 LCDFN(pixelfunc_type) *pfunc = LCDFN(pixelfuncs)[current_vp->drawmode];
477 478
478 deltax = abs(x2 - x1); 479 deltax = abs(x2 - x1);
480 if (deltax == 0)
481 {
482 DEBUGF(LCDNAME "drawline() called for vertical line - optimisation.\n");
483 LCDFN(vline)(x1, y1, y2);
484 return;
485 }
479 deltay = abs(y2 - y1); 486 deltay = abs(y2 - y1);
487 if (deltay == 0)
488 {
489 DEBUGF(LCDNAME "drawline() called for horizontal line - optimisation.\n");
490 LCDFN(hline)(x1, x2, y1);
491 return;
492 }
480 xinc2 = 1; 493 xinc2 = 1;
481 yinc2 = 1; 494 yinc2 = 1;
482 495
diff --git a/firmware/drivers/lcd-remote-1bit-v.c b/firmware/drivers/lcd-remote-1bit-v.c
index bed7cc6671..8e6898a8a2 100644
--- a/firmware/drivers/lcd-remote-1bit-v.c
+++ b/firmware/drivers/lcd-remote-1bit-v.c
@@ -23,5 +23,6 @@
23#define LCDFN(fn) lcd_remote_ ## fn 23#define LCDFN(fn) lcd_remote_ ## fn
24#define FBFN(fn) fb_remote_ ## fn 24#define FBFN(fn) fb_remote_ ## fn
25#define LCDM(ma) LCD_REMOTE_ ## ma 25#define LCDM(ma) LCD_REMOTE_ ## ma
26#define LCDNAME "lcd_remote_"
26 27
27#include "lcd-1bit-vert.c" 28#include "lcd-1bit-vert.c"
diff --git a/firmware/drivers/lcd-remote-2bit-vi.c b/firmware/drivers/lcd-remote-2bit-vi.c
index d2440a6296..d050143468 100644
--- a/firmware/drivers/lcd-remote-2bit-vi.c
+++ b/firmware/drivers/lcd-remote-2bit-vi.c
@@ -25,5 +25,6 @@
25#define LCDFN(fn) lcd_remote_ ## fn 25#define LCDFN(fn) lcd_remote_ ## fn
26#define FBFN(fn) fb_remote_ ## fn 26#define FBFN(fn) fb_remote_ ## fn
27#define LCDM(ma) LCD_REMOTE_ ## ma 27#define LCDM(ma) LCD_REMOTE_ ## ma
28#define LCDNAME "lcd_remote_"
28 29
29#include "lcd-2bit-vi.c" 30#include "lcd-2bit-vi.c"