summaryrefslogtreecommitdiff
path: root/firmware
diff options
context:
space:
mode:
authorGreg White <gwhite@rockbox.org>2007-01-18 02:29:58 +0000
committerGreg White <gwhite@rockbox.org>2007-01-18 02:29:58 +0000
commit186623e7092be0b7c4cb7b547a7258460b9da621 (patch)
tree5c51ace2c5a95d94ecc2d954fac174d7c439ecb7 /firmware
parent10dfc061631d59ed4800e62be2c4694a9f9ebd7c (diff)
downloadrockbox-186623e7092be0b7c4cb7b547a7258460b9da621.tar.gz
rockbox-186623e7092be0b7c4cb7b547a7258460b9da621.zip
Move mono DRMODE optimizations from Gigabeat to all 16-bit targets
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@12062 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware')
-rw-r--r--firmware/drivers/lcd-16bit.c145
-rw-r--r--firmware/target/arm/gigabeat/meg-fx/lcd-meg-fx.c88
2 files changed, 79 insertions, 154 deletions
diff --git a/firmware/drivers/lcd-16bit.c b/firmware/drivers/lcd-16bit.c
index 54601c43bb..a035ea2d3a 100644
--- a/firmware/drivers/lcd-16bit.c
+++ b/firmware/drivers/lcd-16bit.c
@@ -546,79 +546,92 @@ void lcd_fillrect(int x, int y, int width, int height)
546 546
547/* Draw a partial monochrome bitmap */ 547/* Draw a partial monochrome bitmap */
548 548
549#if !defined(TOSHIBA_GIGABEAT_F) || defined(SIMULATOR)
550void lcd_mono_bitmap_part(const unsigned char *src, int src_x, int src_y, 549void lcd_mono_bitmap_part(const unsigned char *src, int src_x, int src_y,
551 int stride, int x, int y, int width, int height) 550 int stride, int x, int y, int width, int height)
552 ICODE_ATTR; 551 ICODE_ATTR;
553void lcd_mono_bitmap_part(const unsigned char *src, int src_x, int src_y, 552void lcd_mono_bitmap_part(const unsigned char *src, int src_x, int src_y,
554 int stride, int x, int y, int width, int height) 553 int stride, int x, int y, int width, int height)
555{ 554{
556 const unsigned char *src_end; 555 const unsigned char *src_end;
557 fb_data *dst, *dst_end; 556 fb_data *dst, *dst_end;
558 lcd_fastpixelfunc_type *fgfunc; 557
559 lcd_fastpixelfunc_type *bgfunc; 558 /* nothing to draw? */
560 559 if ((width <= 0) || (height <= 0) || (x >= LCD_WIDTH) || (y >= LCD_HEIGHT)
561 /* nothing to draw? */ 560 || (x + width <= 0) || (y + height <= 0))
562 if ((width <= 0) || (height <= 0) || (x >= LCD_WIDTH) || (y >= LCD_HEIGHT) 561 return;
563 || (x + width <= 0) || (y + height <= 0)) 562
564 return; 563 /* clipping */
565 564 if (x < 0)
566 /* clipping */ 565 {
567 if (x < 0) 566 width += x;
568 { 567 src_x -= x;
569 width += x; 568 x = 0;
570 src_x -= x; 569 }
571 x = 0; 570 if (y < 0)
572 } 571 {
573 if (y < 0) 572 height += y;
574 { 573 src_y -= y;
575 height += y; 574 y = 0;
576 src_y -= y; 575 }
577 y = 0; 576 if (x + width > LCD_WIDTH)
578 } 577 width = LCD_WIDTH - x;
579 if (x + width > LCD_WIDTH) 578 if (y + height > LCD_HEIGHT)
580 width = LCD_WIDTH - x; 579 height = LCD_HEIGHT - y;
581 if (y + height > LCD_HEIGHT) 580
582 height = LCD_HEIGHT - y; 581 src += stride * (src_y >> 3) + src_x; /* move starting point */
583 582 src_y &= 7;
584 src += stride * (src_y >> 3) + src_x; /* move starting point */ 583 src_end = src + width;
585 src_y &= 7; 584
586 src_end = src + width; 585 dst = LCDADDR(x, y);
587 586 int drawmode = lcd_get_drawmode();
588 dst = LCDADDR(x, y); 587 fb_data *backdrop = lcd_get_backdrop();
589 fgfunc = lcd_fastpixelfuncs[drawmode]; 588 bool has_backdrop = backdrop ? true : false;
590 bgfunc = lcd_fastpixelfuncs[drawmode ^ DRMODE_INVERSEVID]; 589 backdrop = backdrop + y * LCD_WIDTH + x;
591 590 lcd_fastpixelfunc_type *fgfunc = lcd_fastpixelfuncs[drawmode];;
592 do 591 lcd_fastpixelfunc_type *bgfunc = lcd_fastpixelfuncs[drawmode ^ DRMODE_INVERSEVID];;
593 { 592 do {
594 const unsigned char *src_col = src++; 593 const unsigned char *src_col = src++;
595 unsigned data = *src_col >> src_y; 594 unsigned data = *src_col >> src_y;
596 fb_data *dst_col = dst++; 595 fb_data *dst_col = dst++;
597 int numbits = 8 - src_y; 596 int numbits = 8 - src_y;
598 597 fb_data *backdrop_col = backdrop++;
599 dst_end = dst_col + height * LCD_WIDTH; 598 dst_end = dst_col + height * LCD_WIDTH;
600 do 599 do {
601 { 600 switch(drawmode) {
602 if (data & 0x01) 601 case DRMODE_SOLID:
603 fgfunc(dst_col); 602 if (data & 0x01)
604 else 603 *dst_col = fg_pattern;
605 bgfunc(dst_col); 604 else
606 605 *dst_col = has_backdrop ? *backdrop_col : bg_pattern;
607 dst_col += LCD_WIDTH; 606 break;
608 607 case DRMODE_FG:
609 data >>= 1; 608 if (data & 0x01)
610 if (--numbits == 0) 609 *dst_col = fg_pattern;
611 { 610 break;
612 src_col += stride; 611 case (DRMODE_SOLID|DRMODE_INVERSEVID):
613 data = *src_col; 612 if(data & 0x01)
614 numbits = 8; 613 *dst_col = has_backdrop ? *backdrop_col : bg_pattern;
615 } 614 else
616 } 615 *dst_col = fg_pattern;
617 while (dst_col < dst_end); 616 break;
618 } 617 default:
619 while (src < src_end); 618 if (data & 0x01)
619 fgfunc(dst_col);
620 else
621 bgfunc(dst_col);
622 break;
623 };
624 dst_col += LCD_WIDTH;
625 backdrop_col += LCD_WIDTH;
626 data >>= 1;
627 if (--numbits == 0) {
628 src_col += stride;
629 data = *src_col;
630 numbits = 8;
631 }
632 } while (dst_col < dst_end);
633 } while (src < src_end);
620} 634}
621#endif
622/* Draw a full monochrome bitmap */ 635/* Draw a full monochrome bitmap */
623void lcd_mono_bitmap(const unsigned char *src, int x, int y, int width, int height) 636void lcd_mono_bitmap(const unsigned char *src, int x, int y, int width, int height)
624{ 637{
diff --git a/firmware/target/arm/gigabeat/meg-fx/lcd-meg-fx.c b/firmware/target/arm/gigabeat/meg-fx/lcd-meg-fx.c
index 4a24e27abe..9a3d483e1a 100644
--- a/firmware/target/arm/gigabeat/meg-fx/lcd-meg-fx.c
+++ b/firmware/target/arm/gigabeat/meg-fx/lcd-meg-fx.c
@@ -293,94 +293,6 @@ void lcd_bitmap_transparent_part(const fb_data *src, int src_x, int src_y,
293 : : "r" (src), "r" (dst), "r" (width), "r" (dst_end), "r" (stride), "r" (transcolor) : "r0", "r1" ); 293 : : "r" (src), "r" (dst), "r" (width), "r" (dst_end), "r" (stride), "r" (transcolor) : "r0", "r1" );
294} 294}
295 295
296void lcd_mono_bitmap_part(const unsigned char *src, int src_x, int src_y,
297 int stride, int x, int y, int width, int height)
298 ICODE_ATTR;
299void lcd_mono_bitmap_part(const unsigned char *src, int src_x, int src_y,
300 int stride, int x, int y, int width, int height)
301{
302 const unsigned char *src_end;
303 fb_data *dst, *dst_end;
304
305 /* nothing to draw? */
306 if ((width <= 0) || (height <= 0) || (x >= LCD_WIDTH) || (y >= LCD_HEIGHT)
307 || (x + width <= 0) || (y + height <= 0))
308 return;
309
310 /* clipping */
311 if (x < 0)
312 {
313 width += x;
314 src_x -= x;
315 x = 0;
316 }
317 if (y < 0)
318 {
319 height += y;
320 src_y -= y;
321 y = 0;
322 }
323 if (x + width > LCD_WIDTH)
324 width = LCD_WIDTH - x;
325 if (y + height > LCD_HEIGHT)
326 height = LCD_HEIGHT - y;
327
328 src += stride * (src_y >> 3) + src_x; /* move starting point */
329 src_y &= 7;
330 src_end = src + width;
331
332 dst = LCDADDR(x, y);
333 int drawmode = lcd_get_drawmode();
334 fb_data *backdrop = lcd_get_backdrop();
335 bool has_backdrop = backdrop ? true : false;
336 backdrop = backdrop + y * LCD_WIDTH + x;
337 lcd_fastpixelfunc_type *fgfunc = lcd_fastpixelfuncs[drawmode];;
338 lcd_fastpixelfunc_type *bgfunc = lcd_fastpixelfuncs[drawmode ^ DRMODE_INVERSEVID];;
339 do {
340 const unsigned char *src_col = src++;
341 unsigned data = *src_col >> src_y;
342 fb_data *dst_col = dst++;
343 int numbits = 8 - src_y;
344 fb_data *backdrop_col = backdrop++;
345 dst_end = dst_col + height * LCD_WIDTH;
346 do {
347 switch(drawmode) {
348 case DRMODE_SOLID:
349 if (data & 0x01)
350 *dst_col = fg_pattern;
351 else
352 *dst_col = has_backdrop ? *backdrop_col : bg_pattern;
353 break;
354 case DRMODE_FG:
355 if (data & 0x01)
356 *dst_col = fg_pattern;
357 break;
358 case (DRMODE_SOLID|DRMODE_INVERSEVID):
359 if(data & 0x01)
360 *dst_col = has_backdrop ? *backdrop_col : bg_pattern;
361 else
362 *dst_col = fg_pattern;
363 break;
364 default:
365 if (data & 0x01)
366 fgfunc(dst_col);
367 else
368 bgfunc(dst_col);
369 break;
370 };
371 dst_col += LCD_WIDTH;
372 backdrop_col += LCD_WIDTH;
373 data >>= 1;
374 if (--numbits == 0) {
375 src_col += stride;
376 data = *src_col;
377 numbits = 8;
378 }
379 } while (dst_col < dst_end);
380 } while (src < src_end);
381}
382
383
384#define CSUB_X 2 296#define CSUB_X 2
385#define CSUB_Y 2 297#define CSUB_Y 2
386 298