summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apps/gui/icon.c33
-rw-r--r--apps/screen_access.c26
-rw-r--r--apps/screen_access.h13
3 files changed, 37 insertions, 35 deletions
diff --git a/apps/gui/icon.c b/apps/gui/icon.c
index 93b1643cd9..cc92b96c27 100644
--- a/apps/gui/icon.c
+++ b/apps/gui/icon.c
@@ -116,16 +116,14 @@ void screen_put_icon_with_offset(struct screen * display,
116} 116}
117 117
118/* x,y in pixels */ 118/* x,y in pixels */
119typedef void (*lcd_draw_func)(const fb_data *src, int src_x, int src_y, 119void screen_put_iconxy(struct screen * display,
120 int stride, int x, int y, int width, int height);
121void screen_put_iconxy(struct screen * display,
122 int xpos, int ypos, enum themable_icons icon) 120 int xpos, int ypos, enum themable_icons icon)
123{ 121{
124 fb_data *data; 122 const void *data;
125 int screen = display->screen_type; 123 int screen = display->screen_type;
126 int width = ICON_WIDTH(screen); 124 int width = ICON_WIDTH(screen);
127 int height = ICON_HEIGHT(screen); 125 int height = ICON_HEIGHT(screen);
128 lcd_draw_func draw_func = NULL; 126 screen_bitmap_part_func *draw_func = NULL;
129 127
130 if (icon == Icon_NOICON) 128 if (icon == Icon_NOICON)
131 { 129 {
@@ -148,37 +146,28 @@ void screen_put_iconxy(struct screen * display,
148 screen_clear_area(display, xpos, ypos, width, height); 146 screen_clear_area(display, xpos, ypos, width, height);
149 return; 147 return;
150 } 148 }
151 data = (fb_data *)viewer_iconset[screen].data; 149 data = viewer_iconset[screen].data;
152 } 150 }
153 else if (custom_icons_loaded[screen]) 151 else if (custom_icons_loaded[screen])
154 { 152 {
155 data = (fb_data *)user_iconset[screen].data; 153 data = user_iconset[screen].data;
156 } 154 }
157 else 155 else
158 { 156 {
159 data = (fb_data *)inbuilt_icons[screen]; 157 data = inbuilt_icons[screen];
160 } 158 }
161 /* add some left padding to the icons if they are on the edge */ 159 /* add some left padding to the icons if they are on the edge */
162 if (xpos == 0) 160 if (xpos == 0)
163 xpos++; 161 xpos++;
164 162
165#ifdef HAVE_REMOTE_LCD 163#if (LCD_DEPTH == 16) || (LCD_REMOTE_DEPTH == 16)
166 if (display->screen_type == SCREEN_REMOTE) 164 if (display->depth == 16)
167 { 165 draw_func = display->transparent_bitmap_part;
168 /* Quick and Dirty hack untill lcd bitmap drawing is fixed */
169 draw_func = (lcd_draw_func)lcd_remote_bitmap_part;
170 }
171 else 166 else
172#endif 167#endif
173#if LCD_DEPTH == 16
174 draw_func = display->transparent_bitmap_part;
175#else /* LCD_DEPTH < 16 */
176 draw_func = display->bitmap_part; 168 draw_func = display->bitmap_part;
177#endif /* LCD_DEPTH == 16 */ 169
178 170 draw_func(data, 0, height * icon, width, xpos, ypos, width, height);
179 draw_func( (const fb_data *)data,
180 0, height * icon, width, xpos, ypos,
181 width, height);
182} 171}
183 172
184void screen_put_cursorxy(struct screen * display, int x, int y, bool on) 173void screen_put_cursorxy(struct screen * display, int x, int y, bool on)
diff --git a/apps/screen_access.c b/apps/screen_access.c
index 03687a3dbb..a642b65d20 100644
--- a/apps/screen_access.c
+++ b/apps/screen_access.c
@@ -52,7 +52,15 @@ void screen_init(struct screen * screen, enum screen_type screen_type)
52 screen->setfont(FONT_UI); 52 screen->setfont(FONT_UI);
53 screen->mono_bitmap=&lcd_remote_mono_bitmap; 53 screen->mono_bitmap=&lcd_remote_mono_bitmap;
54 screen->mono_bitmap_part=&lcd_remote_mono_bitmap_part; 54 screen->mono_bitmap_part=&lcd_remote_mono_bitmap_part;
55 screen->bitmap=(screen_bitmap_func*)&lcd_remote_bitmap;
56 screen->bitmap_part=(screen_bitmap_part_func*)&lcd_remote_bitmap_part;
55 screen->set_drawmode=&lcd_remote_set_drawmode; 57 screen->set_drawmode=&lcd_remote_set_drawmode;
58#if LCD_DEPTH <= 2
59 /* No transparency yet for grayscale and mono lcd */
60 screen->transparent_bitmap=(screen_bitmap_func*)&lcd_remote_bitmap;
61 screen->transparent_bitmap_part=(screen_bitmap_part_func*)&lcd_remote_bitmap_part;
62 /* No colour remotes yet */
63#endif
56#if LCD_REMOTE_DEPTH > 1 64#if LCD_REMOTE_DEPTH > 1
57#if defined(HAVE_LCD_COLOR) 65#if defined(HAVE_LCD_COLOR)
58 screen->color_to_native=&lcd_remote_color_to_native; 66 screen->color_to_native=&lcd_remote_color_to_native;
@@ -122,17 +130,17 @@ void screen_init(struct screen * screen, enum screen_type screen_type)
122 screen->mono_bitmap=&lcd_mono_bitmap; 130 screen->mono_bitmap=&lcd_mono_bitmap;
123 screen->mono_bitmap_part=&lcd_mono_bitmap_part; 131 screen->mono_bitmap_part=&lcd_mono_bitmap_part;
124 screen->set_drawmode=&lcd_set_drawmode; 132 screen->set_drawmode=&lcd_set_drawmode;
125#if LCD_DEPTH > 1 133 screen->bitmap=(screen_bitmap_func*)&lcd_bitmap;
126 screen->bitmap=&lcd_bitmap; 134 screen->bitmap_part=(screen_bitmap_part_func*)&lcd_bitmap_part;
127 screen->bitmap_part=&lcd_bitmap_part; 135#if LCD_DEPTH <= 2
128#if LCD_DEPTH == 2 136 /* No transparency yet for grayscale and mono lcd */
129 /* No transparency yet for grayscale lcd */ 137 screen->transparent_bitmap=(screen_bitmap_func*)&lcd_bitmap;
130 screen->transparent_bitmap=&lcd_bitmap; 138 screen->transparent_bitmap_part=(screen_bitmap_part_func*)&lcd_bitmap_part;
131 screen->transparent_bitmap_part=&lcd_bitmap_part;
132#else 139#else
133 screen->transparent_bitmap=&lcd_bitmap_transparent; 140 screen->transparent_bitmap=(screen_bitmap_func*)&lcd_bitmap_transparent;
134 screen->transparent_bitmap_part=&lcd_bitmap_transparent_part; 141 screen->transparent_bitmap_part=(screen_bitmap_part_func*)&lcd_bitmap_transparent_part;
135#endif 142#endif
143#if LCD_DEPTH > 1
136#if defined(HAVE_LCD_COLOR) && defined(LCD_REMOTE_DEPTH) && LCD_REMOTE_DEPTH > 1 144#if defined(HAVE_LCD_COLOR) && defined(LCD_REMOTE_DEPTH) && LCD_REMOTE_DEPTH > 1
137 screen->color_to_native=&lcd_color_to_native; 145 screen->color_to_native=&lcd_color_to_native;
138#endif 146#endif
diff --git a/apps/screen_access.h b/apps/screen_access.h
index bc5fdf3f55..e40943f003 100644
--- a/apps/screen_access.h
+++ b/apps/screen_access.h
@@ -46,6 +46,11 @@ enum screen_type {
46#define MAX_LINES_ON_SCREEN 2 46#define MAX_LINES_ON_SCREEN 2
47#endif 47#endif
48 48
49typedef void screen_bitmap_part_func(const void *src, int src_x, int src_y,
50 int stride, int x, int y, int width, int height);
51typedef void screen_bitmap_func(const void *src, int x, int y, int width,
52 int height);
53
49struct screen 54struct screen
50{ 55{
51 int width, height; 56 int width, height;
@@ -79,13 +84,13 @@ struct screen
79 int x, int y, int width, int height); 84 int x, int y, int width, int height);
80 void (*mono_bitmap_part)(const unsigned char *src, int src_x, int src_y, 85 void (*mono_bitmap_part)(const unsigned char *src, int src_x, int src_y,
81 int stride, int x, int y, int width, int height); 86 int stride, int x, int y, int width, int height);
82 void (*bitmap)(const fb_data *src, 87 void (*bitmap)(const void *src,
83 int x, int y, int width, int height); 88 int x, int y, int width, int height);
84 void (*bitmap_part)(const fb_data *src, int src_x, int src_y, 89 void (*bitmap_part)(const void *src, int src_x, int src_y,
85 int stride, int x, int y, int width, int height); 90 int stride, int x, int y, int width, int height);
86 void (*transparent_bitmap)(const fb_data *src, 91 void (*transparent_bitmap)(const void *src,
87 int x, int y, int width, int height); 92 int x, int y, int width, int height);
88 void (*transparent_bitmap_part)(const fb_data *src, int src_x, int src_y, 93 void (*transparent_bitmap_part)(const void *src, int src_x, int src_y,
89 int stride, int x, int y, int width, int height); 94 int stride, int x, int y, int width, int height);
90 void (*set_drawmode)(int mode); 95 void (*set_drawmode)(int mode);
91#if defined(HAVE_LCD_COLOR) && defined(LCD_REMOTE_DEPTH) && LCD_REMOTE_DEPTH > 1 96#if defined(HAVE_LCD_COLOR) && defined(LCD_REMOTE_DEPTH) && LCD_REMOTE_DEPTH > 1