summaryrefslogtreecommitdiff
path: root/apps/gui/gwps-common.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/gui/gwps-common.c')
-rw-r--r--apps/gui/gwps-common.c58
1 files changed, 56 insertions, 2 deletions
diff --git a/apps/gui/gwps-common.c b/apps/gui/gwps-common.c
index ca839a9bfa..09c271b904 100644
--- a/apps/gui/gwps-common.c
+++ b/apps/gui/gwps-common.c
@@ -28,6 +28,7 @@
28#include "power.h" 28#include "power.h"
29#include "powermgmt.h" 29#include "powermgmt.h"
30#include "sound.h" 30#include "sound.h"
31#include "debug.h"
31#ifdef HAVE_LCD_CHARCELLS 32#ifdef HAVE_LCD_CHARCELLS
32#include "hwcompat.h" 33#include "hwcompat.h"
33#endif 34#endif
@@ -36,10 +37,11 @@
36#include "backlight.h" 37#include "backlight.h"
37#include "lang.h" 38#include "lang.h"
38#include "misc.h" 39#include "misc.h"
39 40#include "backdrop.h"
40#include "splash.h" 41#include "splash.h"
41#include "scrollbar.h" 42#include "scrollbar.h"
42#include "led.h" 43#include "led.h"
44#include "lcd.h"
43#ifdef HAVE_LCD_BITMAP 45#ifdef HAVE_LCD_BITMAP
44#include "peakmeter.h" 46#include "peakmeter.h"
45/* Image stuff */ 47/* Image stuff */
@@ -57,6 +59,10 @@ static void draw_player_fullbar(struct gui_wps *gwps,
57 /* 3% of 30min file == 54s step size */ 59 /* 3% of 30min file == 54s step size */
58#define MIN_FF_REWIND_STEP 500 60#define MIN_FF_REWIND_STEP 500
59 61
62#ifdef HAVE_LCD_COLOR
63extern bool wps_has_backdrop;
64#endif
65
60/* Skip leading UTF-8 BOM, if present. */ 66/* Skip leading UTF-8 BOM, if present. */
61static char* skip_utf8_bom(char* buf) 67static char* skip_utf8_bom(char* buf)
62{ 68{
@@ -88,6 +94,7 @@ static int get_image_id(int c)
88/* 94/*
89 * parse the given buffer for following static tags: 95 * parse the given buffer for following static tags:
90 * %x - load image for always display 96 * %x - load image for always display
97 * %X - load backdrop image
91 * %xl - preload image 98 * %xl - preload image
92 * %we - enable statusbar on wps regardless of the global setting 99 * %we - enable statusbar on wps regardless of the global setting
93 * %wd - disable statusbar on wps regardless of the global setting 100 * %wd - disable statusbar on wps regardless of the global setting
@@ -133,7 +140,54 @@ bool wps_data_preload_tags(struct wps_data *data, char *buf,
133 return true; 140 return true;
134 } 141 }
135 break; 142 break;
136 143
144#ifdef HAVE_LCD_COLOR
145 case 'X':
146 /* Backdrop image - must be the same size as the LCD */
147 {
148 int ret = 0;
149 struct bitmap bm;
150 char *ptr = buf+2;
151 char *pos = NULL;
152 char imgname[MAX_PATH];
153
154 /* format: %X|filename.bmp| */
155 {
156 /* get filename */
157 pos = strchr(ptr, '|');
158 if ((pos - ptr) <
159 (int)sizeof(imgname)-ROCKBOX_DIR_LEN-2)
160 {
161 memcpy(imgname, bmpdir, bmpdirlen);
162 imgname[bmpdirlen] = '/';
163 memcpy(&imgname[bmpdirlen+1],
164 ptr, pos - ptr);
165 imgname[bmpdirlen+1+pos-ptr] = 0;
166 }
167 else
168 /* filename too long */
169 imgname[0] = 0;
170
171 ptr = pos+1;
172
173 /* load the image */
174 bm.data=(char*)&wps_backdrop[0][0];
175 ret = read_bmp_file(imgname, &bm,
176 sizeof(wps_backdrop), FORMAT_NATIVE);
177
178 if ((ret > 0) && (bm.width == LCD_WIDTH)
179 && (bm.height == LCD_HEIGHT)) {
180 wps_has_backdrop=true;
181 return true;
182 } else {
183 return false;
184 }
185 }
186 }
187
188 break;
189#endif
190
137 case 'x': 191 case 'x':
138 /* Preload images so the %xd# tag can display it */ 192 /* Preload images so the %xd# tag can display it */
139 { 193 {