shithub: patch

Download patch

ref: 65d33850cd0a8bda177e753966b86cb8df36b82b
parent: 4f767a098a468803599e3fdcc4e0490a7b7fdea3
author: qwx <qwx@sciops.net>
date: Fri Nov 27 15:59:13 EST 2020

fplot-col: update to latest

--- a/fplot-col
+++ b/fplot-col
@@ -1,47 +1,45 @@
-diff -r 82ca4d784349 sys/src/cmd/fplot.c
---- a/sys/src/cmd/fplot.c	Sun Jul 01 23:35:23 2018 -0400
-+++ b/sys/src/cmd/fplot.c	Thu Jul 05 04:44:35 2018 +0200
-@@ -366,7 +366,9 @@
- 		if(x >= picx || y >= picy || x < 0 || y < 0)
- 			return;
- 		p = imagedata + (picx * y + x) * 3;
--		p[0] = p[1] = p[2] = 0;
-+		p[0] = 0;
-+		p[1] = 0x44;
-+		p[2] = 0x88;
- 	} else
- 		draw(screen, Rect(x, y, x + 1, y + 1), color, nil, ZP);
- }
-@@ -450,7 +452,7 @@
+diff -r 2eab60542a43 sys/src/cmd/fplot.c
+--- a/sys/src/cmd/fplot.c	Fri Nov 27 10:51:16 2020 +0100
++++ b/sys/src/cmd/fplot.c	Fri Nov 27 21:58:23 2020 +0100
+@@ -119,7 +119,7 @@
+ double ymin = -10, ymax = 10;
+ double gymin, gymax;
+ int icolors[] = {
+-	DBlack,
++	0x777777FF,
+ 	0xCC0000FF,
+ 	0x00CC00FF,
+ 	0x0000CCFF,
+@@ -475,7 +475,7 @@
  		lr = rectsubpt(lr, Pt(0, lr.min.y - ny));
  	}
  	if(rectinrect(lr, screen->r) && (lr.min.x > x || lr.max.x <= x)){
 -		string(screen, lr.min, display->black, ZP, display->defaultfont, buf);
-+		string(screen, lr.min, color, ZP, display->defaultfont, buf);
++		string(screen, lr.min, colors[0], ZP, display->defaultfont, buf);
  		return 1;
  	}
  	return 0;
-@@ -472,7 +474,7 @@
+@@ -497,7 +497,7 @@
  		lr = rectsubpt(lr, Pt(lr.min.x - nx, 0));
  	}
  	if(rectinrect(lr, screen->r) && (lr.min.y > y || lr.max.y <= y)){
 -		string(screen, lr.min, display->black, ZP, display->defaultfont, buf);
-+		string(screen, lr.min, color, ZP, display->defaultfont, buf);
++		string(screen, lr.min, colors[0], ZP, display->defaultfont, buf);
  		return 1;
  	}
  	return 0;
-@@ -539,25 +541,25 @@
+@@ -564,25 +564,25 @@
  		x = deconvx(&screen->r, 0);
  	else
  		x = screen->r.min.x+5;
 -	line(screen, Pt(x, screen->r.min.y), Pt(x, screen->r.max.y), Endarrow, 0, 0, display->black, ZP);
-+	line(screen, Pt(x, screen->r.min.y), Pt(x, screen->r.max.y), Endarrow, 0, 0, color, ZP);
++	line(screen, Pt(x, screen->r.min.y), Pt(x, screen->r.max.y), Endarrow, 0, 0, colors[0], ZP);
  	if(ymin < 0 && ymax > 0)
  		y = deconvy(&screen->r, 0);
  	else
  		y = screen->r.max.y-5;
 -	line(screen, Pt(screen->r.min.x, y), Pt(screen->r.max.x, y), 0, Endarrow, 0, display->black, ZP);
-+	line(screen, Pt(screen->r.min.x, y), Pt(screen->r.max.x, y), 0, Endarrow, 0, color, ZP);
++	line(screen, Pt(screen->r.min.x, y), Pt(screen->r.max.x, y), 0, Endarrow, 0, colors[0], ZP);
  	nx = ticks(xmin, xmax, &dx, &mx);
  	tickfmt(dx, mx, nx, fmt);
  	for(i = 0; i <= nx; i++){
@@ -48,7 +46,7 @@
  		p = deconvx(&screen->r, dx*i+mx);
  		if(xticklabel(fmt, dx*i+mx, p, x, y))
 -			line(screen, Pt(p, y), Pt(p, y-5), 0, 0, 0, display->black, ZP);
-+			line(screen, Pt(p, y), Pt(p, y-5), 0, 0, 0, color, ZP);
++			line(screen, Pt(p, y), Pt(p, y-5), 0, 0, 0, colors[0], ZP);
  	}
  	ny = ticks(ymin, ymax, &dy, &my);
  	tickfmt(dy, my, ny, fmt);
@@ -56,19 +54,11 @@
  		p = deconvy(&screen->r, dy*i+my);
  		if(yticklabel(fmt, dy*i+my, p, x, y))
 -			line(screen, Pt(x, p), Pt(x+5, p), 0, 0, 0, display->black, ZP);
-+			line(screen, Pt(x, p), Pt(x+5, p), 0, 0, 0, color, ZP);
++			line(screen, Pt(x, p), Pt(x+5, p), 0, 0, 0, colors[0], ZP);
  	}
  }
  
-@@ -566,7 +568,6 @@
- {
- 	int i;
- 	
--	color = display->black;
- 	for(i = 0; i < nfns; i++)
- 		drawgraph(&fns[i], &screen->r);
- 	if(!aflag)
-@@ -603,7 +604,7 @@
+@@ -630,7 +630,7 @@
  	xmax = xmax_;
  	ymin = ymin_;
  	ymax = ymax_;
@@ -77,7 +67,7 @@
  	drawgraphs();
  }
  
-@@ -617,7 +618,7 @@
+@@ -644,7 +644,7 @@
  	ymax = zoomst[nzoomst - 1].ymax;
  	zoomst = realloc(zoomst, sizeof(FRectangle) * --nzoomst);
  	if(zoomst == nil && nzoomst != 0) sysfatal("realloc: %r");
@@ -86,7 +76,7 @@
  	drawgraphs();
  }
  
-@@ -687,7 +688,6 @@
+@@ -759,7 +759,6 @@
  	parsefns(argc, argv);
  	if(cflag) {
  		imagedata = emalloc(picx * picy * 3);
@@ -94,19 +84,24 @@
  		print("%11s %11d %11d %11d %11d ", "r8g8b8", 0, 0, picx, picy);
  		r.min.x = r.min.y = 0;
  		r.max.x = picx;
-@@ -699,7 +699,11 @@
- 	} else {
- 		if(initdraw(nil, nil, "fplot") < 0)
- 			sysfatal("initdraw: %r");
-+		color = allocimage(display, Rect(0,0,1,1), RGB24, 1, 0x884400ff);
-+		if(color == nil)
-+			sysfatal("allocimage: %r");
- 		einit(Emouse | Ekeyboard);
+@@ -776,6 +775,7 @@
+ 		picy = Dy(screen->r);
+ 		pixels = emalloc(picx * picy);
+ 		alloccolors();
 +		draw(screen, screen->r, display->black, nil, ZP);
  		drawgraphs();
  		for(;;) {
  			switch(event(&e)) {
-@@ -720,7 +724,7 @@
+@@ -783,7 +783,7 @@
+ 				if((e.mouse.buttons & 1) != 0)
+ 					zoom();
+ 				if(((lbut|e.mouse.buttons) & 2) != 0){
+-					draw(screen, screen->r, display->white, nil, ZP);
++					draw(screen, screen->r, display->black, nil, ZP);
+ 					drawgraphs();
+ 				}
+ 				if((e.mouse.buttons & 2) != 0)
+@@ -802,7 +802,7 @@
  						zoomst[nzoomst++] = (FRectangle){xmin, xmax, ymin, ymax};
  						ymin = gymin-0.05*(gymax-gymin);
  						ymax = gymax+0.05*(gymax-gymin);