shithub: pplay

Download patch

ref: 5e16a3c98400a0f72a541d9a0cad446449ff3e3b
parent: 1997896377424f52ad5f70c9b6597b878b7d24d7
author: qwx <[email protected]>
date: Thu Feb 6 17:31:33 EST 2020

redraw: most redrawing only involves reseting view offsets and blanking bg

--- a/draw.c
+++ b/draw.c
@@ -154,7 +154,7 @@
 	if(z < 1 || z > nsamp / Dx(screen->r))
 		return;
 	zoom = z;
-	redraw();
+	redraw(0);
 }
 
 void
@@ -164,7 +164,7 @@
 	if(zoom == 1 || views == 0 && Δx < 0 || views >= viewmax && Δx > 0)
 		return;
 	views += Δx;
-	redraw();
+	redraw(0);
 }
 
 void
@@ -208,7 +208,7 @@
 	viewr = rectsubpt(screen->r, screen->r.min);
 	freeimage(viewbg);
 	freeimage(view);
-	viewbg = eallocimage(viewr, 0, DBlack);
+	viewbg = eallocimage(viewr, 0, DNofill);
 	view = eallocimage(viewr, 0, DBlack);
 	if(stereo){
 		midr = viewr;
@@ -228,7 +228,7 @@
 }
 
 void
-redraw(void)
+redraw(int all)
 {
 	vlong span;
 
@@ -243,7 +243,9 @@
 		views = viewmax;
 	viewe = views + span;
 	bgofs = views;
-	resetdraw();
+	if(all)
+		resetdraw();
+	draw(viewbg, viewbg->r, display->black, nil, ZP);
 	update();
 }
 
@@ -257,5 +259,5 @@
 	col[Cloop] = eallocimage(Rect(0,0,1,1), 1, 0x777777FF);
 	drawbg = drawsamps;
 	loope = filesz;
-	redraw();
+	redraw(1);
 }
--- a/fns.h
+++ b/fns.h
@@ -5,6 +5,6 @@
 void	setloop(vlong);
 void	setpos(vlong);
 void	setofs(vlong);
-void	redraw(void);
+void	redraw(int);
 void	initdrw(void);
 void*	emalloc(ulong);
--- a/pplay.c
+++ b/pplay.c
@@ -160,7 +160,7 @@
 			if(getwindow(display, Refnone) < 0)
 				sysfatal("resize failed: %r");
 			mo = mc->Mouse;
-			redraw();
+			redraw(1);
 			break;
 		case 1:
 			switch(mc->buttons){