shithub: rd

Download patch

ref: 52ec96d00007df020f520b2003dec903220726b8
parent: c2d719d90422f7a2e1a7f73f9dda44e603d24e86
author: Yaroslav Kolomiiets <yarikos@gmail.com>
date: Wed Jan 23 04:59:48 EST 2019

few renames

--- a/dat.h
+++ b/dat.h
@@ -220,7 +220,7 @@
 	Ubitmap,
 	Uscrblt,
 	Umemblt,
-	Uicache,
+	Ucacheimg,
 	Umcache,
 };
 struct Imgupd
@@ -233,12 +233,12 @@
 	int	xsz;
 	int	ysz;
 	int	depth;
-	int	iscompr;
+	int	clip;
+	int	compressed;
 	int	cid;
 	int	coff;
 	int	sx;
 	int	sy;
-	int	clipped;
 	int	cx;
 	int	cy;
 	int	cxsz;
--- a/draw.c
+++ b/draw.c
@@ -102,7 +102,7 @@
 		sysfatal("bad image depth");
 
 	loadfn = loadbmp;
-	if(up->iscompr)
+	if(up->compressed)
 		loadfn = loadrle;
 
 	r = rectaddpt(Rect(up->x, up->y, up->x+up->xsz, up->y+up->ysz), screen->r.min);
@@ -143,7 +143,7 @@
 		return;
 	}
 
-	if(up->clipped){
+	if(up->clip){
 		clipr = Rect(up->cx, up->cy, up->cx+up->cxsz, up->cy+up->cysz);
 		replclipr(screen, screen->repl, rectaddpt(clipr, screen->r.min));
 	}
@@ -153,12 +153,12 @@
 	pt = Pt(up->sx, up->sy);
 	draw(screen, r, img, nil, pt);
 
-	if(up->clipped)
+	if(up->clip)
 		replclipr(screen, screen->repl, screen->r);
 }
 
 static void
-cacheimage2(Rdp* c, Imgupd* up)
+cacheimg(Rdp* c, Imgupd* u)
 {
 	int (*loadfn)(Image*,Rectangle,uchar*,int,uchar*);
 	int chan;
@@ -166,25 +166,25 @@
 	Rectangle r;
 
 	loadfn = loadbmp;
-	if(up->iscompr)
+	if(u->compressed)
 		loadfn = loadrle;
 
-	r = Rect(0, 0, up->xsz, up->ysz);
+	r = Rect(0, 0, u->xsz, u->ysz);
 
-	if(up->cid >= nelem(icache) || up->coff >= nelem(*icache))
-		sysfatal("cacheimage2: bad cache spec [%d %d]", up->cid, up->coff);
+	if(u->cid >= nelem(icache) || u->coff >= nelem(*icache))
+		sysfatal("cacheimg: bad cache spec [%d %d]", u->cid, u->coff);
 
-	img = icache[up->cid][up->coff];
+	img = icache[u->cid][u->coff];
 	if(img==nil || eqrect(img->r, r)==0){
 		chan = depth2chan(c->depth);
 		freeimage(img);
 		img = allocimage(display, r, chan, 0, DNofill);
 		if(img == nil)
-			sysfatal("cacheimage2: %r");
-		icache[up->cid][up->coff] = img;
+			sysfatal("cacheimg: %r");
+		icache[u->cid][u->coff] = img;
 	}
 
-	if(loadfn(img, r, up->bytes, up->nbytes, c->cmap) < 0)
+	if(loadfn(img, r, u->bytes, u->nbytes, c->cmap) < 0)
 		sysfatal("loadmemimg: %r");
 }
 
@@ -203,7 +203,7 @@
 	case Ubitmap:	imgupd(c, up); break;
 	case Uscrblt:	scrblt(c, up); break;
 	case Umemblt:	memblt(c, up); break;
-	case Uicache:	cacheimage2(c, up); break;
+	case Ucacheimg:	cacheimg(c, up); break;
 	case Umcache:	cachecmap(c, up); break;
 	}
 }
--- a/egdi.c
+++ b/egdi.c
@@ -23,10 +23,10 @@
 };
 enum /* 2.2.2.2.1.1.2 Primary Drawing Order (PRIMARY_DRAWING_ORDER) */
 {
-	Clipped=		1<<2,
+	Clip=		1<<2,
 	NewOrder= 	1<<3,
 	Diff=			1<<4,
-	SameClipping=	1<<5,
+	Lastclipr=	1<<5,
 	ZeroFieldBit0=	1<<6,
 	ZeroFieldBit1=	1<<7,
 };
@@ -117,8 +117,8 @@
 	Rectangle clipr;
 } gc	= {PatBlt};
 
-static	int	cfclipr(Rectangle*,uchar*,int);
-static	int	cfpt(Point*,uchar*,int,int,int);
+static	int	loadclipr(Rectangle*,uchar*,int);
+static	int	loadpt(Point*,uchar*,int,int,int);
 
 int
 getfupd(Imgupd* up, uchar* a, uint nb)
@@ -175,8 +175,8 @@
 	}
 	p += fsize;
 
-	if(ctl&Clipped && !(ctl&SameClipping))
-		p += cfclipr(&gc.clipr, p, ep-p);
+	if(ctl&Clip && !(ctl&Lastclipr))
+		p += loadclipr(&gc.clipr, p, ep-p);
 
 	if(ordtab[gc.order].get == nil)
 		goto ErrNotsup;
@@ -195,7 +195,7 @@
 }
 
 static int
-cfpt(Point* p, uchar* a, int nb, int isdelta, int fset)
+loadpt(Point* p, uchar* a, int nb, int isdelta, int fset)
 {
 	int n;
 
@@ -212,7 +212,7 @@
 			n += 2;
 	}
 	if(n>nb)
-		sysfatal("cfpt: %s", Eshort);
+		sysfatal("loadpt: %s", Eshort);
 
 	if(isdelta){
 		if(fset&1<<0)
@@ -231,18 +231,18 @@
 }
 
 static int
-cfrect(Rectangle* pr, uchar* p, int nb, int isdelta, int fset){
+loadrect(Rectangle* pr, uchar* p, int nb, int isdelta, int fset){
 	int n, m;
 
 	pr->max = subpt(pr->max, pr->min);
-	n = cfpt(&pr->min, p, nb, isdelta, fset);
-	m = cfpt(&pr->max, p+n, nb-n, isdelta, fset>>2);
+	n = loadpt(&pr->min, p, nb, isdelta, fset);
+	m = loadpt(&pr->max, p+n, nb-n, isdelta, fset>>2);
 	pr->max = addpt(pr->max, pr->min);
 	return n+m;
 }
 
 static int
-cfclipr(Rectangle* pr, uchar* a, int nb)
+loadclipr(Rectangle* pr, uchar* a, int nb)
 {
 	int bctl;
 	uchar *p, *ep;
@@ -276,7 +276,7 @@
 		p += 2;
 	}
 	if(p>ep)
-		sysfatal("cfclipr: %s", Eshort);
+		sysfatal("loadclipr: %s", Eshort);
 	return p-a;
 }
 
@@ -294,7 +294,7 @@
 	p = a;
 	ep = a+nb;
 
-	n = cfrect(&wr, p, ep-p, ctl&Diff, fset);
+	n = loadrect(&wr, p, ep-p, ctl&Diff, fset);
 	p += n;
 	if(fset&1<<4){
 		if(ep-p<1)
@@ -301,11 +301,11 @@
 			sysfatal(Eshort);
 		rop3 = *p++;
 	}
-	n = cfpt(&wp, p, ep-p, ctl&Diff, fset>>5);
+	n = loadpt(&wp, p, ep-p, ctl&Diff, fset>>5);
 	p += n;
 
 	r = wr;
-	if(ctl&Clipped)
+	if(ctl&Clip)
 		rectclip(&r, gc.clipr);
 
 	if(rop3 != Scopy)
@@ -340,11 +340,11 @@
 		cid = igets(p);
 		p += 2;
 	}
-	n = cfrect(&r, p, ep-p, ctl&Diff, fset>>1);
+	n = loadrect(&r, p, ep-p, ctl&Diff, fset>>1);
 	p += n;
 	if(fset&1<<5)
 		rop3 = *p++;
-	n = cfpt(&pt, p, ep-p, ctl&Diff, fset>>6);
+	n = loadpt(&pt, p, ep-p, ctl&Diff, fset>>6);
 	p += n;
 	if(fset&1<<8){
 		coff = igets(p);
@@ -366,9 +366,9 @@
 	up->ysz = Dy(r);
 	up->sx = pt.x;
 	up->sy = pt.y;
-	up->clipped = 0;
-	if(ctl&Clipped){
-		up->clipped = 1;
+	up->clip = 0;
+	if(ctl&Clip){
+		up->clip = 1;
 		up->cx = gc.clipr.min.x;
 		up->cy = gc.clipr.min.y;
 		up->cxsz = Dx(gc.clipr);
@@ -391,7 +391,7 @@
 	p = a;
 	ep = a+nb;
 
-	up->iscompr = (xorder==CacheCompressed2);
+	up->compressed = (xorder==CacheCompressed2);
 
 	cid = opt&Bits3;
 	opt >>= 7;
@@ -431,7 +431,7 @@
 		g = ((g&Bits7)<<8) | *p++;
 	coff = g;
 
-	if(up->iscompr && !(opt&1<<3)){
+	if(up->compressed && !(opt&1<<3)){
 		p += 8;	// bitmapComprHdr
 		size -= 8;
 	}
@@ -438,7 +438,7 @@
 	if(p+size > ep)
 		sysfatal("cacheimage2: size: %s", Eshort);
 
-	up->type = Uicache;
+	up->type = Ucacheimg;
 	up->cid = cid;
 	up->coff = coff;
 	up->nbytes = size;
@@ -466,4 +466,3 @@
 	up->nbytes = 4*256;
 	return 9+4*256;
 }
-
--- a/mpas.c
+++ b/mpas.c
@@ -306,7 +306,7 @@
 
 /* 2.2.9.1.1.3.1.2.2 Bitmap Data (TS_BITMAP_DATA) */
 int
-getimgupd(Imgupd* iu, uchar* a, uint nb)
+getimgupd(Imgupd* u, uchar* a, uint nb)
 {
 	uchar *p, *ep, *s;
 	int opt, len;
@@ -317,14 +317,14 @@
 		werrstr(Eshort);
 		return -1;
 	}
-	iu->type = Ubitmap;
-	iu->x = igets(p+0);
-	iu->y = igets(p+2);
-	iu->xm = igets(p+4);
-	iu->ym = igets(p+6);
-	iu->xsz = igets(p+8);
-	iu->ysz = igets(p+10);
-	iu->depth = igets(p+12);
+	u->type = Ubitmap;
+	u->x = igets(p+0);
+	u->y = igets(p+2);
+	u->xm = igets(p+4);
+	u->ym = igets(p+6);
+	u->xsz = igets(p+8);
+	u->ysz = igets(p+10);
+	u->depth = igets(p+12);
 	opt = igets(p+14);
 	len = igets(p+16);
 	p += 18;
@@ -333,11 +333,11 @@
 		werrstr(Eshort);
 		return -1;
 	}
-	iu->iscompr = (opt&Bcompress);
+	u->compressed = (opt&Bcompress);
 	if(opt&Bcompress && !(opt&NoBitcomphdr))
 		p += 8;
-	iu->bytes = p;
-	iu->nbytes = s-p;
+	u->bytes = p;
+	u->nbytes = s-p;
 	return s-a;
 }