summaryrefslogtreecommitdiff
path: root/apps/gui/splash.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/gui/splash.c')
-rw-r--r--apps/gui/splash.c22
1 files changed, 1 insertions, 21 deletions
diff --git a/apps/gui/splash.c b/apps/gui/splash.c
index fa2c21768a..5bcac80169 100644
--- a/apps/gui/splash.c
+++ b/apps/gui/splash.c
@@ -31,16 +31,11 @@
31#include "viewport.h" 31#include "viewport.h"
32#include "strtok_r.h" 32#include "strtok_r.h"
33 33
34#ifdef HAVE_LCD_BITMAP
35
36#define MAXLINES (LCD_HEIGHT/6) 34#define MAXLINES (LCD_HEIGHT/6)
37#define MAXBUFFER 512 35#define MAXBUFFER 512
38#define RECT_SPACING 2 36#define RECT_SPACING 2
39#define SPLASH_MEMORY_INTERVAL (HZ) 37#define SPLASH_MEMORY_INTERVAL (HZ)
40 38
41#endif
42
43
44static void splash_internal(struct screen * screen, const char *fmt, va_list ap) 39static void splash_internal(struct screen * screen, const char *fmt, va_list ap)
45{ 40{
46 char splash_buf[MAXBUFFER]; 41 char splash_buf[MAXBUFFER];
@@ -54,15 +49,13 @@ static void splash_internal(struct screen * screen, const char *fmt, va_list ap)
54 int y, i; 49 int y, i;
55 int space_w, w, h; 50 int space_w, w, h;
56 struct viewport vp; 51 struct viewport vp;
57#ifdef HAVE_LCD_BITMAP
58 int width, height; 52 int width, height;
59 int maxw = 0; 53 int maxw = 0;
60 54
61 viewport_set_defaults(&vp, screen->screen_type); 55 viewport_set_defaults(&vp, screen->screen_type);
62 screen->set_viewport(&vp); 56 screen->set_viewport(&vp);
63 57
64 screen->getstringsize(" ", &space_w, &h); 58 screen->getstringsize(" ", &space_w, &h);
65#endif
66 y = h; 59 y = h;
67 60
68 vsnprintf(splash_buf, sizeof(splash_buf), fmt, ap); 61 vsnprintf(splash_buf, sizeof(splash_buf), fmt, ap);
@@ -77,20 +70,14 @@ static void splash_internal(struct screen * screen, const char *fmt, va_list ap)
77 lines[0] = next; 70 lines[0] = next;
78 while (true) 71 while (true)
79 { 72 {
80#ifdef HAVE_LCD_BITMAP
81 screen->getstringsize(next, &w, NULL); 73 screen->getstringsize(next, &w, NULL);
82#else
83 w = utf8length(next);
84#endif
85 if (lastbreak) 74 if (lastbreak)
86 { 75 {
87 if (x + (next - lastbreak) * space_w + w 76 if (x + (next - lastbreak) * space_w + w
88 > vp.width - RECT_SPACING*2) 77 > vp.width - RECT_SPACING*2)
89 { /* too wide, wrap */ 78 { /* too wide, wrap */
90#ifdef HAVE_LCD_BITMAP
91 if (x > maxw) 79 if (x > maxw)
92 maxw = x; 80 maxw = x;
93#endif
94 if ((y + h > vp.height) || (line >= (MAXLINES-1))) 81 if ((y + h > vp.height) || (line >= (MAXLINES-1)))
95 break; /* screen full or out of lines */ 82 break; /* screen full or out of lines */
96 x = 0; 83 x = 0;
@@ -109,10 +96,8 @@ static void splash_internal(struct screen * screen, const char *fmt, va_list ap)
109 next = strtok_r(NULL, " ", &store); 96 next = strtok_r(NULL, " ", &store);
110 if (!next) 97 if (!next)
111 { /* no more words */ 98 { /* no more words */
112#ifdef HAVE_LCD_BITMAP
113 if (x > maxw) 99 if (x > maxw)
114 maxw = x; 100 maxw = x;
115#endif
116 break; 101 break;
117 } 102 }
118 } 103 }
@@ -123,8 +108,6 @@ static void splash_internal(struct screen * screen, const char *fmt, va_list ap)
123 108
124 screen->scroll_stop(); 109 screen->scroll_stop();
125 110
126#ifdef HAVE_LCD_BITMAP
127
128 width = maxw + 2*RECT_SPACING; 111 width = maxw + 2*RECT_SPACING;
129 height = y + 2*RECT_SPACING; 112 height = y + 2*RECT_SPACING;
130 113
@@ -166,14 +149,11 @@ static void splash_internal(struct screen * screen, const char *fmt, va_list ap)
166 149
167 /* prepare putting the text */ 150 /* prepare putting the text */
168 y = RECT_SPACING; 151 y = RECT_SPACING;
169#endif
170 152
171 /* print the message to screen */ 153 /* print the message to screen */
172 for (i = 0; i <= line; i++, y+=h) 154 for (i = 0; i <= line; i++, y+=h)
173 { 155 {
174#ifdef HAVE_LCD_BITMAP
175 screen->putsxy(0, y, lines[i]); 156 screen->putsxy(0, y, lines[i]);
176#endif
177 } 157 }
178 screen->update_viewport(); 158 screen->update_viewport();
179end: 159end: