shithub: patch

Download patch

ref: 35baa5a175cb97fcaba95e5a54c510f723282fb5
parent: 18396d36ff419c265060cad4527eb58a00d8e1c8
author: qwx <qwx@sciops.net>
date: Wed Jan 12 21:27:54 EST 2022

page-invert: style

--- a/page-invert
+++ b/page-invert
@@ -13,7 +13,7 @@
  	Cfitheight,
  	Crotate90,
  	Cupsidedown,
-+	Cinv,
++	Cinvert,
  	Cdummy1,
  	Cnext,
  	Cprev,
@@ -21,7 +21,7 @@
  	[Cfitheight]	"fit height",	'h', 0, 0,
  	[Crotate90]	"rotate 90",	'r', 0, 0,
  	[Cupsidedown]	"upside down",	'u', 0, 0,
-+	[Cinv]		"invert",	'i', 0, 0,
++	[Cinvert]	"invert",	'i', 0, 0,
  	[Cdummy1]	"",		0, 0, 0,
  	[Cnext]		"next",		Kright, ' ', '\n', 
  	[Cprev]		"prev",		Kleft, Kbs, 0,
@@ -29,7 +29,7 @@
  }
  
  void
-+inv(Image *i)
++invertimage(Image *i)
 +{
 +	int n, m;
 +	uchar *b;
@@ -40,11 +40,11 @@
 +		return;
 +	unloadimage(i, i->r, (uchar*)buf, n);
 +	m = n;
-+	for(p=buf; n>=sizeof *p; n-=sizeof *p, p++)
++	for(p=buf; m>=sizeof *p; m-=sizeof *p, p++)
 +		*p = ~*p;
-+	for(b=(uchar*)p; n>0; n--, b++)
++	for(b=(uchar*)p; m>0; m--, b++)
 +		*b = ~*b;
-+	loadimage(i, i->r, (uchar*)buf, m);
++	loadimage(i, i->r, (uchar*)buf, n);
 +	free(buf);
 +}
 +
@@ -57,7 +57,7 @@
  		else {
  			lockdisplay(display);
 +			if(invert)
-+				inv(p->image);
++				invertimage(p->image);
  			imemsize += imagesize(p->image);
  			unlockdisplay(display);
  		}
@@ -66,7 +66,7 @@
  		resize = subpt(screen->r.max, screen->r.min);
  		resize.x = 0;
 +		goto Unload;
-+	case Cinv:
++	case Cinvert:
 +		invert = !invert;
  		goto Unload;
  	case Czoomin: