summaryrefslogtreecommitdiff
path: root/apps/recorder/bmp.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/recorder/bmp.c')
-rw-r--r--apps/recorder/bmp.c26
1 files changed, 18 insertions, 8 deletions
diff --git a/apps/recorder/bmp.c b/apps/recorder/bmp.c
index cc574649d8..86c057a907 100644
--- a/apps/recorder/bmp.c
+++ b/apps/recorder/bmp.c
@@ -147,7 +147,8 @@ const unsigned short vi_pattern[4] = {
147int read_bmp_file(const char* filename, 147int read_bmp_file(const char* filename,
148 struct bitmap *bm, 148 struct bitmap *bm,
149 int maxsize, 149 int maxsize,
150 int format) 150 int format,
151 const struct custom_format *cformat)
151{ 152{
152 int fd, ret; 153 int fd, ret;
153 fd = open(filename, O_RDONLY); 154 fd = open(filename, O_RDONLY);
@@ -161,7 +162,7 @@ int read_bmp_file(const char* filename,
161 BDEBUGF("read_bmp_file: '%s' remote: %d resize: %d keep_aspect: %d\n", 162 BDEBUGF("read_bmp_file: '%s' remote: %d resize: %d keep_aspect: %d\n",
162 filename, !!(format & FORMAT_REMOTE), !!(format & FORMAT_RESIZE), 163 filename, !!(format & FORMAT_REMOTE), !!(format & FORMAT_RESIZE),
163 !!(format & FORMAT_KEEP_ASPECT)); 164 !!(format & FORMAT_KEEP_ASPECT));
164 ret = read_bmp_fd(fd, bm, maxsize, format); 165 ret = read_bmp_fd(fd, bm, maxsize, format, cformat);
165 close(fd); 166 close(fd);
166 return ret; 167 return ret;
167} 168}
@@ -349,7 +350,8 @@ static inline int rgbcmp(struct uint8_rgb rgb1, struct uint8_rgb rgb2)
349int read_bmp_fd(int fd, 350int read_bmp_fd(int fd,
350 struct bitmap *bm, 351 struct bitmap *bm,
351 int maxsize, 352 int maxsize,
352 int format) 353 int format,
354 const struct custom_format *cformat)
353{ 355{
354 struct bmp_header bmph; 356 struct bmp_header bmph;
355 int padded_width; 357 int padded_width;
@@ -473,7 +475,10 @@ int read_bmp_fd(int fd,
473 rset.rowstop = -1; 475 rset.rowstop = -1;
474 } 476 }
475 477
476 totalsize = BM_SIZE(bm->width,bm->height,format,remote); 478 if (cformat)
479 totalsize = cformat->get_size(bm);
480 else
481 totalsize = BM_SIZE(bm->width,bm->height,format,remote);
477 482
478 /* Check if this fits the buffer */ 483 /* Check if this fits the buffer */
479 if (totalsize > maxsize) { 484 if (totalsize > maxsize) {
@@ -565,10 +570,15 @@ int read_bmp_fd(int fd,
565 }; 570 };
566 571
567#if LCD_DEPTH > 1 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1) 572#if LCD_DEPTH > 1 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1)
568 if (resize) 573 if (resize || cformat)
569 return resize_on_load(bm, dither, &src_dim, &rset, 574 {
570 bitmap + totalsize, maxsize - totalsize, 575 if (resize_on_load(bm, dither, &src_dim, &rset,
571 store_part_bmp, &ba); 576 bitmap + totalsize, maxsize - totalsize,
577 cformat, store_part_bmp, &ba))
578 return totalsize;
579 else
580 return 0;
581 }
572 582
573 int fb_width = BM_WIDTH(bm->width,bm->format,remote); 583 int fb_width = BM_WIDTH(bm->width,bm->format,remote);
574#endif /* LCD_DEPTH */ 584#endif /* LCD_DEPTH */