diff options
Diffstat (limited to 'apps/recorder/bmp.c')
-rw-r--r-- | apps/recorder/bmp.c | 46 |
1 files changed, 40 insertions, 6 deletions
diff --git a/apps/recorder/bmp.c b/apps/recorder/bmp.c index 4e8cdd70c5..81ed8bc73b 100644 --- a/apps/recorder/bmp.c +++ b/apps/recorder/bmp.c | |||
@@ -621,6 +621,8 @@ int read_bmp_fd(int fd, | |||
621 | defined(HAVE_BMP_SCALING) || defined(PLUGIN) | 621 | defined(HAVE_BMP_SCALING) || defined(PLUGIN) |
622 | if(resize) | 622 | if(resize) |
623 | totalsize += BM_SCALED_SIZE(bm->width, 0, 0, 0); | 623 | totalsize += BM_SCALED_SIZE(bm->width, 0, 0, 0); |
624 | else if (bm->width > BM_MAX_WIDTH) | ||
625 | totalsize += bm->width*4; | ||
624 | #endif | 626 | #endif |
625 | return totalsize; | 627 | return totalsize; |
626 | } | 628 | } |
@@ -717,9 +719,7 @@ int read_bmp_fd(int fd, | |||
717 | 719 | ||
718 | #if (LCD_DEPTH > 1 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1)) && \ | 720 | #if (LCD_DEPTH > 1 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1)) && \ |
719 | defined(HAVE_BMP_SCALING) || defined(PLUGIN) | 721 | defined(HAVE_BMP_SCALING) || defined(PLUGIN) |
720 | #if LCD_DEPTH > 1 && defined(HAVE_BMP_SCALING) | ||
721 | if (resize) | 722 | if (resize) |
722 | #endif | ||
723 | { | 723 | { |
724 | if (resize_on_load(bm, dither, &src_dim, &rset, | 724 | if (resize_on_load(bm, dither, &src_dim, &rset, |
725 | bitmap + totalsize, maxsize - totalsize, | 725 | bitmap + totalsize, maxsize - totalsize, |
@@ -749,17 +749,51 @@ int read_bmp_fd(int fd, | |||
749 | #endif | 749 | #endif |
750 | #endif | 750 | #endif |
751 | 751 | ||
752 | unsigned char *buf = ba.buf; | ||
753 | #if (LCD_DEPTH > 1 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1)) || \ | ||
754 | defined(PLUGIN) | ||
755 | if (bm->width > BM_MAX_WIDTH) | ||
756 | { | ||
757 | #if defined(HAVE_BMP_SCALING) || defined(PLUGIN) | ||
758 | unsigned int len = maxsize - totalsize; | ||
759 | buf = bitmap + totalsize; | ||
760 | ALIGN_BUFFER(buf, len, sizeof(uint32_t)); | ||
761 | if (bm->width*4 > (int)len) | ||
762 | #endif | ||
763 | return -6; | ||
764 | } | ||
765 | #endif | ||
766 | |||
752 | int row; | 767 | int row; |
753 | /* loop to read rows and put them to buffer */ | 768 | /* loop to read rows and put them to buffer */ |
754 | for (row = rset.rowstart; row != rset.rowstop; row += rset.rowstep) { | 769 | for (row = rset.rowstart; row != rset.rowstop; row += rset.rowstep) { |
770 | #if (LCD_DEPTH > 1 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1)) && \ | ||
771 | defined(HAVE_BMP_SCALING) || defined(PLUGIN) | ||
772 | if (bm->width > BM_MAX_WIDTH) | ||
773 | { | ||
774 | #if defined(HAVE_LCD_COLOR) | ||
775 | struct uint8_rgb *p = (struct uint8_rgb *)buf; | ||
776 | #else | ||
777 | uint8_t* p = buf; | ||
778 | #endif | ||
779 | do { | ||
780 | int len = read_part_line(&ba); | ||
781 | if (!len) | ||
782 | return -9; | ||
783 | memcpy(p, ba.buf, len*sizeof(*p)); | ||
784 | p += len; | ||
785 | } while (ba.cur_col); | ||
786 | } | ||
787 | else | ||
788 | #endif | ||
755 | if (!read_part_line(&ba)) | 789 | if (!read_part_line(&ba)) |
756 | return -9; | 790 | return -9; |
757 | #ifndef PLUGIN | 791 | #ifndef PLUGIN |
758 | #if !defined(HAVE_LCD_COLOR) && \ | 792 | #if !defined(HAVE_LCD_COLOR) && \ |
759 | (LCD_DEPTH > 1 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1)) | 793 | (LCD_DEPTH > 1 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1)) |
760 | uint8_t* qp = ba.buf; | 794 | uint8_t* qp = buf; |
761 | #else | 795 | #else |
762 | struct uint8_rgb *qp = (struct uint8_rgb *)ba.buf; | 796 | struct uint8_rgb *qp = (struct uint8_rgb *)buf; |
763 | #endif | 797 | #endif |
764 | #endif | 798 | #endif |
765 | /* Convert to destination format */ | 799 | /* Convert to destination format */ |
@@ -798,9 +832,9 @@ int read_bmp_fd(int fd, | |||
798 | #if LCD_DEPTH > 1 || defined(PLUGIN) | 832 | #if LCD_DEPTH > 1 || defined(PLUGIN) |
799 | { | 833 | { |
800 | #if !defined(PLUGIN) && !defined(HAVE_JPEG) && !defined(HAVE_BMP_SCALING) | 834 | #if !defined(PLUGIN) && !defined(HAVE_JPEG) && !defined(HAVE_BMP_SCALING) |
801 | output_row_8_native(row, ba.buf, &ctx); | 835 | output_row_8_native(row, buf, &ctx); |
802 | #else | 836 | #else |
803 | output_row_8(row, ba.buf, &ctx); | 837 | output_row_8(row, buf, &ctx); |
804 | #endif | 838 | #endif |
805 | } | 839 | } |
806 | #endif | 840 | #endif |