From 4be5cf7903e0c82736d01f9589e00365b387e00f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Deuc=D0=B5?= <shurd@sasktel.net>
Date: Wed, 22 Jan 2025 12:35:13 -0500
Subject: [PATCH] Move assignments for things only needed in the loop inside
 the loop

---
 src/conio/bitmap_con.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/src/conio/bitmap_con.c b/src/conio/bitmap_con.c
index 76d3b2bc00..7a4dc926f0 100644
--- a/src/conio/bitmap_con.c
+++ b/src/conio/bitmap_con.c
@@ -402,17 +402,17 @@ static void	cb_drawrect(struct rectlist *data)
 	 * 5) When blinking, the cursor is shown when vstat.blink is true.
 	 */
 	assert_rwlock_rdlock(&vstatlock);
-	if (vstat.mode == PRESTEL_40X24)
-		cv = 0x80FFFFFF;
-	else
-		cv = color_value(ciolib_fg);
-	curs_start = vstat.curs_start;
-	curs_end = vstat.curs_end;
-	curs_row = vstat.curs_row;
-	curs_col = vstat.curs_col;
-	charheight = vstat.charheight;
-	charwidth = vstat.charwidth;
 	if (cursor_visible_locked()) {
+		if (vstat.mode == PRESTEL_40X24)
+			cv = 0x80FFFFFF;
+		else
+			cv = color_value(ciolib_fg);
+		curs_start = vstat.curs_start;
+		curs_end = vstat.curs_end;
+		curs_row = vstat.curs_row;
+		curs_col = vstat.curs_col;
+		charheight = vstat.charheight;
+		charwidth = vstat.charwidth;
 		assert_rwlock_unlock(&vstatlock);
 		for (y = curs_start; y <= curs_end; y++) {
 			pixel = &data->data[((curs_row - 1) * charheight + y) * data->rect.width + (curs_col - 1) * charwidth];
-- 
GitLab