summaryrefslogtreecommitdiff
path: root/firmware
diff options
context:
space:
mode:
Diffstat (limited to 'firmware')
-rw-r--r--firmware/drivers/lcd-16bit-common.c18
-rw-r--r--firmware/drivers/lcd-bitmap-common.c26
-rw-r--r--firmware/export/lcd-remote.h4
-rw-r--r--firmware/export/lcd.h3
4 files changed, 50 insertions, 1 deletions
diff --git a/firmware/drivers/lcd-16bit-common.c b/firmware/drivers/lcd-16bit-common.c
index 1e1548e997..bbac2b295a 100644
--- a/firmware/drivers/lcd-16bit-common.c
+++ b/firmware/drivers/lcd-16bit-common.c
@@ -515,3 +515,21 @@ void ICODE_ATTR lcd_alpha_bitmap_part(const unsigned char *src, int src_x,
515#endif 515#endif
516 } while (--row); 516 } while (--row);
517} 517}
518
519/* Draw a partial bitmap (mono or native) including alpha channel */
520void ICODE_ATTR lcd_bmp_part(const struct bitmap* bm, int src_x, int src_y,
521 int x, int y, int width, int height)
522{
523 int bitmap_stride = STRIDE_MAIN(bm->width, bm->height);
524 if (bm->format == FORMAT_MONO)
525 lcd_mono_bitmap_part(bm->data, src_x, src_y, bitmap_stride, x, y, width, height);
526 else
527 lcd_bitmap_transparent_part((fb_data*)bm->data,
528 src_x, src_y, bitmap_stride, x, y, width, height);
529}
530
531/* Draw a native bitmap with alpha channel */
532void ICODE_ATTR lcd_bmp(const struct bitmap *bmp, int x, int y)
533{
534 lcd_bmp_part(bmp, 0, 0, x, y, bmp->width, bmp->height);
535}
diff --git a/firmware/drivers/lcd-bitmap-common.c b/firmware/drivers/lcd-bitmap-common.c
index 878c08863b..3aa833d6a1 100644
--- a/firmware/drivers/lcd-bitmap-common.c
+++ b/firmware/drivers/lcd-bitmap-common.c
@@ -501,3 +501,29 @@ void LCDFN(puts_scroll_style_offset)(int x, int y, const unsigned char *string,
501{ 501{
502 LCDFN(puts_scroll_style_xyoffset)(x, y, string, style, x_offset, 0); 502 LCDFN(puts_scroll_style_xyoffset)(x, y, string, style, x_offset, 0);
503} 503}
504
505#if !defined(HAVE_LCD_COLOR) || !defined(MAIN_LCD)
506/* see lcd-16bit-common.c for others */
507#ifdef MAIN_LCD
508#define THIS_STRIDE STRIDE_MAIN
509#else
510#define THIS_STRIDE STRIDE_REMOTE
511#endif
512
513void LCDFN(bmp_part)(const struct bitmap* bm, int src_x, int src_y,
514 int x, int y, int width, int height)
515{
516 if (bm->format == FORMAT_MONO)
517 LCDFN(mono_bitmap_part)((FBFN(data)*)(bm->data),
518 src_x, src_y, THIS_STRIDE(bm->width, bm->height), x, y, width, height);
519 else
520 LCDFN(bitmap_part)((FBFN(data)*)(bm->data),
521 src_x, src_y, THIS_STRIDE(bm->width, bm->height), x, y, width, height);
522}
523
524void LCDFN(bmp)(const struct bitmap* bm, int x, int y)
525{
526 LCDFN(bmp_part)(bm, 0, 0, x, y, bm->width, bm->height);
527}
528
529#endif
diff --git a/firmware/export/lcd-remote.h b/firmware/export/lcd-remote.h
index e2f2ab16ec..46ec2a949a 100644
--- a/firmware/export/lcd-remote.h
+++ b/firmware/export/lcd-remote.h
@@ -216,6 +216,8 @@ extern void lcd_bitmap_remote_transparent(const fb_remote_data *src, int x,
216#define lcd_remote_mono_bitmap lcd_remote_bitmap 216#define lcd_remote_mono_bitmap lcd_remote_bitmap
217#define lcd_remote_mono_bitmap_part lcd_remote_bitmap_part 217#define lcd_remote_mono_bitmap_part lcd_remote_bitmap_part
218#endif /* LCD_REMOTE_DEPTH */ 218#endif /* LCD_REMOTE_DEPTH */
219 219extern void lcd_remote_bmp_part(const struct bitmap* bm, int src_x, int src_y,
220 int x, int y, int width, int height);
221extern void lcd_remote_bmp(const struct bitmap* bm, int x, int y);
220#endif 222#endif
221#endif /* __LCD_REMOTE_H__ */ 223#endif /* __LCD_REMOTE_H__ */
diff --git a/firmware/export/lcd.h b/firmware/export/lcd.h
index f4336233ab..47ea94bca9 100644
--- a/firmware/export/lcd.h
+++ b/firmware/export/lcd.h
@@ -543,6 +543,9 @@ extern void lcd_bitmap_transparent_part(const fb_data *src,
543 int height); 543 int height);
544extern void lcd_bitmap_transparent(const fb_data *src, int x, int y, 544extern void lcd_bitmap_transparent(const fb_data *src, int x, int y,
545 int width, int height); 545 int width, int height);
546extern void lcd_bmp_part(const struct bitmap* bm, int src_x, int src_y,
547 int x, int y, int width, int height);
548extern void lcd_bmp(const struct bitmap* bm, int x, int y);
546#else /* LCD_DEPTH == 1 */ 549#else /* LCD_DEPTH == 1 */
547#define lcd_mono_bitmap lcd_bitmap 550#define lcd_mono_bitmap lcd_bitmap
548#define lcd_mono_bitmap_part lcd_bitmap_part 551#define lcd_mono_bitmap_part lcd_bitmap_part