From cea66c14d3030e3104a3f5200b4204d60ad8207b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Deuc=D0=B5?= <shurd@sasktel.net>
Date: Sat, 11 Jan 2025 01:21:19 -0500
Subject: [PATCH] Another big speedup...

Since we update the bitmap before drawing a frame now, we can just
mark the cells incorrectly moved by advancing the bitmap ringbuffer
as dirty and known they'll be redrawn.

This gets rid of the memmove on full-width scrolling, and gets us
into the 6s range.
---
 src/conio/bitmap_con.c | 14 ++++----------
 1 file changed, 4 insertions(+), 10 deletions(-)

diff --git a/src/conio/bitmap_con.c b/src/conio/bitmap_con.c
index 4d868851f9..39b8c21923 100644
--- a/src/conio/bitmap_con.c
+++ b/src/conio/bitmap_con.c
@@ -1441,18 +1441,12 @@ bitmap_movetext_screen(int x, int y, int tox, int toy, int direction, int height
 		if (screena.toprow < 0)
 			screena.toprow += screena.screenheight;
 
-		/*
-		 * Set up to move bits that were *not* moved back to
-		 * where they should have stayed.
-		 */
-		if (direction == -1)
-			direction = 1;
-		else
-			direction = -1;
 		height = vstat.rows - height;
-		int moved = y - toy;
 		toy = vstat.rows - (height - 1);
-		y = toy - moved;
+		// Fill the bits with impossible data so they're redrawn
+		memset(&bitmap_drawn[(toy - 1) * vstat.cols], 0x04, sizeof(*bitmap_drawn) * height * vstat.cols);
+		pthread_mutex_unlock(&screenlock);
+		return;
 	}
 
 	int maxpos = screena.screenwidth * screena.screenheight;
-- 
GitLab