1
0
Fork 0
forked from len0rd/rockbox

Color targets: Ported assembler optimised transparent bitmap drawing from Gigabeat S/F/X to all ARM targets (~23..40% speedup). * C optimised transparent bitmap drawing for non-ARM targets and sims. * Use the more compact boundary checking for non-transparent native bitmap drawing as well.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23353 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Jens Arnold 2009-10-26 01:35:31 +00:00
parent dd0afc5aa2
commit 5365cbe0a5
3 changed files with 80 additions and 167 deletions

View file

@ -146,69 +146,6 @@ void lcd_update(void)
LCD_WIDTH*LCD_HEIGHT, 1);
}
void lcd_bitmap_transparent_part(const fb_data *src, int src_x, int src_y,
int stride, int x, int y, int width,
int height)
{
int w, px;
fb_data *dst;
if (x + width > current_vp->width)
width = current_vp->width - x; /* Clip right */
if (x < 0) /* Clip left */
{
width += x;
src_x -= x;
x = 0;
}
if (width <= 0)
return; /* nothing left to do */
if (y + height > current_vp->height)
height = current_vp->height - y; /* Clip bottom */
if (y < 0) /* Clip top */
{
height += y;
src_y -= y;
y = 0;
}
if (height <= 0)
return; /* nothing left to do */
src += stride * src_y + src_x; /* move starting point */
dst = &lcd_framebuffer[current_vp->y+y][current_vp->x+x];
asm volatile (
".rowstart: \r\n"
"mov %[w], %[width] \r\n" /* Load width for inner loop */
".nextpixel: \r\n"
"ldrh %[px], [%[s]], #2 \r\n" /* Load src pixel */
"add %[d], %[d], #2 \r\n" /* Uncoditionally increment dst */
"cmp %[px], %[fgcolor] \r\n" /* Compare to foreground color */
"streqh %[fgpat], [%[d], #-2] \r\n" /* Store foregroud if match */
"cmpne %[px], %[transcolor] \r\n" /* Compare to transparent color */
"strneh %[px], [%[d], #-2] \r\n" /* Store dst if not transparent */
"subs %[w], %[w], #1 \r\n" /* Width counter has run down? */
"bgt .nextpixel \r\n" /* More in this row? */
"add %[s], %[s], %[sstp], lsl #1 \r\n" /* Skip over to start of next line */
"add %[d], %[d], %[dstp], lsl #1 \r\n"
"subs %[h], %[h], #1 \r\n" /* Height counter has run down? */
"bgt .rowstart \r\n" /* More rows? */
: [w]"=&r"(w), [h]"+&r"(height), [px]"=&r"(px),
[s]"+&r"(src), [d]"+&r"(dst)
: [width]"r"(width),
[sstp]"r"(stride - width),
[dstp]"r"(LCD_WIDTH - width),
[transcolor]"r"(TRANSPARENT_COLOR),
[fgcolor]"r"(REPLACEWITHFG_COLOR),
[fgpat]"r"(current_vp->fg_pattern)
);
}
void lcd_yuv_set_options(unsigned options)
{
lcd_yuv_options = options;