shithub: sce

Download patch

ref: d4208c3e4679b3791f5a7c011b9845aa2f99e07f
parent: ea43be77eba8716962c10894db1230ed06ff7a05
author: qwx <qwx@sciops.net>
date: Tue Aug 25 08:26:34 EDT 2020

drw: align upper drawing boundary to scaled pixels

fixes selecting beyond drawn areas, fbvis out of bounds access

--- a/drw.c
+++ b/drw.c
@@ -350,6 +350,7 @@
 	fbh = min(mapheight * Tlsubheight * scale, Dy(screen->r));
 	selr = Rpt(screen->r.min, addpt(screen->r.min, Pt(fbws, fbh)));
 	p0 = Pt(screen->r.min.x + 8, screen->r.max.y - 3 * font->height);
+	p0.y -= (p0.y - screen->r.min.y) % scale;
 	panmax.x = max(Tlsubwidth * mapwidth * scale - Dx(screen->r), 0);
 	panmax.y = max(Tlsubheight * mapheight * scale - Dy(screen->r), 0);
 	if(p0.y < selr.max.y){