summaryrefslogtreecommitdiffstats
path: root/apps/plugins/imageviewer/bmp
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/imageviewer/bmp')
-rw-r--r--apps/plugins/imageviewer/bmp/SOURCES1
-rw-r--r--apps/plugins/imageviewer/bmp/bmp.c47
-rw-r--r--apps/plugins/imageviewer/bmp/bmp.make14
-rw-r--r--apps/plugins/imageviewer/bmp/bmp_ui.c5
4 files changed, 36 insertions, 31 deletions
diff --git a/apps/plugins/imageviewer/bmp/SOURCES b/apps/plugins/imageviewer/bmp/SOURCES
index a50d245846..29297c9ec2 100644
--- a/apps/plugins/imageviewer/bmp/SOURCES
+++ b/apps/plugins/imageviewer/bmp/SOURCES
@@ -1,2 +1 @@
-bmp_ui.c
bmp.c
diff --git a/apps/plugins/imageviewer/bmp/bmp.c b/apps/plugins/imageviewer/bmp/bmp.c
index 6d33575f98..b7efbb7e2c 100644
--- a/apps/plugins/imageviewer/bmp/bmp.c
+++ b/apps/plugins/imageviewer/bmp/bmp.c
@@ -65,18 +65,13 @@ struct bitmap bmp;
/************************* Implementation ***************************/
-bool img_ext(const char *ext)
-{
- if (!ext)
- return false;
- if (!rb->strcasecmp(ext,".bmp"))
- return true;
- else
- return false;
-}
+#if defined(USEGSLIB) && (CONFIG_PLATFORM & PLATFORM_HOSTED)
+/* hack: fix error "undefined reference to `_grey_info'". */
+GREY_INFO_STRUCT
+#endif /* USEGSLIB */
-void draw_image_rect(struct image_info *info,
- int x, int y, int width, int height)
+static void draw_image_rect(struct image_info *info,
+ int x, int y, int width, int height)
{
struct t_disp* pdisp = (struct t_disp*)info->data;
#ifdef HAVE_LCD_COLOR
@@ -95,7 +90,7 @@ void draw_image_rect(struct image_info *info,
#endif
}
-int img_mem(int ds)
+static int img_mem(int ds)
{
#ifndef USEGSLIB
return (bmp.width/ds) * (bmp.height/ds) * sizeof (fb_data);
@@ -104,8 +99,8 @@ int img_mem(int ds)
#endif
}
-int load_image(char *filename, struct image_info *info,
- unsigned char *buf, ssize_t *buf_size)
+static int load_image(char *filename, struct image_info *info,
+ unsigned char *buf, ssize_t *buf_size)
{
int w, h; /* used to center output */
long time; /* measured ticks */
@@ -147,7 +142,7 @@ int load_image(char *filename, struct image_info *info,
}
#endif
#ifdef USE_PLUG_BUF
- if (!plug_buf)
+ if (!iv->plug_buf)
#endif
{
while (size > *buf_size && bmp.width >= 2 && bmp.height >= 2 && ds < 8)
@@ -174,7 +169,7 @@ int load_image(char *filename, struct image_info *info,
return PLUGIN_OUTOFMEM;
}
- if (!running_slideshow)
+ if (!iv->running_slideshow)
{
rb->lcd_puts(0, 0, rb->strrchr(filename,'/')+1);
rb->lcd_putsf(0, 1, "loading %dx%d%s",
@@ -204,7 +199,7 @@ int load_image(char *filename, struct image_info *info,
return PLUGIN_ERROR;
}
- if (!running_slideshow)
+ if (!iv->running_slideshow)
{
rb->snprintf(print, sizeof(print), " %ld.%02ld sec ", time/HZ, time%HZ);
rb->lcd_getstringsize(print, &w, &h); /* centered in progress bar */
@@ -212,7 +207,7 @@ int load_image(char *filename, struct image_info *info,
rb->lcd_update();
}
#ifdef DISK_SPINDOWN
- else if (immediate_ata_off)
+ else if(iv->immediate_ata_off)
{
/* running slideshow and time is long enough: power down disk */
rb->storage_sleep();
@@ -223,7 +218,7 @@ int load_image(char *filename, struct image_info *info,
buf_images = buf_root = buf + size;
buf_images_size = root_size = *buf_size - size;
- if (!running_slideshow)
+ if (!iv->running_slideshow)
{
rb->lcd_putsf(0, 2, "image %dx%d", bmp.width, bmp.height);
rb->lcd_update();
@@ -235,7 +230,7 @@ int load_image(char *filename, struct image_info *info,
return PLUGIN_OK;
}
-int get_image(struct image_info *info, int ds)
+static int get_image(struct image_info *info, int ds)
{
struct t_disp* p_disp = &disp[ds]; /* short cut */
@@ -270,7 +265,7 @@ int get_image(struct image_info *info, int ds)
buf_images += size;
buf_images_size -= size;
- if (!running_slideshow)
+ if (!iv->running_slideshow)
{
rb->lcd_putsf(0, 3, "resizing %d*%d", info->width, info->height);
rb->lcd_update();
@@ -294,3 +289,13 @@ int get_image(struct image_info *info, int ds)
return PLUGIN_OK;
}
+
+const struct image_decoder image_decoder = {
+ true,
+ img_mem,
+ load_image,
+ get_image,
+ draw_image_rect,
+};
+
+IMGDEC_HEADER
diff --git a/apps/plugins/imageviewer/bmp/bmp.make b/apps/plugins/imageviewer/bmp/bmp.make
index 0582ba3eb3..0947dd6166 100644
--- a/apps/plugins/imageviewer/bmp/bmp.make
+++ b/apps/plugins/imageviewer/bmp/bmp.make
@@ -10,12 +10,18 @@
BMPSRCDIR := $(IMGVSRCDIR)/bmp
BMPBUILDDIR := $(IMGVBUILDDIR)/bmp
-ROCKS += $(BMPBUILDDIR)/bmp.rock
-
BMP_SRC := $(call preprocess, $(BMPSRCDIR)/SOURCES)
BMP_OBJ := $(call c2obj, $(BMP_SRC))
-# add source files to OTHER_SRC to get automatic dependencies
OTHER_SRC += $(BMP_SRC)
-$(BMPBUILDDIR)/bmp.rock: $(BMP_OBJ)
+ROCKS += $(BMPBUILDDIR)/bmp.ovl
+
+$(BMPBUILDDIR)/bmp.refmap: $(BMP_OBJ)
+$(BMPBUILDDIR)/bmp.link: $(PLUGIN_LDS) $(BMPBUILDDIR)/bmp.refmap
+$(BMPBUILDDIR)/bmp.ovl: $(BMP_OBJ)
+
+# special pattern rule for compiling image decoder with extra flags
+$(BMPBUILDDIR)/%.o: $(BMPSRCDIR)/%.c $(BMPSRCDIR)/bmp.make
+ $(SILENT)mkdir -p $(dir $@)
+ $(call PRINTS,CC $(subst $(ROOTDIR)/,,$<))$(CC) -I$(dir $<) $(IMGDECFLAGS) -c $< -o $@
diff --git a/apps/plugins/imageviewer/bmp/bmp_ui.c b/apps/plugins/imageviewer/bmp/bmp_ui.c
deleted file mode 100644
index 8ff3e0c880..0000000000
--- a/apps/plugins/imageviewer/bmp/bmp_ui.c
+++ /dev/null
@@ -1,5 +0,0 @@
-#define BMP_VIEWER
-#define MENU_TITLE "BMP Menu"
-#define UNSCALED_IS_AVAILABLE 1
-
-#include "../imageviewer.c"