diff --git a/apps/recorder/bmp.c b/apps/recorder/bmp.c
index 86c057a..f0865c7 100644
--- a/apps/recorder/bmp.c
+++ b/apps/recorder/bmp.c
@@ -38,6 +38,8 @@
ahead by whole lines, or read the next chunk of the current line
*/

+#include "misc.h"
+#include <sprintf.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -353,6 +355,8 @@ int read_bmp_fd(int fd,
int format,
const struct custom_format *cformat)
{
+ char log_filename[MAX_PATH];
+ int lfh=-1;
struct bmp_header bmph;
int padded_width;
int read_width;
@@ -369,6 +373,7 @@ int read_bmp_fd(int fd,
bool dither = false;
bool transparent = false;

+ create_numbered_filename(log_filename, "", "bmploaddump", ".log", 4 IF_CNFN_NUM_(, NULL));
#ifdef HAVE_REMOTE_LCD
if (format & FORMAT_REMOTE) {
remote = true;
@@ -560,7 +565,18 @@ int read_bmp_fd(int fd,
lseek(fd, (off_t)letoh32(bmph.off_bits), SEEK_SET);

memset(bitmap, 0, totalsize);
-
+ lfh = creat(log_filename);
+ if (lfh >= 0)
+ {
+ fdprintf(lfh, "Reading BMP file\n"
+ " width: %d\n"
+ " height: %d\n"
+ " depth: %d\n", src_dim.width, src_dim.height, depth);
+ fdprintf(lfh, "Output:\n"
+ " width: %d\n"
+ " height: %d\n"
+ " format: %s\n", bm->width, bm->height, cformat ? "custom" : (remote ? "remote" : (format & FORMAT_NATIVE ? "native" : "mono" )));
+ }
struct bmp_args ba = {
.fd = fd, .padded_width = padded_width, .read_width = read_width,
.width = src_dim.width, .depth = depth, .palette = palette,
@@ -572,6 +588,11 @@ int read_bmp_fd(int fd,
#if LCD_DEPTH > 1 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1)
if (resize || cformat)
{
+ if (lfh >= 0)
+ {
+ fdprintf(lfh, "calling scaler\n");
+ close(lfh);
+ }
if (resize_on_load(bm, dither, &src_dim, &rset,
bitmap + totalsize, maxsize - totalsize,
cformat, store_part_bmp, &ba))
@@ -695,6 +716,8 @@ int read_bmp_fd(int fd,
r = (31 * q0.red + (q0.red >> 3) + delta) >> 8;
g = (63 * q0.green + (q0.green >> 2) + delta) >> 8;
b = (31 * q0.blue + (q0.blue >> 3) + delta) >> 8;
+ if ((r > 31 || g > 63 || b > 31 || delta > 255) && lfh >= 0)
+ fdprintf(lfh,"OVERFLOW ERROR: r: %d g: %d b: %d delta: %d",r,g,b,delta);
*dest++ = LCD_RGBPACK_LCD(r, g, b);
}
#endif /* LCD_DEPTH */
@@ -717,5 +740,7 @@ int read_bmp_fd(int fd,
#endif
}
}
+ if (lfh >= 0)
+ close(lfh);
return totalsize; /* return the used buffer size. */
}