diff options
Diffstat (limited to 'apps')
-rw-r--r-- | apps/gui/line.c | 49 | ||||
-rw-r--r-- | apps/plugin.h | 2 | ||||
-rw-r--r-- | apps/screen_access.h | 4 |
3 files changed, 37 insertions, 18 deletions
diff --git a/apps/gui/line.c b/apps/gui/line.c index d561f08c76..e2eb6f277b 100644 --- a/apps/gui/line.c +++ b/apps/gui/line.c | |||
@@ -50,18 +50,27 @@ static void style_line(struct screen *display, int x, int y, struct line_desc *l | |||
50 | static void put_text(struct screen *display, int x, int y, struct line_desc *line, | 50 | static void put_text(struct screen *display, int x, int y, struct line_desc *line, |
51 | const char *text, bool prevent_scroll, int text_skip_pixels); | 51 | const char *text, bool prevent_scroll, int text_skip_pixels); |
52 | 52 | ||
53 | struct line_desc_scroll { | ||
54 | struct line_desc desc; /* must be first! */ | ||
55 | bool used; | ||
56 | }; | ||
57 | |||
58 | #define NOINLINE __attribute__ ((noinline)) | ||
53 | 59 | ||
54 | static struct line_desc *get_line_desc(void) | 60 | struct line_desc_scroll *get_line_desc(void) NOINLINE; |
61 | struct line_desc_scroll *get_line_desc(void) | ||
55 | { | 62 | { |
56 | static struct line_desc lines[MAX_LINES]; | 63 | static struct line_desc_scroll lines[MAX_LINES]; |
57 | static unsigned line_index; | 64 | static unsigned line_index; |
58 | struct line_desc *ret; | 65 | struct line_desc_scroll *this; |
59 | 66 | ||
60 | ret = &lines[line_index++]; | 67 | do { |
61 | if (line_index >= ARRAYLEN(lines)) | 68 | this = &lines[line_index++]; |
62 | line_index = 0; | 69 | if (line_index >= ARRAYLEN(lines)) |
70 | line_index = 0; | ||
71 | } while (this->used); | ||
63 | 72 | ||
64 | return ret; | 73 | return this; |
65 | } | 74 | } |
66 | 75 | ||
67 | static void scroller(struct scrollinfo *s, struct screen *display) | 76 | static void scroller(struct scrollinfo *s, struct screen *display) |
@@ -72,9 +81,17 @@ static void scroller(struct scrollinfo *s, struct screen *display) | |||
72 | * line padding. this needs to be corrected for calling style_line(). | 81 | * line padding. this needs to be corrected for calling style_line(). |
73 | * The alternative would be to really redraw only the text area, | 82 | * The alternative would be to really redraw only the text area, |
74 | * but that would complicate the code a lot */ | 83 | * but that would complicate the code a lot */ |
75 | struct line_desc *line = s->userdata; | 84 | struct line_desc_scroll *line = s->userdata; |
76 | style_line(display, s->x, s->y - (line->height/2 - display->getcharheight()/2), line); | 85 | if (!s->line) |
77 | put_text(display, s->x, s->y, line, s->line, true, s->offset); | 86 | { |
87 | line->used = false; | ||
88 | } | ||
89 | else | ||
90 | if (s->line) | ||
91 | { | ||
92 | style_line(display, s->x, s->y - (line->desc.height/2 - display->getcharheight()/2), &line->desc); | ||
93 | put_text(display, s->x, s->y, &line->desc, s->line, true, s->offset); | ||
94 | } | ||
78 | } | 95 | } |
79 | 96 | ||
80 | static void scroller_main(struct scrollinfo *s) | 97 | static void scroller_main(struct scrollinfo *s) |
@@ -126,14 +143,16 @@ static void put_text(struct screen *display, | |||
126 | 143 | ||
127 | if (line->scroll && !prevent_scroll) | 144 | if (line->scroll && !prevent_scroll) |
128 | { | 145 | { |
129 | struct line_desc *line_data = get_line_desc(); | 146 | bool scrolls; |
130 | *line_data = *line; | 147 | struct line_desc_scroll *line_data = get_line_desc(); |
148 | line_data->desc = *line; | ||
131 | /* precalculate to avoid doing it in the scroller, it's save to | 149 | /* precalculate to avoid doing it in the scroller, it's save to |
132 | * do this on the copy of the original line_desc*/ | 150 | * do this on the copy of the original line_desc*/ |
133 | if (line_data->height == -1) | 151 | if (line_data->desc.height == -1) |
134 | line_data->height = display->getcharheight(); | 152 | line_data->desc.height = display->getcharheight(); |
135 | display->putsxy_scroll_func(x, y, text, | 153 | scrolls = display->putsxy_scroll_func(x, y, text, |
136 | scrollers[display->screen_type], line_data, text_skip_pixels); | 154 | scrollers[display->screen_type], line_data, text_skip_pixels); |
155 | line_data->used = scrolls; | ||
137 | } | 156 | } |
138 | else | 157 | else |
139 | display->putsxy_scroll_func(x, y, text, NULL, NULL, text_skip_pixels); | 158 | display->putsxy_scroll_func(x, y, text, NULL, NULL, text_skip_pixels); |
diff --git a/apps/plugin.h b/apps/plugin.h index 2cf40d5758..5d6527d7a4 100644 --- a/apps/plugin.h +++ b/apps/plugin.h | |||
@@ -197,7 +197,7 @@ struct plugin_api { | |||
197 | void (*lcd_putsxyf)(int x, int y, const unsigned char *fmt, ...); | 197 | void (*lcd_putsxyf)(int x, int y, const unsigned char *fmt, ...); |
198 | void (*lcd_puts)(int x, int y, const unsigned char *string); | 198 | void (*lcd_puts)(int x, int y, const unsigned char *string); |
199 | void (*lcd_putsf)(int x, int y, const unsigned char *fmt, ...); | 199 | void (*lcd_putsf)(int x, int y, const unsigned char *fmt, ...); |
200 | void (*lcd_puts_scroll)(int x, int y, const unsigned char* string); | 200 | bool (*lcd_puts_scroll)(int x, int y, const unsigned char* string); |
201 | void (*lcd_scroll_stop)(void); | 201 | void (*lcd_scroll_stop)(void); |
202 | #ifdef HAVE_LCD_CHARCELLS | 202 | #ifdef HAVE_LCD_CHARCELLS |
203 | void (*lcd_define_pattern)(unsigned long ucs, const char *pattern); | 203 | void (*lcd_define_pattern)(unsigned long ucs, const char *pattern); |
diff --git a/apps/screen_access.h b/apps/screen_access.h index 7efc38b174..c4a87849b8 100644 --- a/apps/screen_access.h +++ b/apps/screen_access.h | |||
@@ -126,8 +126,8 @@ struct screen | |||
126 | void (*putsxy)(int x, int y, const unsigned char *str); | 126 | void (*putsxy)(int x, int y, const unsigned char *str); |
127 | void (*puts)(int x, int y, const unsigned char *str); | 127 | void (*puts)(int x, int y, const unsigned char *str); |
128 | void (*putsf)(int x, int y, const unsigned char *str, ...); | 128 | void (*putsf)(int x, int y, const unsigned char *str, ...); |
129 | void (*puts_scroll)(int x, int y, const unsigned char *string); | 129 | bool (*puts_scroll)(int x, int y, const unsigned char *string); |
130 | void (*putsxy_scroll_func)(int x, int y, const unsigned char *string, | 130 | bool (*putsxy_scroll_func)(int x, int y, const unsigned char *string, |
131 | void (*scroll_func)(struct scrollinfo *), | 131 | void (*scroll_func)(struct scrollinfo *), |
132 | void *data, int x_offset); | 132 | void *data, int x_offset); |
133 | void (*scroll_speed)(int speed); | 133 | void (*scroll_speed)(int speed); |