diff options
author | Jonathan Gordon <rockbox@jdgordon.info> | 2012-12-03 20:43:58 +1100 |
---|---|---|
committer | Jonathan Gordon <rockbox@jdgordon.info> | 2012-12-09 17:11:19 +1100 |
commit | 685cf5900825b10c952f36301abbbd9968567435 (patch) | |
tree | 41cdfed9e5a2943c80ac0d4ffe09c45519a3ecf3 /firmware | |
parent | 1fbdc280d7e4b4ffb7ec8dccbfd1c1fc67f1c123 (diff) | |
download | rockbox-685cf5900825b10c952f36301abbbd9968567435.tar.gz rockbox-685cf5900825b10c952f36301abbbd9968567435.zip |
9 segment bitmap drawing:
Use %x9(id) to draw an image in the whole current viewport using the
9 segment drawer (which draws the corners as normal and *tiles*
the middle segments to the needed width/height).
Future work is to make it scale instead of tile
Change-Id: Ic3ed1cad93f96091694801eb442e0da5a2401203
Diffstat (limited to 'firmware')
-rw-r--r-- | firmware/drivers/lcd-bitmap-common.c | 45 | ||||
-rw-r--r-- | firmware/export/lcd.h | 2 |
2 files changed, 47 insertions, 0 deletions
diff --git a/firmware/drivers/lcd-bitmap-common.c b/firmware/drivers/lcd-bitmap-common.c index 0bae790e58..a149e8aaa9 100644 --- a/firmware/drivers/lcd-bitmap-common.c +++ b/firmware/drivers/lcd-bitmap-common.c | |||
@@ -615,3 +615,48 @@ void LCDFN(bmp)(const struct bitmap* bm, int x, int y) | |||
615 | } | 615 | } |
616 | 616 | ||
617 | #endif | 617 | #endif |
618 | |||
619 | void LCDFN(nine_segment_bmp)(const struct bitmap* bm, int x, int y, | ||
620 | int width, int height) | ||
621 | { | ||
622 | int seg_w = bm->width / 3; | ||
623 | int seg_h = bm->height / 3; | ||
624 | int src_x, src_y, dst_x, dst_y; | ||
625 | |||
626 | /* top */ | ||
627 | src_x = seg_w; src_y = 0; | ||
628 | dst_x = seg_w; dst_y = 0; | ||
629 | for (; dst_x < width - seg_w; dst_x += seg_w) | ||
630 | LCDFN(bmp_part)(bm, src_x, src_y, dst_x, dst_y, seg_w, seg_h); | ||
631 | /* bottom */ | ||
632 | src_x = seg_w; src_y = bm->height - seg_h; | ||
633 | dst_x = seg_w; dst_y = height - seg_h; | ||
634 | for (; dst_x < width - seg_w; dst_x += seg_w) | ||
635 | LCDFN(bmp_part)(bm, src_x, src_y, dst_x, dst_y, seg_w, seg_h); | ||
636 | |||
637 | /* left */ | ||
638 | src_x = 0; src_y = seg_h; | ||
639 | dst_x = 0; dst_y = seg_h; | ||
640 | for (; dst_y < height - seg_h; dst_y += seg_h) | ||
641 | LCDFN(bmp_part)(bm, src_x, src_y, dst_x, dst_y, seg_w, seg_h); | ||
642 | /* right */ | ||
643 | src_x = bm->width - seg_w; src_y = seg_h; | ||
644 | dst_x = width - seg_w; dst_y = seg_h; | ||
645 | for (; dst_y < height - seg_h; dst_y += seg_h) | ||
646 | LCDFN(bmp_part)(bm, src_x, src_y, dst_x, dst_y, seg_w, seg_h); | ||
647 | /* center */ | ||
648 | dst_y = seg_h; src_y = seg_h; src_x = seg_w; | ||
649 | for (; dst_y < height - seg_h; dst_y += seg_h) | ||
650 | { | ||
651 | dst_x = seg_w; | ||
652 | for (; dst_x < width - seg_w; dst_x += seg_w) | ||
653 | LCDFN(bmp_part)(bm, src_x, src_y, dst_x, dst_y, seg_w, seg_h); | ||
654 | } | ||
655 | |||
656 | /* 4 corners */ | ||
657 | LCDFN(bmp_part)(bm, 0, 0, x, y, seg_w, seg_h); | ||
658 | LCDFN(bmp_part)(bm, bm->width - seg_w, 0, width - seg_w, 0, seg_w, seg_h); | ||
659 | LCDFN(bmp_part)(bm, 0, bm->width - seg_h, 0, height - seg_h, seg_w, seg_h); | ||
660 | LCDFN(bmp_part)(bm, bm->width - seg_w, bm->width - seg_h, | ||
661 | width - seg_w, height - seg_h, seg_w, seg_h); | ||
662 | } | ||
diff --git a/firmware/export/lcd.h b/firmware/export/lcd.h index dbb3a781b8..a82c00534d 100644 --- a/firmware/export/lcd.h +++ b/firmware/export/lcd.h | |||
@@ -568,6 +568,8 @@ extern void lcd_bitmap_transparent(const fb_data *src, int x, int y, | |||
568 | extern void lcd_bmp_part(const struct bitmap* bm, int src_x, int src_y, | 568 | extern void lcd_bmp_part(const struct bitmap* bm, int src_x, int src_y, |
569 | int x, int y, int width, int height); | 569 | int x, int y, int width, int height); |
570 | extern void lcd_bmp(const struct bitmap* bm, int x, int y); | 570 | extern void lcd_bmp(const struct bitmap* bm, int x, int y); |
571 | extern void lcd_nine_segment_bmp(const struct bitmap* bm, int x, int y, | ||
572 | int width, int height); | ||
571 | #endif /* HAVE_LCD_BITMAP */ | 573 | #endif /* HAVE_LCD_BITMAP */ |
572 | 574 | ||
573 | 575 | ||