summaryrefslogtreecommitdiff
path: root/apps/plugins/lib/grey_draw.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/lib/grey_draw.c')
-rw-r--r--apps/plugins/lib/grey_draw.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/apps/plugins/lib/grey_draw.c b/apps/plugins/lib/grey_draw.c
index 335d6d1b20..6df5556ec8 100644
--- a/apps/plugins/lib/grey_draw.c
+++ b/apps/plugins/lib/grey_draw.c
@@ -586,11 +586,17 @@ void grey_ub_clear_display(void)
586#endif 586#endif
587} 587}
588 588
589/* Assembler optimised helper function for copying a single line to the
590 * greyvalue buffer. */
591void _grey_line1(int width, unsigned char *dst, const unsigned char *src,
592 const unsigned char *lut);
593
589/* Draw a partial greyscale bitmap, canonical format */ 594/* Draw a partial greyscale bitmap, canonical format */
590void grey_ub_gray_bitmap_part(const unsigned char *src, int src_x, int src_y, 595void grey_ub_gray_bitmap_part(const unsigned char *src, int src_x, int src_y,
591 int stride, int x, int y, int width, int height) 596 int stride, int x, int y, int width, int height)
592{ 597{
593 int yc, ye; 598 int yc, ye;
599 unsigned char *dst;
594 600
595 /* nothing to draw? */ 601 /* nothing to draw? */
596 if ((width <= 0) || (height <= 0) || (x >= _grey_info.width) 602 if ((width <= 0) || (height <= 0) || (x >= _grey_info.width)
@@ -618,16 +624,22 @@ void grey_ub_gray_bitmap_part(const unsigned char *src, int src_x, int src_y,
618 src += _GREY_MULUQ(stride, src_y) + src_x; /* move starting point */ 624 src += _GREY_MULUQ(stride, src_y) + src_x; /* move starting point */
619 yc = y; 625 yc = y;
620 ye = y + height; 626 ye = y + height;
627 dst = _grey_info.values + (x << _GREY_BSHIFT);
621 628
622 do 629 do
623 { 630 {
624#if LCD_PIXELFORMAT == HORIZONTAL_PACKING 631#if LCD_PIXELFORMAT == HORIZONTAL_PACKING
625 int idx = _GREY_MULUQ(_grey_info.width, yc) + x; 632 int idx = _GREY_MULUQ(_grey_info.width, yc);
626#else 633#else
627 int idx = _GREY_MULUQ(_grey_info.width, yc & ~_GREY_BMASK) 634 int idx = _GREY_MULUQ(_grey_info.width, yc & ~_GREY_BMASK)
628 + (x << _GREY_BSHIFT) + (~yc & _GREY_BMASK); 635 + (~yc & _GREY_BMASK);
629#endif /* LCD_PIXELFORMAT */ 636#endif /* LCD_PIXELFORMAT */
630 unsigned char *dst_row = _grey_info.values + idx; 637
638#if (LCD_PIXELFORMAT == VERTICAL_PACKING) && (LCD_DEPTH == 2) \
639 && defined(CPU_COLDFIRE)
640 _grey_line1(width, dst + idx, src, _grey_info.gvalue);
641#else
642 unsigned char *dst_row = dst + idx;
631 const unsigned char *src_row = src; 643 const unsigned char *src_row = src;
632 const unsigned char *src_end = src + width; 644 const unsigned char *src_end = src + width;
633 645
@@ -637,6 +649,7 @@ void grey_ub_gray_bitmap_part(const unsigned char *src, int src_x, int src_y,
637 dst_row += _GREY_BSIZE; 649 dst_row += _GREY_BSIZE;
638 } 650 }
639 while (src_row < src_end); 651 while (src_row < src_end);
652#endif
640 653
641 src += stride; 654 src += stride;
642 } 655 }