shithub: rd

Download patch

ref: e545d605f8dd7ab25f19170673e530bac510ae6b
parent: 31ca6adcbd8b1b3de88112619eb330fc195ed200
author: Yaroslav Kolomiiets <yarikos@gmail.com>
date: Mon Aug 8 12:30:26 EDT 2016

cosmetics

--- a/draw.c
+++ b/draw.c
@@ -12,6 +12,7 @@
 	int n, err, nr;
 	Rectangle r;
 	Imgupd iu;
+	int (*loadfunc)(Image*,Rectangle,uchar*,int,uchar*);
 	static Image* pad;
 
 	assert(s->type == ShUimg);
@@ -21,7 +22,6 @@
 
 	if(display->locking)
 		lockdisplay(display);
-
 	if(pad==nil || eqrect(pad->r, screen->r) != 0){
 		freeimage(pad);
 		pad = allocimage(display, screen->r, c->chan, 0, DNofill);
@@ -28,9 +28,7 @@
 		if(pad==nil)
 			sysfatal("drawimgupdate: %r");
 	}
-
 	while(p<ep && nr>0){
-		/* 2.2.9.1.1.3.1.2.2 Bitmap Data (TS_BITMAP_DATA) */
 		if((n = getimgupd(&iu, p, ep-p)) < 0)
 			sysfatal("getimgupd: %r");
 		if(iu.depth != pad->depth)
@@ -37,7 +35,8 @@
 			sysfatal("bad image depth");
 		r = Rect(iu.x, iu.y, iu.xm+1, iu.ym+1);
 		r = rectaddpt(r, screen->r.min);
-		err = (iu.iscompr? loadrle : loadbmp)(pad, r, iu.bytes, iu.nbytes, c->cmap);
+		loadfunc = (iu.iscompr? loadrle : loadbmp);
+		err = loadfunc(pad, r, iu.bytes, iu.nbytes, c->cmap);
 		if(err < 0)
 			sysfatal("%r");
 		draw(screen, r, pad, nil, r.min);
@@ -44,6 +43,8 @@
 		p += n;
 		nr--;
 	}
+	if(p != ep)
+		fprint(2, "drawimgupdate: out of sync\n");
 	flushimage(display, 1);
 	if(display->locking)
 		unlockdisplay(display);
--- a/mkfile
+++ b/mkfile
@@ -3,6 +3,7 @@
 TARG=rd
 BIN=/$objtype/bin
 
+CLEANFILES=$O.thread
 HFILES=fns.h dat.h
 OFILES=\
 	alloc.$O\