summaryrefslogtreecommitdiff
path: root/firmware/drivers/lcd-h100.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/drivers/lcd-h100.c')
-rw-r--r--firmware/drivers/lcd-h100.c32
1 files changed, 24 insertions, 8 deletions
diff --git a/firmware/drivers/lcd-h100.c b/firmware/drivers/lcd-h100.c
index 929a4fa301..3d858e2271 100644
--- a/firmware/drivers/lcd-h100.c
+++ b/firmware/drivers/lcd-h100.c
@@ -339,41 +339,57 @@ lcd_pixelfunc_type* lcd_pixelfuncs[8] = {
339}; 339};
340 340
341static void flipblock(unsigned char *address, unsigned mask, unsigned bits) 341static void flipblock(unsigned char *address, unsigned mask, unsigned bits)
342 __attribute__ ((section(".icode")));
343static void flipblock(unsigned char *address, unsigned mask, unsigned bits)
342{ 344{
343 *address ^= (bits & mask); 345 *address ^= (bits & mask);
344} 346}
345 347
346static void bgblock(unsigned char *address, unsigned mask, unsigned bits) 348static void bgblock(unsigned char *address, unsigned mask, unsigned bits)
349 __attribute__ ((section(".icode")));
350static void bgblock(unsigned char *address, unsigned mask, unsigned bits)
347{ 351{
348 *address &= (bits | ~mask); 352 *address &= (bits | ~mask);
349} 353}
350 354
351static void fgblock(unsigned char *address, unsigned mask, unsigned bits) 355static void fgblock(unsigned char *address, unsigned mask, unsigned bits)
356 __attribute__ ((section(".icode")));
357static void fgblock(unsigned char *address, unsigned mask, unsigned bits)
352{ 358{
353 *address |= (bits & mask); 359 *address |= (bits & mask);
354} 360}
355 361
356static void solidblock(unsigned char *address, unsigned mask, unsigned bits) 362static void solidblock(unsigned char *address, unsigned mask, unsigned bits)
363 __attribute__ ((section(".icode")));
364static void solidblock(unsigned char *address, unsigned mask, unsigned bits)
357{ 365{
358 *address = (*address & ~mask) | (bits & mask); 366 *address = (*address & ~mask) | (bits & mask);
359} 367}
360 368
361static void flipinvblock(unsigned char *address, unsigned mask, unsigned bits) 369static void flipinvblock(unsigned char *address, unsigned mask, unsigned bits)
370 __attribute__ ((section(".icode")));
371static void flipinvblock(unsigned char *address, unsigned mask, unsigned bits)
362{ 372{
363 *address ^= (~bits & mask); 373 *address ^= (~bits & mask);
364} 374}
365 375
366static void bginvblock(unsigned char *address, unsigned mask, unsigned bits) 376static void bginvblock(unsigned char *address, unsigned mask, unsigned bits)
377 __attribute__ ((section(".icode")));
378static void bginvblock(unsigned char *address, unsigned mask, unsigned bits)
367{ 379{
368 *address &= ~(bits & mask); 380 *address &= ~(bits & mask);
369} 381}
370 382
371static void fginvblock(unsigned char *address, unsigned mask, unsigned bits) 383static void fginvblock(unsigned char *address, unsigned mask, unsigned bits)
384 __attribute__ ((section(".icode")));
385static void fginvblock(unsigned char *address, unsigned mask, unsigned bits)
372{ 386{
373 *address |= (~bits & mask); 387 *address |= (~bits & mask);
374} 388}
375 389
376static void solidinvblock(unsigned char *address, unsigned mask, unsigned bits) 390static void solidinvblock(unsigned char *address, unsigned mask, unsigned bits)
391 __attribute__ ((section(".icode")));
392static void solidinvblock(unsigned char *address, unsigned mask, unsigned bits)
377{ 393{
378 *address = (*address & ~mask) | (~bits & mask); 394 *address = (*address & ~mask) | (~bits & mask);
379} 395}
@@ -544,8 +560,8 @@ void lcd_vline(int x, int y1, int y2)
544 dst += LCD_WIDTH; 560 dst += LCD_WIDTH;
545 mask = 0xFFu; 561 mask = 0xFFu;
546 } 562 }
547 mask_bottom &= mask; 563 mask &= mask_bottom;
548 bfunc(dst, mask_bottom, 0xFFu); 564 bfunc(dst, mask, 0xFFu);
549} 565}
550 566
551/* Draw a rectangular box */ 567/* Draw a rectangular box */
@@ -619,14 +635,14 @@ void lcd_fillrect(int x, int y, int width, int height)
619 dst += LCD_WIDTH; 635 dst += LCD_WIDTH;
620 mask = 0xFFu; 636 mask = 0xFFu;
621 } 637 }
622 mask_bottom &= mask; 638 mask &= mask_bottom;
623 639
624 if (fillopt && (mask_bottom == 0xFFu)) 640 if (fillopt && (mask == 0xFFu))
625 memset(dst, bits, width); 641 memset(dst, bits, width);
626 else 642 else
627 { 643 {
628 for (i = width; i > 0; i--) 644 for (i = width; i > 0; i--)
629 bfunc(dst++, mask_bottom, 0xFFu); 645 bfunc(dst++, mask, 0xFFu);
630 } 646 }
631} 647}
632 648
@@ -708,14 +724,14 @@ void lcd_bitmap_part(const unsigned char *src, int src_x, int src_y,
708 dst += LCD_WIDTH; 724 dst += LCD_WIDTH;
709 mask = 0xFFu; 725 mask = 0xFFu;
710 } 726 }
711 mask_bottom &= mask; 727 mask &= mask_bottom;
712 728
713 if (copyopt && (mask_bottom == 0xFFu)) 729 if (copyopt && (mask == 0xFFu))
714 memcpy(dst, src, width); 730 memcpy(dst, src, width);
715 else 731 else
716 { 732 {
717 for (i = width; i > 0; i--) 733 for (i = width; i > 0; i--)
718 bfunc(dst++, mask_bottom, *src++); 734 bfunc(dst++, mask, *src++);
719 } 735 }
720 } 736 }
721 else 737 else