summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorAndrew Mahone <andrew.mahone@gmail.com>2009-05-04 15:46:41 +0000
committerAndrew Mahone <andrew.mahone@gmail.com>2009-05-04 15:46:41 +0000
commit20f76d61ae58bd47b647d79e40beebbbe747e480 (patch)
treed37569a127b02fdd051c6a3da77c70ac2d72e8ab /apps
parentdfb24d6ceee703361b8120d689d8d77cfc15830d (diff)
downloadrockbox-20f76d61ae58bd47b647d79e40beebbbe747e480.tar.gz
rockbox-20f76d61ae58bd47b647d79e40beebbbe747e480.zip
Make JPEG and BMP scaler optional with HAVE_JPEG and HAVE_BMP_SCALING, both defined for all targets that have HAVE_ALBUMART. Disable JPEG in PictureFlow and pluginlib album art search with 32KiB plugin buffer until PictureFlow
gets overlay support. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20851 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r--apps/SOURCES8
-rw-r--r--apps/buffering.c4
-rw-r--r--apps/plugin.c2
-rw-r--r--apps/plugin.h2
-rw-r--r--apps/plugins/lib/SOURCES12
-rw-r--r--apps/plugins/lib/feature_wrappers.h17
-rw-r--r--apps/plugins/lib/pluginlib_bmp.c12
-rw-r--r--apps/plugins/lib/read_image.c4
-rw-r--r--apps/plugins/pictureflow.c5
-rw-r--r--apps/recorder/albumart.c22
-rw-r--r--apps/recorder/bmp.c86
-rw-r--r--apps/recorder/resize.c19
-rw-r--r--apps/recorder/resize.h6
13 files changed, 120 insertions, 79 deletions
diff --git a/apps/SOURCES b/apps/SOURCES
index 13ca913a39..62bb78a473 100644
--- a/apps/SOURCES
+++ b/apps/SOURCES
@@ -88,8 +88,6 @@ gui/viewport.c
#if (LCD_DEPTH > 1) || (defined(HAVE_REMOTE_LCD) && (LCD_REMOTE_DEPTH > 1))
gui/backdrop.c
-recorder/resize.c
-recorder/jpeg_load.c
#endif
#ifdef HAVE_LCD_CHARCELLS
@@ -101,6 +99,12 @@ recorder/bmp.c
recorder/icons.c
recorder/keyboard.c
recorder/peakmeter.c
+#if defined(HAVE_ALBUMART) || defined(HAVE_JPEG)
+recorder/resize.c
+#endif
+#ifdef HAVE_JPEG
+recorder/jpeg_load.c
+#endif
#ifdef HAVE_ALBUMART
recorder/albumart.c
#endif
diff --git a/apps/buffering.c b/apps/buffering.c
index 66bd22f12d..3bcd790c35 100644
--- a/apps/buffering.c
+++ b/apps/buffering.c
@@ -834,7 +834,6 @@ static bool fill_buffer(void)
static int load_image(int fd, const char *path)
{
int rc;
- int pathlen = strlen(path);
struct bitmap *bmp = (struct bitmap *)&buffer[buf_widx];
/* FIXME: alignment may be needed for the data buffer. */
bmp->data = &buffer[buf_widx + sizeof(struct bitmap)];
@@ -848,10 +847,13 @@ static int load_image(int fd, const char *path)
get_albumart_size(bmp);
+#ifdef HAVE_JPEG
+ int pathlen = strlen(path);
if (strcmp(path + pathlen - 4, ".bmp"))
rc = read_jpeg_fd(fd, bmp, free, FORMAT_NATIVE|FORMAT_DITHER|
FORMAT_RESIZE|FORMAT_KEEP_ASPECT, NULL);
else
+#endif
rc = read_bmp_fd(fd, bmp, free, FORMAT_NATIVE|FORMAT_DITHER|
FORMAT_RESIZE|FORMAT_KEEP_ASPECT, NULL);
return rc + (rc > 0 ? sizeof(struct bitmap) : 0);
diff --git a/apps/plugin.c b/apps/plugin.c
index 33a6194c53..2d996a404e 100644
--- a/apps/plugin.c
+++ b/apps/plugin.c
@@ -644,7 +644,7 @@ static const struct plugin_api rockbox_api = {
#endif
#endif
#ifdef HAVE_LCD_BITMAP
-#if LCD_DEPTH > 1
+#ifdef HAVE_JPEG
read_jpeg_file,
read_jpeg_fd,
#endif
diff --git a/apps/plugin.h b/apps/plugin.h
index 19eb962588..72d71b6e93 100644
--- a/apps/plugin.h
+++ b/apps/plugin.h
@@ -805,7 +805,7 @@ struct plugin_api {
#endif
#ifdef HAVE_LCD_BITMAP
-#if LCD_DEPTH > 1
+#ifdef HAVE_JPEG
int (*read_jpeg_file)(const char* filename, struct bitmap *bm, int maxsize,
int format, const struct custom_format *cformat);
int (*read_jpeg_fd)(int fd, struct bitmap *bm, int maxsize,
diff --git a/apps/plugins/lib/SOURCES b/apps/plugins/lib/SOURCES
index dfdd569843..dc4d41c35c 100644
--- a/apps/plugins/lib/SOURCES
+++ b/apps/plugins/lib/SOURCES
@@ -5,15 +5,13 @@ fixedpoint.c
playback_control.c
rgb_hsv.c
buflib.c
-#if defined(HAVE_LCD_BITMAP) && (LCD_DEPTH < 4)
-/*
- The scaler is not provided in core on mono targets, but is built in
- pluginlib for use with greylib overlay output
-*/
-#if LCD_DEPTH == 1
+#if !defined(HAVE_BMP_SCALING) || !defined(HAVE_JPEG)
pluginlib_resize.c
+#endif
+#ifndef HAVE_JPEG
pluginlib_jpeg_load.c
#endif
+#if defined(HAVE_LCD_BITMAP) && (LCD_DEPTH < 4)
grey_core.c
grey_draw.c
grey_parm.c
@@ -45,7 +43,7 @@ read_image.c
#ifdef HAVE_LCD_COLOR
bmp_smooth_scale.c
#endif
-#ifndef HAVE_ALBUMART
+#if !defined(HAVE_ALBUMART) || !defined(HAVE_JPEG)
pluginlib_albumart.c
#endif
#endif
diff --git a/apps/plugins/lib/feature_wrappers.h b/apps/plugins/lib/feature_wrappers.h
index 3f47f23c00..50552fbda4 100644
--- a/apps/plugins/lib/feature_wrappers.h
+++ b/apps/plugins/lib/feature_wrappers.h
@@ -30,24 +30,27 @@
* but can easily be implement in pluginlib as long as the database is
* available.
*/
-#ifdef HAVE_ALBUMART
+#if defined(HAVE_ALBUMART) && defined(HAVE_JPEG)
#define search_albumart_files rb->search_albumart_files
#endif
/* This should only be used when loading scaled bitmaps, or using custom output
- * plugins. The pluginlib loader does not support loading bitmaps unscaled in
- * native format, so rb->read_bmp_file should always be used directly to load
- * such images.
+ * plugins. A native output plugin for the scaler is available as format_native
+ * on targets with LCD_DEPTH > 1
*/
-#if LCD_DEPTH > 1
+#ifdef HAVE_BMP_SCALING
#define scaled_read_bmp_file rb->read_bmp_file
#define scaled_read_bmp_fd rb->read_bmp_fd
-#define read_jpeg_file rb->read_jpeg_file
-#define read_jpeg_fd rb->read_jpeg_fd
#else
#define scaled_read_bmp_file read_bmp_file
#define scaled_read_bmp_fd read_bmp_fd
#endif
+#ifdef HAVE_JPEG
+#define read_jpeg_file rb->read_jpeg_file
+#define read_jpeg_fd rb->read_jpeg_fd
+#else
+#endif
+
#endif
diff --git a/apps/plugins/lib/pluginlib_bmp.c b/apps/plugins/lib/pluginlib_bmp.c
index b9cfc4ded3..110e534be0 100644
--- a/apps/plugins/lib/pluginlib_bmp.c
+++ b/apps/plugins/lib/pluginlib_bmp.c
@@ -122,10 +122,16 @@ void simple_resize_bitmap(struct bitmap *src, struct bitmap *dst)
}
}
-#else /* LCD_DEPTH == 1 */
+#endif /* LCD_DEPTH > 1 */
+
+#ifndef HAVE_BMP_SCALING
#include "wrappers.h"
/* import the core bmp loader */
-#include "../../recorder/bmp.c"
-
+#include "recorder/bmp.c"
+#else
+/* the full 16x16 Bayer dither matrix may be calculated quickly with this table
+*/
+const unsigned char dither_table[16] =
+ { 0,192, 48,240, 12,204, 60,252, 3,195, 51,243, 15,207, 63,255 };
#endif
diff --git a/apps/plugins/lib/read_image.c b/apps/plugins/lib/read_image.c
index 8b6d784213..5b07882764 100644
--- a/apps/plugins/lib/read_image.c
+++ b/apps/plugins/lib/read_image.c
@@ -28,12 +28,10 @@
int read_image_file(const char* filename, struct bitmap *bm, int maxsize,
int format, const struct custom_format *cformat)
{
-#if LCD_DEPTH > 1
int namelen = rb->strlen(filename);
if (rb->strcmp(filename + namelen - 4, ".bmp"))
return read_jpeg_file(filename, bm, maxsize, format, cformat);
else
-#endif
return scaled_read_bmp_file(filename, bm, maxsize, format, cformat);
}
@@ -46,11 +44,9 @@ int read_image_file_offset(int offset, const char* filename, struct bitmap *bm,
return fd;
if (offset != rb->lseek(fd, offset, SEEK_SET))
return -1;
-#if LCD_DEPTH > 1
int namelen = rb->strlen(filename);
if (rb->strcmp(filename + namelen - 4, ".bmp"))
return read_jpeg_fd(fd, bm, maxsize, format, cformat);
else
-#endif
return scaled_read_bmp_fd(fd, bm, maxsize, format, cformat);
}
diff --git a/apps/plugins/pictureflow.c b/apps/plugins/pictureflow.c
index f0931820d5..b78b953f13 100644
--- a/apps/plugins/pictureflow.c
+++ b/apps/plugins/pictureflow.c
@@ -927,8 +927,13 @@ bool create_albumart_cache(void)
input_bmp.data = buf;
input_bmp.width = DISPLAY_WIDTH;
input_bmp.height = DISPLAY_HEIGHT;
+#if PLUGIN_BUFFER_SIZE > 0x10000
ret = read_image_file(albumart_file, &input_bmp,
buf_size, format, &format_transposed);
+#else
+ ret = scaled_read_bmp_file(albumart_file, &input_bmp,
+ buf_size, format, &format_transposed);
+#endif
if (ret <= 0) {
rb->splash(HZ, "Could not read bmp");
continue; /* skip missing/broken files */
diff --git a/apps/recorder/albumart.c b/apps/recorder/albumart.c
index 3adedc8159..da85f99bbc 100644
--- a/apps/recorder/albumart.c
+++ b/apps/recorder/albumart.c
@@ -91,7 +91,7 @@ static void fix_path_part(char* path, int offset, int count)
}
}
-#if LCD_DEPTH > 1
+#if defined(HAVE_JPEG) || (defined(PLUGIN) && PLUGIN_BUFFER_SIZE > 0x10000)
const char * extensions[] = { "jpeg", "jpg", "bmp" };
int extension_lens[] = { 4, 3, 3 };
/* Try checking for several file extensions, return true if a file is found and
@@ -134,7 +134,7 @@ bool search_albumart_files(const struct mp3entry *id3, const char *size_string,
const char *artist;
int dirlen;
int albumlen;
-#if LCD_DEPTH > 1
+#if defined(HAVE_JPEG) || (defined(PLUGIN) && PLUGIN_BUFFER_SIZE > 0x10000)
int pathlen;
#endif
@@ -153,7 +153,7 @@ bool search_albumart_files(const struct mp3entry *id3, const char *size_string,
/* the first file we look for is one specific to the track playing */
strip_extension(path, sizeof(path) - strlen(size_string) - 4, trackname);
strcat(path, size_string);
-#if LCD_DEPTH > 1
+#if defined(HAVE_JPEG) || (defined(PLUGIN) && PLUGIN_BUFFER_SIZE > 0x10000)
strcat(path, ".");
pathlen = strlen(path);
found = try_exts(path, pathlen);
@@ -165,7 +165,7 @@ bool search_albumart_files(const struct mp3entry *id3, const char *size_string,
{
/* if it doesn't exist,
* we look for a file specific to the track's album name */
-#if LCD_DEPTH > 1
+#if defined(HAVE_JPEG) || (defined(PLUGIN) && PLUGIN_BUFFER_SIZE > 0x10000)
pathlen = snprintf(path, sizeof(path),
"%s%s%s.", dir, id3->album, size_string);
fix_path_part(path, dirlen, albumlen);
@@ -181,7 +181,7 @@ bool search_albumart_files(const struct mp3entry *id3, const char *size_string,
if (!found)
{
/* if it still doesn't exist, we look for a generic file */
-#if LCD_DEPTH > 1
+#if defined(HAVE_JPEG) || (defined(PLUGIN) && PLUGIN_BUFFER_SIZE > 0x10000)
pathlen = snprintf(path, sizeof(path),
"%scover%s.", dir, size_string);
found = try_exts(path, pathlen);
@@ -192,7 +192,7 @@ bool search_albumart_files(const struct mp3entry *id3, const char *size_string,
#endif
}
-#if LCD_DEPTH > 1
+#if defined(HAVE_JPEG) || (defined(PLUGIN) && PLUGIN_BUFFER_SIZE > 0x10000)
if (!found)
{
snprintf (path, sizeof(path), "%sfolder.jpg", dir);
@@ -205,7 +205,7 @@ bool search_albumart_files(const struct mp3entry *id3, const char *size_string,
if (!found && artist && id3->album)
{
/* look in the albumart subdir of .rockbox */
-#if LCD_DEPTH > 1
+#if defined(HAVE_JPEG) || (defined(PLUGIN) && PLUGIN_BUFFER_SIZE > 0x10000)
pathlen = snprintf(path, sizeof(path),
ROCKBOX_DIR "/albumart/%s-%s%s.",
artist,
@@ -241,7 +241,7 @@ bool search_albumart_files(const struct mp3entry *id3, const char *size_string,
{
/* we look in the parent directory
* for a file specific to the track's album name */
-#if LCD_DEPTH > 1
+#if defined(HAVE_JPEG) || (defined(PLUGIN) && PLUGIN_BUFFER_SIZE > 0x10000)
pathlen = snprintf(path, sizeof(path),
"%s%s%s.", dir, id3->album, size_string);
fix_path_part(path, dirlen, albumlen);
@@ -258,7 +258,7 @@ bool search_albumart_files(const struct mp3entry *id3, const char *size_string,
{
/* if it still doesn't exist, we look in the parent directory
* for a generic file */
-#if LCD_DEPTH > 1
+#if defined(HAVE_JPEG) || (defined(PLUGIN) && PLUGIN_BUFFER_SIZE > 0x10000)
pathlen = snprintf(path, sizeof(path),
"%scover%s.", dir, size_string);
found = try_exts(path, pathlen);
@@ -278,7 +278,7 @@ bool search_albumart_files(const struct mp3entry *id3, const char *size_string,
return true;
}
-#ifdef HAVE_ALBUMART
+#ifndef PLUGIN
/* Look for albumart bitmap in the same dir as the track and in its parent dir.
* Stores the found filename in the buf parameter.
* Returns true if a bitmap was found, false otherwise */
@@ -386,4 +386,4 @@ void get_albumart_size(struct bitmap *bmp)
bmp->width = data->albumart_max_width;
bmp->height = data->albumart_max_height;
}
-#endif /* HAVE_ALBUMART */
+#endif /* PLUGIN */
diff --git a/apps/recorder/bmp.c b/apps/recorder/bmp.c
index 3fb8a4d6c1..403c34d951 100644
--- a/apps/recorder/bmp.c
+++ b/apps/recorder/bmp.c
@@ -184,8 +184,8 @@ struct bmp_args {
short depth;
unsigned char buf[BM_MAX_WIDTH * 4];
struct uint8_rgb *palette;
-#if LCD_DEPTH > 1 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1) || \
- defined(PLUGIN)
+#if (LCD_DEPTH > 1 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1)) && \
+ defined(HAVE_BMP_SCALING) || defined(PLUGIN)
int cur_row;
int cur_col;
struct img_part part;
@@ -198,8 +198,8 @@ static unsigned int read_part_line(struct bmp_args *ba)
const int read_width = ba->read_width;
const int width = ba->width;
const int depth = ba->depth;
-#if LCD_DEPTH > 1 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1) || \
- defined(PLUGIN)
+#if (LCD_DEPTH > 1 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1)) && \
+ defined(HAVE_BMP_SCALING) || defined(PLUGIN)
int cur_row = ba->cur_row;
int cur_col = ba->cur_col;
#endif
@@ -211,8 +211,8 @@ static unsigned int read_part_line(struct bmp_args *ba)
int ret;
int i, cols, len;
-#if (LCD_DEPTH > 1) || defined(HAVE_REMOTE_LCD) && (LCD_REMOTE_DEPTH > 1) || \
- defined(PLUGIN)
+#if (LCD_DEPTH > 1 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1)) && \
+ defined(HAVE_BMP_SCALING) || defined(PLUGIN)
cols = MIN(width - cur_col,(int)BM_MAX_WIDTH);
BDEBUGF("reading %d cols (width: %d, max: %d)\n",cols,width,BM_MAX_WIDTH);
len = (cols * (depth == 15 ? 16 : depth) + 7) >> 3;
@@ -227,8 +227,8 @@ static unsigned int read_part_line(struct bmp_args *ba)
{
DEBUGF("read_part_line: error reading image, read returned %d "
"expected %d\n", ret, len);
-#if (LCD_DEPTH > 1) || defined(HAVE_REMOTE_LCD) && (LCD_REMOTE_DEPTH > 1) || \
- defined(PLUGIN)
+#if (LCD_DEPTH > 1 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1)) && \
+ defined(HAVE_BMP_SCALING) || defined(PLUGIN)
BDEBUGF("cur_row: %d cur_col: %d cols: %d len: %d\n", cur_row, cur_col,
cols, len);
#endif
@@ -290,17 +290,17 @@ static unsigned int read_part_line(struct bmp_args *ba)
}
}
-#if (!defined(HAVE_LCD_COLOR) && \
- (LCD_DEPTH > 1 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1))) || \
- defined(PLUGIN)
+#if !defined(HAVE_LCD_COLOR) && \
+ ((LCD_DEPTH > 1 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1)) || \
+ defined(PLUGIN))
ibuf = ba->buf;
buf = (struct uint8_rgb*)ba->buf;
while (ibuf < ba->buf + cols)
*ibuf++ = brightness(*buf++);
#endif
-#if LCD_DEPTH > 1 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1) || \
- defined(PLUGIN)
+#if (LCD_DEPTH > 1 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1)) && \
+ defined(HAVE_BMP_SCALING) || defined(PLUGIN)
cur_col += cols;
if (cur_col == width)
{
@@ -311,8 +311,8 @@ static unsigned int read_part_line(struct bmp_args *ba)
BDEBUGF("seeking %d bytes to next line\n",pad);
lseek(fd, pad, SEEK_CUR);
}
-#if LCD_DEPTH > 1 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1) || \
- defined(PLUGIN)
+#if (LCD_DEPTH > 1 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1)) && \
+ defined(HAVE_BMP_SCALING) || defined(PLUGIN)
cur_col = 0;
BDEBUGF("read_part_line: completed row %d\n", cur_row);
cur_row += 1;
@@ -324,8 +324,8 @@ static unsigned int read_part_line(struct bmp_args *ba)
return cols;
}
-#if LCD_DEPTH > 1 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1) || \
- defined(PLUGIN)
+#if (LCD_DEPTH > 1 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1)) && \
+ defined(HAVE_BMP_SCALING) || defined(PLUGIN)
static struct img_part *store_part_bmp(void *args)
{
struct bmp_args *ba = (struct bmp_args *)args;
@@ -375,10 +375,13 @@ int read_bmp_fd(int fd,
struct uint8_rgb palette[256];
struct rowset rset;
struct dim src_dim;
-#if (LCD_DEPTH > 1) || (defined(HAVE_REMOTE_LCD) && (LCD_REMOTE_DEPTH > 1)) \
- || defined(PLUGIN)
- unsigned int resize = IMG_NORESIZE;
+#if (LCD_DEPTH > 1 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1)) || \
+ defined(PLUGIN)
bool dither = false;
+#endif
+#if (LCD_DEPTH > 1 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1)) && \
+ defined(HAVE_BMP_SCALING) || defined(PLUGIN)
+ unsigned int resize = IMG_NORESIZE;
bool transparent = false;
#ifdef HAVE_REMOTE_LCD
@@ -398,14 +401,16 @@ int read_bmp_fd(int fd,
if (format & FORMAT_TRANSPARENT) {
transparent = true;
}
- if (format & FORMAT_DITHER) {
- dither = true;
- }
#else
(void)format;
#endif /*(LCD_DEPTH > 1) || defined(HAVE_REMOTE_LCD) && (LCD_REMOTE_DEPTH > 1)*/
-
+#if (LCD_DEPTH > 1 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1)) || \
+ defined(PLUGIN)
+ if (format & FORMAT_DITHER) {
+ dither = true;
+ }
+#endif
/* read fileheader */
ret = read(fd, &bmph, sizeof(struct bmp_header));
if (ret < 0) {
@@ -444,8 +449,11 @@ int read_bmp_fd(int fd,
bm->format = format & 1;
if ((format & 1) == FORMAT_MONO)
{
+#if (LCD_DEPTH > 1 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1)) && \
+ defined(HAVE_BMP_SCALING) || defined(PLUGIN)
resize &= ~IMG_RESIZE;
resize |= IMG_NORESIZE;
+#endif
#ifdef HAVE_REMOTE_LCD
remote = 0;
#endif
@@ -455,8 +463,8 @@ int read_bmp_fd(int fd,
return -6;
#endif /*(LCD_DEPTH > 1) || defined(HAVE_REMOTE_LCD) && (LCD_REMOTE_DEPTH > 1)*/
-#if LCD_DEPTH > 1 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1) || \
- defined(PLUGIN)
+#if (LCD_DEPTH > 1 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1)) && \
+ defined(HAVE_BMP_SCALING) || defined(PLUGIN)
if (resize & IMG_RESIZE) {
if(format & FORMAT_KEEP_ASPECT) {
/* keep aspect ratio.. */
@@ -471,19 +479,19 @@ int read_bmp_fd(int fd,
}
}
- format &= 1;
-
if (!(resize & IMG_RESIZE)) {
#endif
/* returning image size */
bm->width = src_dim.width;
bm->height = src_dim.height;
-#if LCD_DEPTH > 1 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1) || \
- defined(PLUGIN)
+#if (LCD_DEPTH > 1 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1)) && \
+ defined(HAVE_BMP_SCALING) || defined(PLUGIN)
}
#endif
-
+#if LCD_DEPTH > 1 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1)
+ format &= 1;
+#endif
if (rset.rowstep > 0) { /* Top-down BMP file */
rset.rowstart = 0;
rset.rowstop = bm->height;
@@ -581,15 +589,15 @@ int read_bmp_fd(int fd,
struct bmp_args ba = {
.fd = fd, .padded_width = padded_width, .read_width = read_width,
.width = src_dim.width, .depth = depth, .palette = palette,
-#if LCD_DEPTH > 1 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1) || \
- defined(PLUGIN)
+#if (LCD_DEPTH > 1 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1)) && \
+ defined(HAVE_BMP_SCALING) || defined(PLUGIN)
.cur_row = 0, .cur_col = 0, .part = {0,0}
#endif
};
-#if LCD_DEPTH > 1 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1) || \
- defined(PLUGIN)
-#if LCD_DEPTH > 1
+#if (LCD_DEPTH > 1 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1)) && \
+ defined(HAVE_BMP_SCALING) || defined(PLUGIN)
+#if LCD_DEPTH > 1 && defined(HAVE_BMP_SCALING)
if (resize || cformat)
#endif
{
@@ -600,12 +608,12 @@ int read_bmp_fd(int fd,
else
return 0;
}
-#ifndef PLUGIN
- int fb_width = BM_WIDTH(bm->width,bm->format,remote);
-#endif
#endif /* LCD_DEPTH */
#ifndef PLUGIN
+#if (LCD_DEPTH > 1 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1))
+ int fb_width = BM_WIDTH(bm->width,bm->format,remote);
+#endif
int col, row;
/* loop to read rows and put them to buffer */
diff --git a/apps/recorder/resize.c b/apps/recorder/resize.c
index 79be59804a..7000c448e6 100644
--- a/apps/recorder/resize.c
+++ b/apps/recorder/resize.c
@@ -516,8 +516,9 @@ static inline bool scale_v_linear(struct rowset *rset,
}
#endif /* HAVE_UPSCALER */
-#ifndef PLUGIN
-static void output_row_native(uint32_t row, void * row_in, struct scaler_context *ctx)
+#if !defined(PLUGIN) || LCD_DEPTH > 1
+void output_row_native(uint32_t row, void * row_in,
+ struct scaler_context *ctx)
{
int col;
int fb_width = BM_WIDTH(ctx->bm->width,FORMAT_NATIVE,0);
@@ -606,6 +607,18 @@ static void output_row_native(uint32_t row, void * row_in, struct scaler_context
}
#endif
+#if defined(PLUGIN) && LCD_DEPTH > 1
+unsigned int get_size_native(struct bitmap *bm)
+{
+ return BM_SIZE(bm->width,bm->height,FORMAT_NATIVE,FALSE);
+}
+
+const struct custom_format format_native = {
+ .output_row = output_row_native,
+ .get_size = get_size_native
+};
+#endif
+
int resize_on_load(struct bitmap *bm, bool dither, struct dim *src,
struct rowset *rset, unsigned char *buf, unsigned int len,
const struct custom_format *format,
@@ -669,7 +682,7 @@ int resize_on_load(struct bitmap *bm, bool dither, struct dim *src,
ctx.bm = bm;
ctx.src = src;
ctx.dither = dither;
-#ifndef PLUGIN
+#if !defined(PLUGIN)
ctx.output_row = output_row_native;
if (format)
#endif
diff --git a/apps/recorder/resize.h b/apps/recorder/resize.h
index dc93585a08..de9e8a9ab0 100644
--- a/apps/recorder/resize.h
+++ b/apps/recorder/resize.h
@@ -149,6 +149,12 @@ struct custom_format {
};
struct rowset;
+
+void output_row_native(uint32_t row, void * row_in,
+ struct scaler_context *ctx);
+
+extern const struct custom_format format_native;
+
int recalc_dimension(struct dim *dst, struct dim *src);
int resize_on_load(struct bitmap *bm, bool dither,