shithub: riscv

Download patch

ref: 3f2d3721ded93048c8f8897a3c28e61852475e7e
parent: dff1e3813fb0deb18ca790b7c28f6a1405720ff6
author: spew <devnull@localhost>
date: Sun Mar 12 14:33:54 EDT 2017

games/galaxy: avoid unnecessary calculations
It is not necessary to recalculate the center of the
screen every time.

--- a/sys/src/games/galaxy/galaxy.c
+++ b/sys/src/games/galaxy/galaxy.c
@@ -357,6 +357,7 @@
 	setcursor(mc, &zoomcursor);
 	oxy = mc->xy;
 	oscale = scale;
+	sc = screencenter();
 	for(;;) {
 		readmouse(mc);
 		if(mc->buttons != 2)
@@ -363,7 +364,6 @@
 			break;
 		d = subpt(mc->xy, oxy);
 		z = tanh((double)d.y/200) + 1;
-		sc = screencenter();
 		gsc = tovector(sc);
 		pause(0, 0);
 		scale = z*oscale;