1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
diff --git a/apps/plugins/lib/SOURCES b/apps/plugins/lib/SOURCES
index b28878c..84afd4e 100644
--- a/apps/plugins/lib/SOURCES
+++ b/apps/plugins/lib/SOURCES
@@ -4,7 +4,7 @@ fixedpoint.c
 playback_control.c
 rgb_hsv.c
 #if defined(HAVE_LCD_BITMAP) && (LCD_DEPTH < 4)
-#if LCD_DEPTH == 1
+#if LCD_DEPTH == 1 /* import the core resizer and its support functions */
 resize.c
 #endif
 grey_core.c
diff --git a/apps/plugins/lib/bmp.c b/apps/plugins/lib/bmp.c
index b3e0e2b..1cb24d3 100644
--- a/apps/plugins/lib/bmp.c
+++ b/apps/plugins/lib/bmp.c
@@ -27,7 +27,7 @@
 #include "lcd.h"
 #include "system.h"

-#if LCD_DEPTH > 1
+#if LCD_DEPTH > 1  /* save is only available for color, resize for >1bpp */
 #ifdef HAVE_LCD_COLOR
 #define LE16(x) (htole16(x))&0xff, ((htole16(x))>>8)&0xff
 #define LE32(x) (htole32(x))&0xff, ((htole32(x))>>8)&0xff, ((htole32(x))>>16)&0xff, ((htole32(x))>>24)&0xff
@@ -122,13 +122,15 @@ void simple_resize_bitmap(struct bitmap *src, struct bitmap *dst)
     }
 }

-#else
+#else /* LCD_DEPTH == 1 */
 #include "wrappers.h"

 static const struct plugin_api *rb;

+/* import the core bmp loader */
 #include "../../recorder/bmp.c"

+/* initialize rb for use by the bmp loader */
 void bmp_init(const struct plugin_api *api)
 {
     rb = api;
diff --git a/apps/plugins/lib/bmp.h b/apps/plugins/lib/bmp.h
index 379a889..0e7a0a4 100644
--- a/apps/plugins/lib/bmp.h
+++ b/apps/plugins/lib/bmp.h
@@ -24,7 +24,7 @@
 #include "lcd.h"
 #include "plugin.h"

-#if LCD_DEPTH > 1
+#if LCD_DEPTH > 1 /* save is only available for color, resize for >1bpp */
 #ifdef HAVE_LCD_COLOR
 /**
  * Save bitmap to file
@@ -45,6 +45,11 @@ void simple_resize_bitmap(struct bitmap *src, struct bitmap *dst);
 void smooth_resize_bitmap(struct bitmap *src,  struct bitmap *dst);

 #else
+/*
+   BMP loader is built with scaling support in pluginlib on 1bpp targets, as
+   these do not provide scaling support in the core BMP loader. bmp_init is
+   needed to copy the plugin API pointer for the pluginlib loader's use.
+*/
 void bmp_init(const struct plugin_api *api);
 #endif

diff --git a/apps/plugins/lib/resize.h b/apps/plugins/lib/resize.h
index 3674e14..46a8977 100644
--- a/apps/plugins/lib/resize.h
+++ b/apps/plugins/lib/resize.h
@@ -24,8 +24,6 @@
 #ifndef _LIB_RESIZE_H_
 #define _LIB_RESIZE_H_

-#if LCD_DEPTH == 1
 void resize_init(const struct plugin_api *api);
-#endif

 #endif