diff Discovery/Src/gfx_engine.c @ 772:b7e43b28bee1

Fix character truncation when screen is flipped. This was causing the dive computer to lock up when in English Units with the screen flipped when the first decompression stop is shown using FONT_105.
author izzni
date Sat, 22 Apr 2023 21:11:50 -0500
parents aa6006975e76
children bc6c90e20d9e f7318457df4d
line wrap: on
line diff
--- a/Discovery/Src/gfx_engine.c	Fri Apr 21 09:48:23 2023 +0200
+++ b/Discovery/Src/gfx_engine.c	Sat Apr 22 21:11:50 2023 -0500
@@ -2371,8 +2371,14 @@
 
 // -----------------------------
 	char_truncated_WidthFlag = 0;
-	width_left = hgfx->Image->ImageWidth - (hgfx->WindowX0 + cfg->Xdelta);
-
+	if(!pSettings->FlipDisplay)
+	{
+		width_left = hgfx->Image->ImageWidth - (hgfx->WindowX0 + cfg->Xdelta);
+	}
+	else
+	{
+		width_left = (hgfx->WindowX1 - cfg->Xdelta);
+	}
 	if(width_left < width)
 	{
 		char_truncated_WidthFlag = 1;
@@ -2764,7 +2770,14 @@
 
 // -----------------------------
 	char_truncated_WidthFlag = 0;
-	width_left = hgfx->Image->ImageWidth - (hgfx->WindowX0 + cfg->Xdelta);
+	if(!pSettings->FlipDisplay)
+	{
+		width_left = hgfx->Image->ImageWidth - (hgfx->WindowX0 + cfg->Xdelta);
+	}
+	else
+	{
+		width_left = (hgfx->WindowX1 - cfg->Xdelta);
+	}
 	if(width_left < width)
 	{
 		char_truncated_WidthFlag = 1;