1
0
Fork 0
forked from len0rd/rockbox

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
This commit is contained in:
Thomas Martitz 2011-03-05 20:09:41 +00:00
parent 222e1ad845
commit edea12b21e
2 changed files with 65 additions and 4 deletions

View file

@ -998,6 +998,7 @@ void ICODE_ATTR lcd_alpha_bitmap_part(const unsigned char *src, int src_x,
if (y + height > current_vp->height) if (y + height > current_vp->height)
height = current_vp->height - y; height = current_vp->height - y;
if (drmode & DRMODE_INVERSEVID) if (drmode & DRMODE_INVERSEVID)
{ {
dmask = 0xffffffff; dmask = 0xffffffff;
@ -1008,7 +1009,37 @@ void ICODE_ATTR lcd_alpha_bitmap_part(const unsigned char *src, int src_x,
dmask = ~dmask; 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; int col, row = height;
@ -1035,8 +1066,8 @@ void ICODE_ATTR lcd_alpha_bitmap_part(const unsigned char *src, int src_x,
do do
{ {
col = width; col = width;
dst = dst_row; dst = dst_row++;
dst_row++;
#ifdef ALPHA_BITMAP_READ_WORDS #ifdef ALPHA_BITMAP_READ_WORDS
#define UPDATE_SRC_ALPHA do { \ #define UPDATE_SRC_ALPHA do { \
if (--pixels) \ if (--pixels) \

View file

@ -989,6 +989,36 @@ void ICODE_ATTR lcd_alpha_bitmap_part(const unsigned char *src, int src_x,
if (y + height > current_vp->height) if (y + height > current_vp->height)
height = current_vp->height - y; height = current_vp->height - 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
if (drmode & DRMODE_INVERSEVID) if (drmode & DRMODE_INVERSEVID)
{ {
dmask = 0xffffffff; dmask = 0xffffffff;
@ -999,7 +1029,7 @@ void ICODE_ATTR lcd_alpha_bitmap_part(const unsigned char *src, int src_x,
dmask = ~dmask; dmask = ~dmask;
} }
dst = LCDADDR(current_vp->x + x, current_vp->y + y); dst = LCDADDR(x, y);
int col, row = height; int col, row = height;
unsigned data, pixels; unsigned data, pixels;