forked from len0rd/rockbox
Gigabeat: Squeeze down lcd_bitmap_transparent_part a bit. Let the compiler choose the registers.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13829 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
4b1cf3ea44
commit
2e6723bcd2
1 changed files with 25 additions and 22 deletions
|
@ -201,8 +201,8 @@ void lcd_bitmap_transparent_part(const fb_data *src, int src_x, int src_y,
|
||||||
int stride, int x, int y, int width,
|
int stride, int x, int y, int width,
|
||||||
int height)
|
int height)
|
||||||
{
|
{
|
||||||
fb_data *dst, *dst_end;
|
int w, px;
|
||||||
unsigned int transcolor;
|
fb_data *dst;
|
||||||
|
|
||||||
if (x + width > LCD_WIDTH)
|
if (x + width > LCD_WIDTH)
|
||||||
width = LCD_WIDTH - x; /* Clip right */
|
width = LCD_WIDTH - x; /* Clip right */
|
||||||
|
@ -219,26 +219,29 @@ void lcd_bitmap_transparent_part(const fb_data *src, int src_x, int src_y,
|
||||||
return; /* nothing left to do */
|
return; /* nothing left to do */
|
||||||
|
|
||||||
src += stride * src_y + src_x; /* move starting point */
|
src += stride * src_y + src_x; /* move starting point */
|
||||||
dst = &lcd_framebuffer[(y)][(x)];
|
dst = &lcd_framebuffer[y][x];
|
||||||
dst_end = dst + height * LCD_WIDTH;
|
|
||||||
width *= 2;
|
asm volatile (
|
||||||
stride *= 2;
|
".rowstart: \r\n"
|
||||||
transcolor = TRANSPARENT_COLOR;
|
"mov %[w], %[width] \r\n" /* Load width for inner loop */
|
||||||
asm volatile(
|
".nextpixel: \r\n"
|
||||||
"rowstart: \n"
|
"ldrh %[px], [%[s]], #2 \r\n" /* Load src pixel */
|
||||||
"mov r0, #0 \n"
|
"add %[d], %[d], #2 \r\n" /* Uncoditionally increment dst */
|
||||||
"nextpixel: \n"
|
"cmp %[px], %[transcolor] \r\n" /* Compare to transparent color */
|
||||||
"ldrh r1, [%0, r0] \n" /* Load word src+r0 */
|
"strneh %[px], [%[d], #-2] \r\n" /* Store dst if not transparent */
|
||||||
"cmp r1, %5 \n" /* Compare to transparent color */
|
"subs %[w], %[w], #1 \r\n" /* Width counter has run down? */
|
||||||
"strneh r1, [%1, r0] \n" /* Store dst+r0 if not transparent */
|
"bgt .nextpixel \r\n" /* More in this row? */
|
||||||
"add r0, r0, #2 \n"
|
"add %[s], %[s], %[sstp], lsl #1 \r\n" /* Skip over to start of next line */
|
||||||
"cmp r0, %2 \n" /* r0 == width? */
|
"add %[d], %[d], %[dstp], lsl #1 \r\n"
|
||||||
"bne nextpixel \n" /* More in this row? */
|
"subs %[h], %[h], #1 \r\n" /* Height counter has run down? */
|
||||||
"add %0, %0, %4 \n" /* src += stride */
|
"bgt .rowstart \r\n" /* More rows? */
|
||||||
"add %1, %1, #480 \n" /* dst += LCD_WIDTH (x2) */
|
: [w]"=&r"(w), [h]"+&r"(height), [px]"=&r"(px),
|
||||||
"cmp %1, %3 \n"
|
[s]"+&r"(src), [d]"+&r"(dst)
|
||||||
"bne rowstart \n" /* if(dst != dst_end), keep going */
|
: [width]"r"(width),
|
||||||
: : "r" (src), "r" (dst), "r" (width), "r" (dst_end), "r" (stride), "r" (transcolor) : "r0", "r1" );
|
[sstp]"r"(stride - width),
|
||||||
|
[dstp]"r"(LCD_WIDTH - width),
|
||||||
|
[transcolor]"r"(TRANSPARENT_COLOR)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Line write helper function for lcd_yuv_blit. Write two lines of yuv420. */
|
/* Line write helper function for lcd_yuv_blit. Write two lines of yuv420. */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue