1
0
Fork 0
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:
Michael Sevakis 2007-07-09 03:53:12 +00:00
parent 4b1cf3ea44
commit 2e6723bcd2

View file

@ -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;
stride *= 2;
transcolor = TRANSPARENT_COLOR;
asm volatile ( asm volatile (
"rowstart: \n" ".rowstart: \r\n"
"mov r0, #0 \n" "mov %[w], %[width] \r\n" /* Load width for inner loop */
"nextpixel: \n" ".nextpixel: \r\n"
"ldrh r1, [%0, r0] \n" /* Load word src+r0 */ "ldrh %[px], [%[s]], #2 \r\n" /* Load src pixel */
"cmp r1, %5 \n" /* Compare to transparent color */ "add %[d], %[d], #2 \r\n" /* Uncoditionally increment dst */
"strneh r1, [%1, r0] \n" /* Store dst+r0 if not transparent */ "cmp %[px], %[transcolor] \r\n" /* Compare to transparent color */
"add r0, r0, #2 \n" "strneh %[px], [%[d], #-2] \r\n" /* Store dst if not transparent */
"cmp r0, %2 \n" /* r0 == width? */ "subs %[w], %[w], #1 \r\n" /* Width counter has run down? */
"bne nextpixel \n" /* More in this row? */ "bgt .nextpixel \r\n" /* More in this row? */
"add %0, %0, %4 \n" /* src += stride */ "add %[s], %[s], %[sstp], lsl #1 \r\n" /* Skip over to start of next line */
"add %1, %1, #480 \n" /* dst += LCD_WIDTH (x2) */ "add %[d], %[d], %[dstp], lsl #1 \r\n"
"cmp %1, %3 \n" "subs %[h], %[h], #1 \r\n" /* Height counter has run down? */
"bne rowstart \n" /* if(dst != dst_end), keep going */ "bgt .rowstart \r\n" /* More rows? */
: : "r" (src), "r" (dst), "r" (width), "r" (dst_end), "r" (stride), "r" (transcolor) : "r0", "r1" ); : [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)
);
} }
/* 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. */