summaryrefslogtreecommitdiff
path: root/apps/plugins/lib
diff options
context:
space:
mode:
authorThomas Martitz <kugel@rockbox.org>2014-06-18 07:15:00 +0200
committerThomas Martitz <kugel@rockbox.org>2014-06-21 00:15:53 +0200
commita1842c04f9cb73210d4cacde61a9e4b115050765 (patch)
treea37af61ef9285b763a42cd33797e2f3d634fbf9f /apps/plugins/lib
parent0250be1d6799db7b5ddc99cb33f31bf9cff01ed2 (diff)
downloadrockbox-a1842c04f9cb73210d4cacde61a9e4b115050765.tar.gz
rockbox-a1842c04f9cb73210d4cacde61a9e4b115050765.zip
lcd-24bit: Introduce a 24-bit mid-level LCD driver
With LCD driver all calculation will be performed on RGB888 and the hardware/OS can display from our 24bit framebuffer. It is not yet as performance optimized as the existing drivers but should be good enough.The vast number of small changes is due to the fact that fb_data can be a struct type now, while most of the code expected a scalar type. lcd-as-memframe ASM code does not work with 24bit currently so the with 24bit it enforces the generic C code. All plugins are ported over. Except for rockpaint. It uses so much memory that it wouldnt fit into the 512k plugin buffer anymore (patches welcome). Change-Id: Ibb1964545028ce0d8ff9833ccc3ab66be3ee0754
Diffstat (limited to 'apps/plugins/lib')
-rw-r--r--apps/plugins/lib/bmp_smooth_scale.c186
-rw-r--r--apps/plugins/lib/osd.c3
-rw-r--r--apps/plugins/lib/pluginlib_bmp.c6
-rw-r--r--apps/plugins/lib/xlcd_draw.c12
4 files changed, 109 insertions, 98 deletions
diff --git a/apps/plugins/lib/bmp_smooth_scale.c b/apps/plugins/lib/bmp_smooth_scale.c
index e99ff33d71..c5f258cdbf 100644
--- a/apps/plugins/lib/bmp_smooth_scale.c
+++ b/apps/plugins/lib/bmp_smooth_scale.c
@@ -130,38 +130,38 @@ void smooth_resize_bitmap(struct bitmap *src_bmp, struct bitmap *dest_bmp)
130 130
131 if (XAP > 0) { 131 if (XAP > 0) {
132 pix = ypoint + xpoint; 132 pix = ypoint + xpoint;
133 r = RGB_UNPACK_RED(*pix) * INV_XAP; 133 r = FB_UNPACK_RED(*pix) * INV_XAP;
134 g = RGB_UNPACK_GREEN(*pix) * INV_XAP; 134 g = FB_UNPACK_GREEN(*pix) * INV_XAP;
135 b = RGB_UNPACK_BLUE(*pix) * INV_XAP; 135 b = FB_UNPACK_BLUE(*pix) * INV_XAP;
136 pix++; 136 pix++;
137 r += RGB_UNPACK_RED(*pix) * XAP; 137 r += FB_UNPACK_RED(*pix) * XAP;
138 g += RGB_UNPACK_GREEN(*pix) * XAP; 138 g += FB_UNPACK_GREEN(*pix) * XAP;
139 b += RGB_UNPACK_BLUE(*pix) * XAP; 139 b += FB_UNPACK_BLUE(*pix) * XAP;
140 pix += sow; 140 pix += sow;
141 rr = RGB_UNPACK_RED(*pix) * XAP; 141 rr = FB_UNPACK_RED(*pix) * XAP;
142 gg = RGB_UNPACK_GREEN(*pix) * XAP; 142 gg = FB_UNPACK_GREEN(*pix) * XAP;
143 bb = RGB_UNPACK_BLUE(*pix) * XAP; 143 bb = FB_UNPACK_BLUE(*pix) * XAP;
144 pix--; 144 pix--;
145 rr += RGB_UNPACK_RED(*pix) * INV_XAP; 145 rr += FB_UNPACK_RED(*pix) * INV_XAP;
146 gg += RGB_UNPACK_GREEN(*pix) * INV_XAP; 146 gg += FB_UNPACK_GREEN(*pix) * INV_XAP;
147 bb += RGB_UNPACK_BLUE(*pix) * INV_XAP; 147 bb += FB_UNPACK_BLUE(*pix) * INV_XAP;
148 r = ((rr * YAP) + (r * INV_YAP)) >> 16; 148 r = ((rr * YAP) + (r * INV_YAP)) >> 16;
149 g = ((gg * YAP) + (g * INV_YAP)) >> 16; 149 g = ((gg * YAP) + (g * INV_YAP)) >> 16;
150 b = ((bb * YAP) + (b * INV_YAP)) >> 16; 150 b = ((bb * YAP) + (b * INV_YAP)) >> 16;
151 *dptr++ = LCD_RGBPACK(r, g, b); 151 *dptr++ = FB_RGBPACK(r, g, b);
152 } else { 152 } else {
153 pix = ypoint + xpoint; 153 pix = ypoint + xpoint;
154 r = RGB_UNPACK_RED(*pix) * INV_YAP; 154 r = FB_UNPACK_RED(*pix) * INV_YAP;
155 g = RGB_UNPACK_GREEN(*pix) * INV_YAP; 155 g = FB_UNPACK_GREEN(*pix) * INV_YAP;
156 b = RGB_UNPACK_BLUE(*pix) * INV_YAP; 156 b = FB_UNPACK_BLUE(*pix) * INV_YAP;
157 pix += sow; 157 pix += sow;
158 r += RGB_UNPACK_RED(*pix) * YAP; 158 r += FB_UNPACK_RED(*pix) * YAP;
159 g += RGB_UNPACK_GREEN(*pix) * YAP; 159 g += FB_UNPACK_GREEN(*pix) * YAP;
160 b += RGB_UNPACK_BLUE(*pix) * YAP; 160 b += FB_UNPACK_BLUE(*pix) * YAP;
161 r >>= 8; 161 r >>= 8;
162 g >>= 8; 162 g >>= 8;
163 b >>= 8; 163 b >>= 8;
164 *dptr++ = LCD_RGBPACK(r, g, b); 164 *dptr++ = FB_RGBPACK(r, g, b);
165 } 165 }
166 } 166 }
167 } else { 167 } else {
@@ -176,17 +176,17 @@ void smooth_resize_bitmap(struct bitmap *src_bmp, struct bitmap *dest_bmp)
176 176
177 if (XAP > 0) { 177 if (XAP > 0) {
178 pix = ypoint + xpoint; 178 pix = ypoint + xpoint;
179 r = RGB_UNPACK_RED(*pix) * INV_XAP; 179 r = FB_UNPACK_RED(*pix) * INV_XAP;
180 g = RGB_UNPACK_GREEN(*pix) * INV_XAP; 180 g = FB_UNPACK_GREEN(*pix) * INV_XAP;
181 b = RGB_UNPACK_BLUE(*pix) * INV_XAP; 181 b = FB_UNPACK_BLUE(*pix) * INV_XAP;
182 pix++; 182 pix++;
183 r += RGB_UNPACK_RED(*pix) * XAP; 183 r += FB_UNPACK_RED(*pix) * XAP;
184 g += RGB_UNPACK_GREEN(*pix) * XAP; 184 g += FB_UNPACK_GREEN(*pix) * XAP;
185 b += RGB_UNPACK_BLUE(*pix) * XAP; 185 b += FB_UNPACK_BLUE(*pix) * XAP;
186 r >>= 8; 186 r >>= 8;
187 g >>= 8; 187 g >>= 8;
188 b >>= 8; 188 b >>= 8;
189 *dptr++ = LCD_RGBPACK(r, g, b); 189 *dptr++ = FB_RGBPACK(r, g, b);
190 } else 190 } else
191 *dptr++ = sptr[xpoint]; 191 *dptr++ = sptr[xpoint];
192 } 192 }
@@ -221,37 +221,37 @@ void smooth_resize_bitmap(struct bitmap *src_bmp, struct bitmap *dest_bmp)
221 val_x += inc_x; 221 val_x += inc_x;
222 222
223 pix = ypoint + xpoint; 223 pix = ypoint + xpoint;
224 r = (RGB_UNPACK_RED(*pix) * yap) >> 10; 224 r = (FB_UNPACK_RED(*pix) * yap) >> 10;
225 g = (RGB_UNPACK_GREEN(*pix) * yap) >> 10; 225 g = (FB_UNPACK_GREEN(*pix) * yap) >> 10;
226 b = (RGB_UNPACK_BLUE(*pix) * yap) >> 10; 226 b = (FB_UNPACK_BLUE(*pix) * yap) >> 10;
227 pix += sow; 227 pix += sow;
228 for (j = (1 << 14) - yap; j > Cy; j -= Cy) { 228 for (j = (1 << 14) - yap; j > Cy; j -= Cy) {
229 r += (RGB_UNPACK_RED(*pix) * Cy) >> 10; 229 r += (FB_UNPACK_RED(*pix) * Cy) >> 10;
230 g += (RGB_UNPACK_GREEN(*pix) * Cy) >> 10; 230 g += (FB_UNPACK_GREEN(*pix) * Cy) >> 10;
231 b += (RGB_UNPACK_BLUE(*pix) * Cy) >> 10; 231 b += (FB_UNPACK_BLUE(*pix) * Cy) >> 10;
232 pix += sow; 232 pix += sow;
233 } 233 }
234 if (j > 0) { 234 if (j > 0) {
235 r += (RGB_UNPACK_RED(*pix) * j) >> 10; 235 r += (FB_UNPACK_RED(*pix) * j) >> 10;
236 g += (RGB_UNPACK_GREEN(*pix) * j) >> 10; 236 g += (FB_UNPACK_GREEN(*pix) * j) >> 10;
237 b += (RGB_UNPACK_BLUE(*pix) * j) >> 10; 237 b += (FB_UNPACK_BLUE(*pix) * j) >> 10;
238 } 238 }
239 if (XAP > 0) { 239 if (XAP > 0) {
240 pix = ypoint + xpoint + 1; 240 pix = ypoint + xpoint + 1;
241 rr = (RGB_UNPACK_RED(*pix) * yap) >> 10; 241 rr = (FB_UNPACK_RED(*pix) * yap) >> 10;
242 gg = (RGB_UNPACK_GREEN(*pix) * yap) >> 10; 242 gg = (FB_UNPACK_GREEN(*pix) * yap) >> 10;
243 bb = (RGB_UNPACK_BLUE(*pix) * yap) >> 10; 243 bb = (FB_UNPACK_BLUE(*pix) * yap) >> 10;
244 pix += sow; 244 pix += sow;
245 for (j = (1 << 14) - yap; j > Cy; j -= Cy) { 245 for (j = (1 << 14) - yap; j > Cy; j -= Cy) {
246 rr += (RGB_UNPACK_RED(*pix) * Cy) >> 10; 246 rr += (FB_UNPACK_RED(*pix) * Cy) >> 10;
247 gg += (RGB_UNPACK_GREEN(*pix) * Cy) >> 10; 247 gg += (FB_UNPACK_GREEN(*pix) * Cy) >> 10;
248 bb += (RGB_UNPACK_BLUE(*pix) * Cy) >> 10; 248 bb += (FB_UNPACK_BLUE(*pix) * Cy) >> 10;
249 pix += sow; 249 pix += sow;
250 } 250 }
251 if (j > 0) { 251 if (j > 0) {
252 rr += (RGB_UNPACK_RED(*pix) * j) >> 10; 252 rr += (FB_UNPACK_RED(*pix) * j) >> 10;
253 gg += (RGB_UNPACK_GREEN(*pix) * j) >> 10; 253 gg += (FB_UNPACK_GREEN(*pix) * j) >> 10;
254 bb += (RGB_UNPACK_BLUE(*pix) * j) >> 10; 254 bb += (FB_UNPACK_BLUE(*pix) * j) >> 10;
255 } 255 }
256 r = r * INV_XAP; 256 r = r * INV_XAP;
257 g = g * INV_XAP; 257 g = g * INV_XAP;
@@ -264,7 +264,7 @@ void smooth_resize_bitmap(struct bitmap *src_bmp, struct bitmap *dest_bmp)
264 g >>= 4; 264 g >>= 4;
265 b >>= 4; 265 b >>= 4;
266 } 266 }
267 *dptr = LCD_RGBPACK(r, g, b); 267 *dptr = FB_RGBPACK(r, g, b);
268 dptr++; 268 dptr++;
269 } 269 }
270 } 270 }
@@ -297,37 +297,37 @@ void smooth_resize_bitmap(struct bitmap *src_bmp, struct bitmap *dest_bmp)
297 xap = XAP & 0xffff; 297 xap = XAP & 0xffff;
298 298
299 pix = ypoint + xpoint; 299 pix = ypoint + xpoint;
300 r = (RGB_UNPACK_RED(*pix) * xap) >> 10; 300 r = (FB_UNPACK_RED(*pix) * xap) >> 10;
301 g = (RGB_UNPACK_GREEN(*pix) * xap) >> 10; 301 g = (FB_UNPACK_GREEN(*pix) * xap) >> 10;
302 b = (RGB_UNPACK_BLUE(*pix) * xap) >> 10; 302 b = (FB_UNPACK_BLUE(*pix) * xap) >> 10;
303 pix++; 303 pix++;
304 for (j = (1 << 14) - xap; j > Cx; j -= Cx) { 304 for (j = (1 << 14) - xap; j > Cx; j -= Cx) {
305 r += (RGB_UNPACK_RED(*pix) * Cx) >> 10; 305 r += (FB_UNPACK_RED(*pix) * Cx) >> 10;
306 g += (RGB_UNPACK_GREEN(*pix) * Cx) >> 10; 306 g += (FB_UNPACK_GREEN(*pix) * Cx) >> 10;
307 b += (RGB_UNPACK_BLUE(*pix) * Cx) >> 10; 307 b += (FB_UNPACK_BLUE(*pix) * Cx) >> 10;
308 pix++; 308 pix++;
309 } 309 }
310 if (j > 0) { 310 if (j > 0) {
311 r += (RGB_UNPACK_RED(*pix) * j) >> 10; 311 r += (FB_UNPACK_RED(*pix) * j) >> 10;
312 g += (RGB_UNPACK_GREEN(*pix) * j) >> 10; 312 g += (FB_UNPACK_GREEN(*pix) * j) >> 10;
313 b += (RGB_UNPACK_BLUE(*pix) * j) >> 10; 313 b += (FB_UNPACK_BLUE(*pix) * j) >> 10;
314 } 314 }
315 if (YAP > 0) { 315 if (YAP > 0) {
316 pix = ypoint + xpoint + sow; 316 pix = ypoint + xpoint + sow;
317 rr = (RGB_UNPACK_RED(*pix) * xap) >> 10; 317 rr = (FB_UNPACK_RED(*pix) * xap) >> 10;
318 gg = (RGB_UNPACK_GREEN(*pix) * xap) >> 10; 318 gg = (FB_UNPACK_GREEN(*pix) * xap) >> 10;
319 bb = (RGB_UNPACK_BLUE(*pix) * xap) >> 10; 319 bb = (FB_UNPACK_BLUE(*pix) * xap) >> 10;
320 pix++; 320 pix++;
321 for (j = (1 << 14) - xap; j > Cx; j -= Cx) { 321 for (j = (1 << 14) - xap; j > Cx; j -= Cx) {
322 rr += (RGB_UNPACK_RED(*pix) * Cx) >> 10; 322 rr += (FB_UNPACK_RED(*pix) * Cx) >> 10;
323 gg += (RGB_UNPACK_GREEN(*pix) * Cx) >> 10; 323 gg += (FB_UNPACK_GREEN(*pix) * Cx) >> 10;
324 bb += (RGB_UNPACK_BLUE(*pix) * Cx) >> 10; 324 bb += (FB_UNPACK_BLUE(*pix) * Cx) >> 10;
325 pix++; 325 pix++;
326 } 326 }
327 if (j > 0) { 327 if (j > 0) {
328 rr += (RGB_UNPACK_RED(*pix) * j) >> 10; 328 rr += (FB_UNPACK_RED(*pix) * j) >> 10;
329 gg += (RGB_UNPACK_GREEN(*pix) * j) >> 10; 329 gg += (FB_UNPACK_GREEN(*pix) * j) >> 10;
330 bb += (RGB_UNPACK_BLUE(*pix) * j) >> 10; 330 bb += (FB_UNPACK_BLUE(*pix) * j) >> 10;
331 } 331 }
332 r = r * INV_YAP; 332 r = r * INV_YAP;
333 g = g * INV_YAP; 333 g = g * INV_YAP;
@@ -340,7 +340,7 @@ void smooth_resize_bitmap(struct bitmap *src_bmp, struct bitmap *dest_bmp)
340 g >>= 4; 340 g >>= 4;
341 b >>= 4; 341 b >>= 4;
342 } 342 }
343 *dptr = LCD_RGBPACK(r, g, b); 343 *dptr = FB_RGBPACK(r, g, b);
344 dptr++; 344 dptr++;
345 } 345 }
346 } 346 }
@@ -378,20 +378,20 @@ void smooth_resize_bitmap(struct bitmap *src_bmp, struct bitmap *dest_bmp)
378 378
379 pix = sptr; 379 pix = sptr;
380 sptr += sow; 380 sptr += sow;
381 rx = (RGB_UNPACK_RED(*pix) * xap) >> 9; 381 rx = (FB_UNPACK_RED(*pix) * xap) >> 9;
382 gx = (RGB_UNPACK_GREEN(*pix) * xap) >> 9; 382 gx = (FB_UNPACK_GREEN(*pix) * xap) >> 9;
383 bx = (RGB_UNPACK_BLUE(*pix) * xap) >> 9; 383 bx = (FB_UNPACK_BLUE(*pix) * xap) >> 9;
384 pix++; 384 pix++;
385 for (i = (1 << 14) - xap; i > Cx; i -= Cx) { 385 for (i = (1 << 14) - xap; i > Cx; i -= Cx) {
386 rx += (RGB_UNPACK_RED(*pix) * Cx) >> 9; 386 rx += (FB_UNPACK_RED(*pix) * Cx) >> 9;
387 gx += (RGB_UNPACK_GREEN(*pix) * Cx) >> 9; 387 gx += (FB_UNPACK_GREEN(*pix) * Cx) >> 9;
388 bx += (RGB_UNPACK_BLUE(*pix) * Cx) >> 9; 388 bx += (FB_UNPACK_BLUE(*pix) * Cx) >> 9;
389 pix++; 389 pix++;
390 } 390 }
391 if (i > 0) { 391 if (i > 0) {
392 rx += (RGB_UNPACK_RED(*pix) * i) >> 9; 392 rx += (FB_UNPACK_RED(*pix) * i) >> 9;
393 gx += (RGB_UNPACK_GREEN(*pix) * i) >> 9; 393 gx += (FB_UNPACK_GREEN(*pix) * i) >> 9;
394 bx += (RGB_UNPACK_BLUE(*pix) * i) >> 9; 394 bx += (FB_UNPACK_BLUE(*pix) * i) >> 9;
395 } 395 }
396 396
397 r = (rx * yap) >> 14; 397 r = (rx * yap) >> 14;
@@ -401,20 +401,20 @@ void smooth_resize_bitmap(struct bitmap *src_bmp, struct bitmap *dest_bmp)
401 for (j = (1 << 14) - yap; j > Cy; j -= Cy) { 401 for (j = (1 << 14) - yap; j > Cy; j -= Cy) {
402 pix = sptr; 402 pix = sptr;
403 sptr += sow; 403 sptr += sow;
404 rx = (RGB_UNPACK_RED(*pix) * xap) >> 9; 404 rx = (FB_UNPACK_RED(*pix) * xap) >> 9;
405 gx = (RGB_UNPACK_GREEN(*pix) * xap) >> 9; 405 gx = (FB_UNPACK_GREEN(*pix) * xap) >> 9;
406 bx = (RGB_UNPACK_BLUE(*pix) * xap) >> 9; 406 bx = (FB_UNPACK_BLUE(*pix) * xap) >> 9;
407 pix++; 407 pix++;
408 for (i = (1 << 14) - xap; i > Cx; i -= Cx) { 408 for (i = (1 << 14) - xap; i > Cx; i -= Cx) {
409 rx += (RGB_UNPACK_RED(*pix) * Cx) >> 9; 409 rx += (FB_UNPACK_RED(*pix) * Cx) >> 9;
410 gx += (RGB_UNPACK_GREEN(*pix) * Cx) >> 9; 410 gx += (FB_UNPACK_GREEN(*pix) * Cx) >> 9;
411 bx += (RGB_UNPACK_BLUE(*pix) * Cx) >> 9; 411 bx += (FB_UNPACK_BLUE(*pix) * Cx) >> 9;
412 pix++; 412 pix++;
413 } 413 }
414 if (i > 0) { 414 if (i > 0) {
415 rx += (RGB_UNPACK_RED(*pix) * i) >> 9; 415 rx += (FB_UNPACK_RED(*pix) * i) >> 9;
416 gx += (RGB_UNPACK_GREEN(*pix) * i) >> 9; 416 gx += (FB_UNPACK_GREEN(*pix) * i) >> 9;
417 bx += (RGB_UNPACK_BLUE(*pix) * i) >> 9; 417 bx += (FB_UNPACK_BLUE(*pix) * i) >> 9;
418 } 418 }
419 419
420 r += (rx * Cy) >> 14; 420 r += (rx * Cy) >> 14;
@@ -424,20 +424,20 @@ void smooth_resize_bitmap(struct bitmap *src_bmp, struct bitmap *dest_bmp)
424 if (j > 0) { 424 if (j > 0) {
425 pix = sptr; 425 pix = sptr;
426 sptr += sow; 426 sptr += sow;
427 rx = (RGB_UNPACK_RED(*pix) * xap) >> 9; 427 rx = (FB_UNPACK_RED(*pix) * xap) >> 9;
428 gx = (RGB_UNPACK_GREEN(*pix) * xap) >> 9; 428 gx = (FB_UNPACK_GREEN(*pix) * xap) >> 9;
429 bx = (RGB_UNPACK_BLUE(*pix) * xap) >> 9; 429 bx = (FB_UNPACK_BLUE(*pix) * xap) >> 9;
430 pix++; 430 pix++;
431 for (i = (1 << 14) - xap; i > Cx; i -= Cx) { 431 for (i = (1 << 14) - xap; i > Cx; i -= Cx) {
432 rx += (RGB_UNPACK_RED(*pix) * Cx) >> 9; 432 rx += (FB_UNPACK_RED(*pix) * Cx) >> 9;
433 gx += (RGB_UNPACK_GREEN(*pix) * Cx) >> 9; 433 gx += (FB_UNPACK_GREEN(*pix) * Cx) >> 9;
434 bx += (RGB_UNPACK_BLUE(*pix) * Cx) >> 9; 434 bx += (FB_UNPACK_BLUE(*pix) * Cx) >> 9;
435 pix++; 435 pix++;
436 } 436 }
437 if (i > 0) { 437 if (i > 0) {
438 rx += (RGB_UNPACK_RED(*pix) * i) >> 9; 438 rx += (FB_UNPACK_RED(*pix) * i) >> 9;
439 gx += (RGB_UNPACK_GREEN(*pix) * i) >> 9; 439 gx += (FB_UNPACK_GREEN(*pix) * i) >> 9;
440 bx += (RGB_UNPACK_BLUE(*pix) * i) >> 9; 440 bx += (FB_UNPACK_BLUE(*pix) * i) >> 9;
441 } 441 }
442 442
443 r += (rx * j) >> 14; 443 r += (rx * j) >> 14;
@@ -445,7 +445,7 @@ void smooth_resize_bitmap(struct bitmap *src_bmp, struct bitmap *dest_bmp)
445 b += (bx * j) >> 14; 445 b += (bx * j) >> 14;
446 } 446 }
447 447
448 *dptr = LCD_RGBPACK(r >> 5, g >> 5, b >> 5); 448 *dptr = FB_RGBPACK(r >> 5, g >> 5, b >> 5);
449 dptr++; 449 dptr++;
450 } 450 }
451 } 451 }
diff --git a/apps/plugins/lib/osd.c b/apps/plugins/lib/osd.c
index 598a76759c..e6fc39178a 100644
--- a/apps/plugins/lib/osd.c
+++ b/apps/plugins/lib/osd.c
@@ -112,6 +112,9 @@ static struct osd grey_osd;
112# define _OSD_WIDTH2BYTES(w) ((w)*2) 112# define _OSD_WIDTH2BYTES(w) ((w)*2)
113# define _OSD_BYTES2WIDTH(b) ((b)/2) 113# define _OSD_BYTES2WIDTH(b) ((b)/2)
114# endif /* end stride type selection */ 114# endif /* end stride type selection */
115#elif LCD_DEPTH == 24
116# define _OSD_WIDTH2BYTES(w) ((w)*3)
117# define _OSD_BYTES2WIDTH(b) ((b)/3)
115#else /* other LCD depth */ 118#else /* other LCD depth */
116# error Unknown LCD depth; please define macros 119# error Unknown LCD depth; please define macros
117#endif /* LCD_DEPTH */ 120#endif /* LCD_DEPTH */
diff --git a/apps/plugins/lib/pluginlib_bmp.c b/apps/plugins/lib/pluginlib_bmp.c
index f1dd9b7b38..f3edfbf425 100644
--- a/apps/plugins/lib/pluginlib_bmp.c
+++ b/apps/plugins/lib/pluginlib_bmp.c
@@ -70,9 +70,9 @@ int save_bmp_file( char* filename, struct bitmap *bm )
70 fb_data *d = (fb_data*)( bm->data ) + (x+y*bm->width); 70 fb_data *d = (fb_data*)( bm->data ) + (x+y*bm->width);
71 unsigned char c[] = 71 unsigned char c[] =
72 { 72 {
73 RGB_UNPACK_BLUE( *d ), 73 FB_UNPACK_BLUE( *d ),
74 RGB_UNPACK_GREEN( *d ), 74 FB_UNPACK_GREEN( *d ),
75 RGB_UNPACK_RED( *d ) 75 FB_UNPACK_RED( *d )
76 }; 76 };
77 rb->write( fh, c, 3 ); 77 rb->write( fh, c, 3 );
78 } 78 }
diff --git a/apps/plugins/lib/xlcd_draw.c b/apps/plugins/lib/xlcd_draw.c
index 3be15718f6..83ddf68e5c 100644
--- a/apps/plugins/lib/xlcd_draw.c
+++ b/apps/plugins/lib/xlcd_draw.c
@@ -170,7 +170,7 @@ void xlcd_filltriangle_screen(struct screen* display,
170 xlcd_filltriangle_vertical(display, x1, y1, x2, y2, x3, y3); 170 xlcd_filltriangle_vertical(display, x1, y1, x2, y2, x3, y3);
171} 171}
172 172
173#if LCD_DEPTH >= 8 173#if LCD_DEPTH >= 8 && LCD_DEPTH <= 16
174 174
175#ifdef HAVE_LCD_COLOR 175#ifdef HAVE_LCD_COLOR
176static const fb_data graylut[256] = { 176static const fb_data graylut[256] = {
@@ -244,6 +244,8 @@ static const fb_data graylut[256] = {
244}; 244};
245#endif /* HAVE_LCD_COLOR */ 245#endif /* HAVE_LCD_COLOR */
246 246
247/* unused functions, enable when needed */
248#if 0
247/* Draw a partial greyscale bitmap, canonical 8 bit format */ 249/* Draw a partial greyscale bitmap, canonical 8 bit format */
248void xlcd_gray_bitmap_part(const unsigned char *src, int src_x, int src_y, 250void xlcd_gray_bitmap_part(const unsigned char *src, int src_x, int src_y,
249 int stride, int x, int y, int width, int height) 251 int stride, int x, int y, int width, int height)
@@ -286,7 +288,13 @@ void xlcd_gray_bitmap_part(const unsigned char *src, int src_x, int src_y,
286 288
287#ifdef HAVE_LCD_COLOR 289#ifdef HAVE_LCD_COLOR
288 do 290 do
291#if LCD_DEPTH == 16
289 *dst_row++ = graylut[*src_row++]; 292 *dst_row++ = graylut[*src_row++];
293#else
294 /* untested change because this function is completely unused */
295 *dst_row->r = *dst_row->g = *dst_row->b = *src_row++;
296 dst_row++;
297#endif
290 while (src_row < row_end); 298 while (src_row < row_end);
291#endif 299#endif
292 300
@@ -302,6 +310,7 @@ void xlcd_gray_bitmap(const unsigned char *src, int x, int y, int width,
302{ 310{
303 xlcd_gray_bitmap_part(src, 0, 0, width, x, y, width, height); 311 xlcd_gray_bitmap_part(src, 0, 0, width, x, y, width, height);
304} 312}
313#endif
305 314
306#ifdef HAVE_LCD_COLOR 315#ifdef HAVE_LCD_COLOR
307/* Draw a partial colour bitmap, canonical 24 bit RGB format */ 316/* Draw a partial colour bitmap, canonical 24 bit RGB format */
@@ -379,4 +388,3 @@ void xlcd_color_bitmap(const unsigned char *src, int x, int y, int width,
379#endif /* LCD_DEPTH >= 8 */ 388#endif /* LCD_DEPTH >= 8 */
380 389
381#endif /* HAVE_LCD_BITMAP */ 390#endif /* HAVE_LCD_BITMAP */
382