Skip to contentSkip to conversation

cmd: bmp: manage centered display

PATCH Superseded Anatolij Gustschin 1 participant 2 messages Dec 1, 2018 – Dec 4, 2018

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 cmd: bmp: manage centered display

From: Patrick Delaunay <[email protected]>

Allow to display BMP at the middle of the screen.

'm' means "middle" as it is done for the splashscreen variable:
splashpos=m,m

---
Changes in v2:
- drop BMP_ALIGN_CENTER define since it is already included with splash.h

 cmd/bmp.c | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)
cmd/bmp.c +13 -5
index 02bdf48b4d..b8af784590 100644
@@ -124,8 +124,14 @@ static int do_bmp_display(cmd_tbl_t * cmdtp, int flag, int argc, char * const ar
 		break;
 	case 4:
 		addr = simple_strtoul(argv[1], NULL, 16);
-		x = simple_strtoul(argv[2], NULL, 10);
-		y = simple_strtoul(argv[3], NULL, 10);
+		if (!strcmp(argv[2], "m"))
+			x = BMP_ALIGN_CENTER;
+		else
+			x = simple_strtoul(argv[2], NULL, 10);
+		if (!strcmp(argv[3], "m"))
+			y = BMP_ALIGN_CENTER;
+		else
+			y = simple_strtoul(argv[3], NULL, 10);
 		break;
 	default:
 		return CMD_RET_USAGE;
@@ -249,9 +255,11 @@ int bmp_display(ulong addr, int x, int y)
 	if (!ret) {
 		bool align = false;
 
-# ifdef CONFIG_SPLASH_SCREEN_ALIGN
-		align = true;
-# endif /* CONFIG_SPLASH_SCREEN_ALIGN */
+		if (CONFIG_IS_ENABLED(SPLASH_SCREEN_ALIGN) ||
+		    x == BMP_ALIGN_CENTER ||
+		    y == BMP_ALIGN_CENTER)
+			align = true;
+
 		ret = video_bmp_display(dev, addr, x, y, align);
 	}
 #elif defined(CONFIG_LCD)
Signature · 1 line
2.17.1
#1 lore raw

PATCH v2 1/1 cmd: bmp: manage centered display

Quoted 7 lines · On Sat, 1 Dec 2018 14:41:07 +0100 Anatolij Gustschin agust at denx.de wrote:

From: Patrick Delaunay <[email protected]>

Allow to display BMP at the middle of the screen.

'm' means "middle" as it is done for the splashscreen variable:
splashpos=m,m

Quoted 8 lines

---
Changes in v2:
- drop BMP_ALIGN_CENTER define since it is already included with splash.h

 cmd/bmp.c | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

Applied to u-boot-video/master, thanks!

--
Anatolij