summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Nielsen Feltzing <linus@haxx.se>2005-09-07 13:54:58 +0000
committerLinus Nielsen Feltzing <linus@haxx.se>2005-09-07 13:54:58 +0000
commit04eedd06241412b20665623534dfd4565080768a (patch)
tree67ede9c397fce1dac795df5bcd27d32fe3efbe97
parent561aaa1219393ec9b3bd44049316b2c94aee8b80 (diff)
downloadrockbox-04eedd06241412b20665623534dfd4565080768a.tar.gz
rockbox-04eedd06241412b20665623534dfd4565080768a.zip
WPS: 1) Increased the WPS buffer size from 800 to 1600 bytes, 2) Increased the number of images from 26 to 52, using both a-z and A-Z as image ID 3) Fixed a bug that inserted empty lines if an image tag was wrong
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7498 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/wps-display.c30
1 files changed, 22 insertions, 8 deletions
diff --git a/apps/wps-display.c b/apps/wps-display.c
index a0aeaf8e36..b5f95a43d7 100644
--- a/apps/wps-display.c
+++ b/apps/wps-display.c
@@ -56,8 +56,8 @@
56/* Image stuff */ 56/* Image stuff */
57#include "bmp.h" 57#include "bmp.h"
58#include "atoi.h" 58#include "atoi.h"
59#define MAX_IMAGES 26 /* a-z */ 59#define MAX_IMAGES (26*2) /* a-z and A-Z */
60#define IMG_BUFSIZE (LCD_HEIGHT * LCD_WIDTH * MAX_IMAGES/10) / 8 60#define IMG_BUFSIZE (LCD_HEIGHT * LCD_WIDTH * MAX_IMAGES/25) / 8
61static unsigned char img_buf[IMG_BUFSIZE]; /* image buffer */ 61static unsigned char img_buf[IMG_BUFSIZE]; /* image buffer */
62static unsigned char* img_buf_ptr = img_buf; /* where are in image buffer? */ 62static unsigned char* img_buf_ptr = img_buf; /* where are in image buffer? */
63 63
@@ -81,7 +81,7 @@ struct {
81 81
82#ifdef HAVE_LCD_BITMAP 82#ifdef HAVE_LCD_BITMAP
83#define MAX_LINES (LCD_HEIGHT/5+1) 83#define MAX_LINES (LCD_HEIGHT/5+1)
84#define FORMAT_BUFFER_SIZE 800 84#define FORMAT_BUFFER_SIZE 1600
85#else 85#else
86#define MAX_LINES 2 86#define MAX_LINES 2
87#define FORMAT_BUFFER_SIZE 400 87#define FORMAT_BUFFER_SIZE 400
@@ -238,17 +238,24 @@ static void wps_format(const char* fmt)
238 pos = strchr(ptr, '|'); 238 pos = strchr(ptr, '|');
239 if (pos) 239 if (pos)
240 { 240 {
241 /* get the image number */ 241 /* get the image ID */
242 n = tolower(*ptr) - 'a'; 242 n = *ptr;
243 if(n >= 'a' && n <= 'z')
244 n -= 'a';
245 if(n >= 'A' && n <= 'Z')
246 n = n - 'A' + 26;
247
243 if(n < 0 || n >= MAX_IMAGES) 248 if(n < 0 || n >= MAX_IMAGES)
244 { 249 {
245 buf++; 250 /* Skip the rest of the line */
251 while(*buf != '\n')
252 buf++;
246 break; 253 break;
247 } 254 }
248 ptr = pos+1; 255 ptr = pos+1;
249 256
250 /* check the image number and load state */ 257 /* check the image number and load state */
251 if ((n < MAX_IMAGES) && (!img[n].loaded)) 258 if (!img[n].loaded)
252 { 259 {
253 /* get filename */ 260 /* get filename */
254 pos = strchr(ptr, '|'); 261 pos = strchr(ptr, '|');
@@ -1061,7 +1068,14 @@ static void format_display(char* buf,
1061 else if ('d' == *(fmt+1)) 1068 else if ('d' == *(fmt+1))
1062 { 1069 {
1063 fmt+=2; 1070 fmt+=2;
1064 n = tolower(*fmt) - 'a'; 1071
1072 /* get the image ID */
1073 n = *fmt;
1074 if(n >= 'a' && n <= 'z')
1075 n -= 'a';
1076 if(n >= 'A' && n <= 'Z')
1077 n = n - 'A' + 26;
1078
1065 if (n >= 0 && n < MAX_IMAGES && img[n].loaded) { 1079 if (n >= 0 && n < MAX_IMAGES && img[n].loaded) {
1066 img[n].display = true; 1080 img[n].display = true;
1067 } 1081 }