summaryrefslogtreecommitdiffstats
path: root/firmware/drivers/lcd-16bit-vert.c
diff options
context:
space:
mode:
authorThomas Martitz <kugel@rockbox.org>2011-03-05 20:09:41 +0000
committerThomas Martitz <kugel@rockbox.org>2011-03-05 20:09:41 +0000
commitedea12b21e986a2439bcb8fe786e6ff992a22ca7 (patch)
treee3252cedf2e98077407d5f0774a01d233a1d5f9e /firmware/drivers/lcd-16bit-vert.c
parent222e1ad84591f3aac29dac297924b16eb390f3e7 (diff)
downloadrockbox-edea12b21e986a2439bcb8fe786e6ff992a22ca7.tar.gz
rockbox-edea12b21e986a2439bcb8fe786e6ff992a22ca7.tar.bz2
rockbox-edea12b21e986a2439bcb8fe786e6ff992a22ca7.zip
Add viewport clipping to lcd_alpha_bitmap_part as lcd_mono_bitmap_part also has.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29526 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/drivers/lcd-16bit-vert.c')
-rw-r--r--firmware/drivers/lcd-16bit-vert.c37
1 files changed, 34 insertions, 3 deletions
diff --git a/firmware/drivers/lcd-16bit-vert.c b/firmware/drivers/lcd-16bit-vert.c
index 87a49e1249..552d80c5aa 100644
--- a/firmware/drivers/lcd-16bit-vert.c
+++ b/firmware/drivers/lcd-16bit-vert.c
@@ -998,6 +998,7 @@ void ICODE_ATTR lcd_alpha_bitmap_part(const unsigned char *src, int src_x,
if (y + height > current_vp->height)
height = current_vp->height - y;
+
if (drmode & DRMODE_INVERSEVID)
{
dmask = 0xffffffff;
@@ -1008,7 +1009,37 @@ void ICODE_ATTR lcd_alpha_bitmap_part(const unsigned char *src, int src_x,
dmask = ~dmask;
}
- dst_row = dst = LCDADDR(current_vp->x + x, current_vp->y + y);
+ /* adjust for viewport */
+ x += current_vp->x;
+ y += current_vp->y;
+
+#if defined(HAVE_VIEWPORT_CLIP)
+ /********************* Viewport on screen clipping ********************/
+ /* nothing to draw? */
+ if ((x >= LCD_WIDTH) || (y >= LCD_HEIGHT)
+ || (x + width <= 0) || (y + height <= 0))
+ return;
+
+ /* clip image in viewport in screen */
+ if (x < 0)
+ {
+ width += x;
+ src_x -= x;
+ x = 0;
+ }
+ if (y < 0)
+ {
+ height += y;
+ src_y -= y;
+ y = 0;
+ }
+ if (x + width > LCD_WIDTH)
+ width = LCD_WIDTH - x;
+ if (y + height > LCD_HEIGHT)
+ height = LCD_HEIGHT - y;
+#endif
+
+ dst_row = dst = LCDADDR(x, y);
int col, row = height;
@@ -1035,8 +1066,8 @@ void ICODE_ATTR lcd_alpha_bitmap_part(const unsigned char *src, int src_x,
do
{
col = width;
- dst = dst_row;
- dst_row++;
+ dst = dst_row++;
+
#ifdef ALPHA_BITMAP_READ_WORDS
#define UPDATE_SRC_ALPHA do { \
if (--pixels) \