diff options
author | Jens Arnold <amiconn@rockbox.org> | 2005-06-30 18:42:24 +0000 |
---|---|---|
committer | Jens Arnold <amiconn@rockbox.org> | 2005-06-30 18:42:24 +0000 |
commit | a142d4d79fe84dd4e75f3cb01d25e4cee945036b (patch) | |
tree | 376eaba480f295f6fde5976ded9792bd5e6b57a9 /firmware/drivers | |
parent | 3b90707fdd85a4b21258f6e11f10e15e0f668e3d (diff) | |
download | rockbox-a142d4d79fe84dd4e75f3cb01d25e4cee945036b.tar.gz rockbox-a142d4d79fe84dd4e75f3cb01d25e4cee945036b.zip |
Graphics: Lowlevel block function are in IRAM now as they're called often. Switched the masking logic for better readability. Draw modes and lowlevel function types are now defined for all platforms.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6952 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/drivers')
-rw-r--r-- | firmware/drivers/lcd-h100-remote.c | 32 | ||||
-rw-r--r-- | firmware/drivers/lcd-h100.c | 32 | ||||
-rw-r--r-- | firmware/drivers/lcd-recorder.c | 32 |
3 files changed, 72 insertions, 24 deletions
diff --git a/firmware/drivers/lcd-h100-remote.c b/firmware/drivers/lcd-h100-remote.c index bdc5799726..8112aecdb1 100644 --- a/firmware/drivers/lcd-h100-remote.c +++ b/firmware/drivers/lcd-h100-remote.c | |||
@@ -500,41 +500,57 @@ lcd_pixelfunc_type* lcd_remote_pixelfuncs[8] = { | |||
500 | }; | 500 | }; |
501 | 501 | ||
502 | static void flipblock(unsigned char *address, unsigned mask, unsigned bits) | 502 | static void flipblock(unsigned char *address, unsigned mask, unsigned bits) |
503 | __attribute__ ((section(".icode"))); | ||
504 | static void flipblock(unsigned char *address, unsigned mask, unsigned bits) | ||
503 | { | 505 | { |
504 | *address ^= (bits & mask); | 506 | *address ^= (bits & mask); |
505 | } | 507 | } |
506 | 508 | ||
507 | static void bgblock(unsigned char *address, unsigned mask, unsigned bits) | 509 | static void bgblock(unsigned char *address, unsigned mask, unsigned bits) |
510 | __attribute__ ((section(".icode"))); | ||
511 | static void bgblock(unsigned char *address, unsigned mask, unsigned bits) | ||
508 | { | 512 | { |
509 | *address &= (bits | ~mask); | 513 | *address &= (bits | ~mask); |
510 | } | 514 | } |
511 | 515 | ||
512 | static void fgblock(unsigned char *address, unsigned mask, unsigned bits) | 516 | static void fgblock(unsigned char *address, unsigned mask, unsigned bits) |
517 | __attribute__ ((section(".icode"))); | ||
518 | static void fgblock(unsigned char *address, unsigned mask, unsigned bits) | ||
513 | { | 519 | { |
514 | *address |= (bits & mask); | 520 | *address |= (bits & mask); |
515 | } | 521 | } |
516 | 522 | ||
517 | static void solidblock(unsigned char *address, unsigned mask, unsigned bits) | 523 | static void solidblock(unsigned char *address, unsigned mask, unsigned bits) |
524 | __attribute__ ((section(".icode"))); | ||
525 | static void solidblock(unsigned char *address, unsigned mask, unsigned bits) | ||
518 | { | 526 | { |
519 | *address = (*address & ~mask) | (bits & mask); | 527 | *address = (*address & ~mask) | (bits & mask); |
520 | } | 528 | } |
521 | 529 | ||
522 | static void flipinvblock(unsigned char *address, unsigned mask, unsigned bits) | 530 | static void flipinvblock(unsigned char *address, unsigned mask, unsigned bits) |
531 | __attribute__ ((section(".icode"))); | ||
532 | static void flipinvblock(unsigned char *address, unsigned mask, unsigned bits) | ||
523 | { | 533 | { |
524 | *address ^= (~bits & mask); | 534 | *address ^= (~bits & mask); |
525 | } | 535 | } |
526 | 536 | ||
527 | static void bginvblock(unsigned char *address, unsigned mask, unsigned bits) | 537 | static void bginvblock(unsigned char *address, unsigned mask, unsigned bits) |
538 | __attribute__ ((section(".icode"))); | ||
539 | static void bginvblock(unsigned char *address, unsigned mask, unsigned bits) | ||
528 | { | 540 | { |
529 | *address &= ~(bits & mask); | 541 | *address &= ~(bits & mask); |
530 | } | 542 | } |
531 | 543 | ||
532 | static void fginvblock(unsigned char *address, unsigned mask, unsigned bits) | 544 | static void fginvblock(unsigned char *address, unsigned mask, unsigned bits) |
545 | __attribute__ ((section(".icode"))); | ||
546 | static void fginvblock(unsigned char *address, unsigned mask, unsigned bits) | ||
533 | { | 547 | { |
534 | *address |= (~bits & mask); | 548 | *address |= (~bits & mask); |
535 | } | 549 | } |
536 | 550 | ||
537 | static void solidinvblock(unsigned char *address, unsigned mask, unsigned bits) | 551 | static void solidinvblock(unsigned char *address, unsigned mask, unsigned bits) |
552 | __attribute__ ((section(".icode"))); | ||
553 | static void solidinvblock(unsigned char *address, unsigned mask, unsigned bits) | ||
538 | { | 554 | { |
539 | *address = (*address & ~mask) | (~bits & mask); | 555 | *address = (*address & ~mask) | (~bits & mask); |
540 | } | 556 | } |
@@ -707,8 +723,8 @@ void lcd_remote_vline(int x, int y1, int y2) | |||
707 | dst += LCD_REMOTE_WIDTH; | 723 | dst += LCD_REMOTE_WIDTH; |
708 | mask = 0xFFu; | 724 | mask = 0xFFu; |
709 | } | 725 | } |
710 | mask_bottom &= mask; | 726 | mask &= mask_bottom; |
711 | bfunc(dst, mask_bottom, 0xFFu); | 727 | bfunc(dst, mask, 0xFFu); |
712 | } | 728 | } |
713 | 729 | ||
714 | /* Draw a rectangular box */ | 730 | /* Draw a rectangular box */ |
@@ -782,14 +798,14 @@ void lcd_remote_fillrect(int x, int y, int width, int height) | |||
782 | dst += LCD_REMOTE_WIDTH; | 798 | dst += LCD_REMOTE_WIDTH; |
783 | mask = 0xFFu; | 799 | mask = 0xFFu; |
784 | } | 800 | } |
785 | mask_bottom &= mask; | 801 | mask &= mask_bottom; |
786 | 802 | ||
787 | if (fillopt && (mask_bottom == 0xFFu)) | 803 | if (fillopt && (mask == 0xFFu)) |
788 | memset(dst, bits, width); | 804 | memset(dst, bits, width); |
789 | else | 805 | else |
790 | { | 806 | { |
791 | for (i = width; i > 0; i--) | 807 | for (i = width; i > 0; i--) |
792 | bfunc(dst++, mask_bottom, 0xFFu); | 808 | bfunc(dst++, mask, 0xFFu); |
793 | } | 809 | } |
794 | } | 810 | } |
795 | 811 | ||
@@ -871,14 +887,14 @@ void lcd_remote_bitmap_part(const unsigned char *src, int src_x, int src_y, | |||
871 | dst += LCD_REMOTE_WIDTH; | 887 | dst += LCD_REMOTE_WIDTH; |
872 | mask = 0xFFu; | 888 | mask = 0xFFu; |
873 | } | 889 | } |
874 | mask_bottom &= mask; | 890 | mask &= mask_bottom; |
875 | 891 | ||
876 | if (copyopt && (mask_bottom == 0xFFu)) | 892 | if (copyopt && (mask == 0xFFu)) |
877 | memcpy(dst, src, width); | 893 | memcpy(dst, src, width); |
878 | else | 894 | else |
879 | { | 895 | { |
880 | for (i = width; i > 0; i--) | 896 | for (i = width; i > 0; i--) |
881 | bfunc(dst++, mask_bottom, *src++); | 897 | bfunc(dst++, mask, *src++); |
882 | } | 898 | } |
883 | } | 899 | } |
884 | else | 900 | else |
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 | ||
341 | static void flipblock(unsigned char *address, unsigned mask, unsigned bits) | 341 | static void flipblock(unsigned char *address, unsigned mask, unsigned bits) |
342 | __attribute__ ((section(".icode"))); | ||
343 | static void flipblock(unsigned char *address, unsigned mask, unsigned bits) | ||
342 | { | 344 | { |
343 | *address ^= (bits & mask); | 345 | *address ^= (bits & mask); |
344 | } | 346 | } |
345 | 347 | ||
346 | static void bgblock(unsigned char *address, unsigned mask, unsigned bits) | 348 | static void bgblock(unsigned char *address, unsigned mask, unsigned bits) |
349 | __attribute__ ((section(".icode"))); | ||
350 | static void bgblock(unsigned char *address, unsigned mask, unsigned bits) | ||
347 | { | 351 | { |
348 | *address &= (bits | ~mask); | 352 | *address &= (bits | ~mask); |
349 | } | 353 | } |
350 | 354 | ||
351 | static void fgblock(unsigned char *address, unsigned mask, unsigned bits) | 355 | static void fgblock(unsigned char *address, unsigned mask, unsigned bits) |
356 | __attribute__ ((section(".icode"))); | ||
357 | static void fgblock(unsigned char *address, unsigned mask, unsigned bits) | ||
352 | { | 358 | { |
353 | *address |= (bits & mask); | 359 | *address |= (bits & mask); |
354 | } | 360 | } |
355 | 361 | ||
356 | static void solidblock(unsigned char *address, unsigned mask, unsigned bits) | 362 | static void solidblock(unsigned char *address, unsigned mask, unsigned bits) |
363 | __attribute__ ((section(".icode"))); | ||
364 | static 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 | ||
361 | static void flipinvblock(unsigned char *address, unsigned mask, unsigned bits) | 369 | static void flipinvblock(unsigned char *address, unsigned mask, unsigned bits) |
370 | __attribute__ ((section(".icode"))); | ||
371 | static void flipinvblock(unsigned char *address, unsigned mask, unsigned bits) | ||
362 | { | 372 | { |
363 | *address ^= (~bits & mask); | 373 | *address ^= (~bits & mask); |
364 | } | 374 | } |
365 | 375 | ||
366 | static void bginvblock(unsigned char *address, unsigned mask, unsigned bits) | 376 | static void bginvblock(unsigned char *address, unsigned mask, unsigned bits) |
377 | __attribute__ ((section(".icode"))); | ||
378 | static void bginvblock(unsigned char *address, unsigned mask, unsigned bits) | ||
367 | { | 379 | { |
368 | *address &= ~(bits & mask); | 380 | *address &= ~(bits & mask); |
369 | } | 381 | } |
370 | 382 | ||
371 | static void fginvblock(unsigned char *address, unsigned mask, unsigned bits) | 383 | static void fginvblock(unsigned char *address, unsigned mask, unsigned bits) |
384 | __attribute__ ((section(".icode"))); | ||
385 | static void fginvblock(unsigned char *address, unsigned mask, unsigned bits) | ||
372 | { | 386 | { |
373 | *address |= (~bits & mask); | 387 | *address |= (~bits & mask); |
374 | } | 388 | } |
375 | 389 | ||
376 | static void solidinvblock(unsigned char *address, unsigned mask, unsigned bits) | 390 | static void solidinvblock(unsigned char *address, unsigned mask, unsigned bits) |
391 | __attribute__ ((section(".icode"))); | ||
392 | static 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 |
diff --git a/firmware/drivers/lcd-recorder.c b/firmware/drivers/lcd-recorder.c index 6747f7fcd3..f933e6ca5c 100644 --- a/firmware/drivers/lcd-recorder.c +++ b/firmware/drivers/lcd-recorder.c | |||
@@ -396,41 +396,57 @@ lcd_pixelfunc_type* lcd_pixelfuncs[8] = { | |||
396 | }; | 396 | }; |
397 | 397 | ||
398 | static void flipblock(unsigned char *address, unsigned mask, unsigned bits) | 398 | static void flipblock(unsigned char *address, unsigned mask, unsigned bits) |
399 | __attribute__ ((section(".icode"))); | ||
400 | static void flipblock(unsigned char *address, unsigned mask, unsigned bits) | ||
399 | { | 401 | { |
400 | *address ^= (bits & mask); | 402 | *address ^= (bits & mask); |
401 | } | 403 | } |
402 | 404 | ||
403 | static void bgblock(unsigned char *address, unsigned mask, unsigned bits) | 405 | static void bgblock(unsigned char *address, unsigned mask, unsigned bits) |
406 | __attribute__ ((section(".icode"))); | ||
407 | static void bgblock(unsigned char *address, unsigned mask, unsigned bits) | ||
404 | { | 408 | { |
405 | *address &= (bits | ~mask); | 409 | *address &= (bits | ~mask); |
406 | } | 410 | } |
407 | 411 | ||
408 | static void fgblock(unsigned char *address, unsigned mask, unsigned bits) | 412 | static void fgblock(unsigned char *address, unsigned mask, unsigned bits) |
413 | __attribute__ ((section(".icode"))); | ||
414 | static void fgblock(unsigned char *address, unsigned mask, unsigned bits) | ||
409 | { | 415 | { |
410 | *address |= (bits & mask); | 416 | *address |= (bits & mask); |
411 | } | 417 | } |
412 | 418 | ||
413 | static void solidblock(unsigned char *address, unsigned mask, unsigned bits) | 419 | static void solidblock(unsigned char *address, unsigned mask, unsigned bits) |
420 | __attribute__ ((section(".icode"))); | ||
421 | static void solidblock(unsigned char *address, unsigned mask, unsigned bits) | ||
414 | { | 422 | { |
415 | *address = (*address & ~mask) | (bits & mask); | 423 | *address = (*address & ~mask) | (bits & mask); |
416 | } | 424 | } |
417 | 425 | ||
418 | static void flipinvblock(unsigned char *address, unsigned mask, unsigned bits) | 426 | static void flipinvblock(unsigned char *address, unsigned mask, unsigned bits) |
427 | __attribute__ ((section(".icode"))); | ||
428 | static void flipinvblock(unsigned char *address, unsigned mask, unsigned bits) | ||
419 | { | 429 | { |
420 | *address ^= (~bits & mask); | 430 | *address ^= (~bits & mask); |
421 | } | 431 | } |
422 | 432 | ||
423 | static void bginvblock(unsigned char *address, unsigned mask, unsigned bits) | 433 | static void bginvblock(unsigned char *address, unsigned mask, unsigned bits) |
434 | __attribute__ ((section(".icode"))); | ||
435 | static void bginvblock(unsigned char *address, unsigned mask, unsigned bits) | ||
424 | { | 436 | { |
425 | *address &= ~(bits & mask); | 437 | *address &= ~(bits & mask); |
426 | } | 438 | } |
427 | 439 | ||
428 | static void fginvblock(unsigned char *address, unsigned mask, unsigned bits) | 440 | static void fginvblock(unsigned char *address, unsigned mask, unsigned bits) |
441 | __attribute__ ((section(".icode"))); | ||
442 | static void fginvblock(unsigned char *address, unsigned mask, unsigned bits) | ||
429 | { | 443 | { |
430 | *address |= (~bits & mask); | 444 | *address |= (~bits & mask); |
431 | } | 445 | } |
432 | 446 | ||
433 | static void solidinvblock(unsigned char *address, unsigned mask, unsigned bits) | 447 | static void solidinvblock(unsigned char *address, unsigned mask, unsigned bits) |
448 | __attribute__ ((section(".icode"))); | ||
449 | static void solidinvblock(unsigned char *address, unsigned mask, unsigned bits) | ||
434 | { | 450 | { |
435 | *address = (*address & ~mask) | (~bits & mask); | 451 | *address = (*address & ~mask) | (~bits & mask); |
436 | } | 452 | } |
@@ -601,8 +617,8 @@ void lcd_vline(int x, int y1, int y2) | |||
601 | dst += LCD_WIDTH; | 617 | dst += LCD_WIDTH; |
602 | mask = 0xFFu; | 618 | mask = 0xFFu; |
603 | } | 619 | } |
604 | mask_bottom &= mask; | 620 | mask &= mask_bottom; |
605 | bfunc(dst, mask_bottom, 0xFFu); | 621 | bfunc(dst, mask, 0xFFu); |
606 | } | 622 | } |
607 | 623 | ||
608 | /* Draw a rectangular box */ | 624 | /* Draw a rectangular box */ |
@@ -676,14 +692,14 @@ void lcd_fillrect(int x, int y, int width, int height) | |||
676 | dst += LCD_WIDTH; | 692 | dst += LCD_WIDTH; |
677 | mask = 0xFFu; | 693 | mask = 0xFFu; |
678 | } | 694 | } |
679 | mask_bottom &= mask; | 695 | mask &= mask_bottom; |
680 | 696 | ||
681 | if (fillopt && (mask_bottom == 0xFFu)) | 697 | if (fillopt && (mask == 0xFFu)) |
682 | memset(dst, bits, width); | 698 | memset(dst, bits, width); |
683 | else | 699 | else |
684 | { | 700 | { |
685 | for (i = width; i > 0; i--) | 701 | for (i = width; i > 0; i--) |
686 | bfunc(dst++, mask_bottom, 0xFFu); | 702 | bfunc(dst++, mask, 0xFFu); |
687 | } | 703 | } |
688 | } | 704 | } |
689 | 705 | ||
@@ -765,14 +781,14 @@ void lcd_bitmap_part(const unsigned char *src, int src_x, int src_y, | |||
765 | dst += LCD_WIDTH; | 781 | dst += LCD_WIDTH; |
766 | mask = 0xFFu; | 782 | mask = 0xFFu; |
767 | } | 783 | } |
768 | mask_bottom &= mask; | 784 | mask &= mask_bottom; |
769 | 785 | ||
770 | if (copyopt && (mask_bottom == 0xFFu)) | 786 | if (copyopt && (mask == 0xFFu)) |
771 | memcpy(dst, src, width); | 787 | memcpy(dst, src, width); |
772 | else | 788 | else |
773 | { | 789 | { |
774 | for (i = width; i > 0; i--) | 790 | for (i = width; i > 0; i--) |
775 | bfunc(dst++, mask_bottom, *src++); | 791 | bfunc(dst++, mask, *src++); |
776 | } | 792 | } |
777 | } | 793 | } |
778 | else | 794 | else |