diff options
author | Linus Nielsen Feltzing <linus@haxx.se> | 2006-01-28 23:12:20 +0000 |
---|---|---|
committer | Linus Nielsen Feltzing <linus@haxx.se> | 2006-01-28 23:12:20 +0000 |
commit | 281403a4d839924df41480fc020f401211a6e88b (patch) | |
tree | a9465e88b9f0c660f2080578d1839bd5f4d2ddc7 /firmware/drivers | |
parent | 5947e49f467cdf3cf5d2acfcc3c0bd6f97ab29f7 (diff) | |
download | rockbox-281403a4d839924df41480fc020f401211a6e88b.tar.gz rockbox-281403a4d839924df41480fc020f401211a6e88b.zip |
Work-in-progress transparent bitmaps with 255,0,255 as the transparent color, not yet working on the H100 series
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8476 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/drivers')
-rw-r--r-- | firmware/drivers/lcd-16bit.c | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/firmware/drivers/lcd-16bit.c b/firmware/drivers/lcd-16bit.c index b13e4cee90..4a6348f9db 100644 --- a/firmware/drivers/lcd-16bit.c +++ b/firmware/drivers/lcd-16bit.c | |||
@@ -540,6 +540,64 @@ void lcd_bitmap(const fb_data *src, int x, int y, int width, int height) | |||
540 | lcd_bitmap_part(src, 0, 0, width, x, y, width, height); | 540 | lcd_bitmap_part(src, 0, 0, width, x, y, width, height); |
541 | } | 541 | } |
542 | 542 | ||
543 | /* Draw a partial native bitmap */ | ||
544 | void lcd_bitmap_transparent_part(const fb_data *src, int src_x, int src_y, | ||
545 | int stride, int x, int y, int width, | ||
546 | int height) ICODE_ATTR; | ||
547 | void lcd_bitmap_transparent_part(const fb_data *src, int src_x, int src_y, | ||
548 | int stride, int x, int y, int width, | ||
549 | int height) | ||
550 | { | ||
551 | fb_data *dst, *dst_end; | ||
552 | |||
553 | /* nothing to draw? */ | ||
554 | if ((width <= 0) || (height <= 0) || (x >= LCD_WIDTH) || (y >= LCD_HEIGHT) | ||
555 | || (x + width <= 0) || (y + height <= 0)) | ||
556 | return; | ||
557 | |||
558 | /* clipping */ | ||
559 | if (x < 0) | ||
560 | { | ||
561 | width += x; | ||
562 | src_x -= x; | ||
563 | x = 0; | ||
564 | } | ||
565 | if (y < 0) | ||
566 | { | ||
567 | height += y; | ||
568 | src_y -= y; | ||
569 | y = 0; | ||
570 | } | ||
571 | if (x + width > LCD_WIDTH) | ||
572 | width = LCD_WIDTH - x; | ||
573 | if (y + height > LCD_HEIGHT) | ||
574 | height = LCD_HEIGHT - y; | ||
575 | |||
576 | src += stride * src_y + src_x; /* move starting point */ | ||
577 | dst = LCDADDR(x, y); | ||
578 | dst_end = dst + height * LCD_WIDTH; | ||
579 | |||
580 | do | ||
581 | { | ||
582 | int i; | ||
583 | for(i = 0;i < width;i++) | ||
584 | { | ||
585 | if(src[i] != TRANSPARENT_COLOR) | ||
586 | dst[i] = src[i]; | ||
587 | } | ||
588 | src += stride; | ||
589 | dst += LCD_WIDTH; | ||
590 | } | ||
591 | while (dst < dst_end); | ||
592 | } | ||
593 | |||
594 | /* Draw a full native bitmap with a transparent color */ | ||
595 | void lcd_bitmap_transparent(const fb_data *src, int x, int y, | ||
596 | int width, int height) | ||
597 | { | ||
598 | lcd_bitmap_transparent_part(src, 0, 0, width, x, y, width, height); | ||
599 | } | ||
600 | |||
543 | /* put a string at a given pixel position, skipping first ofs pixel columns */ | 601 | /* put a string at a given pixel position, skipping first ofs pixel columns */ |
544 | static void lcd_putsxyofs(int x, int y, int ofs, const unsigned char *str) | 602 | static void lcd_putsxyofs(int x, int y, int ofs, const unsigned char *str) |
545 | { | 603 | { |