ref: 3a9bd2b51c2c1627c4dabac83f83af3a5c0b86be
parent: 385b0b014c09d403280bdf3628670c2bb49ed8f0
author: Yaroslav Kolomiiets <[email protected]>
date: Tue Aug 9 07:17:27 EDT 2016
fix drawimgupdate (2008r2)
--- a/draw.c
+++ b/draw.c
@@ -17,7 +17,7 @@
int (*loadfn)(Image*,Rectangle,uchar*,int,uchar*);
uchar* p, *ep;
int n, nr;
- Rectangle r;
+ Rectangle r, rs;
Imgupd u;
static Image* pad;
@@ -28,9 +28,11 @@
if(display->locking)
lockdisplay(display);
- if(pad==nil || eqrect(pad->r, screen->r) == 0){
+
+ rs = rectaddpt(Rpt(ZP, Pt(c->xsz+4, c->ysz+4)), screen->r.min);
+ if(pad==nil || eqrect(pad->r, rs) == 0){
freeimage(pad);
- pad = allocimage(display, screen->r, c->chan, 0, DNofill);
+ pad = allocimage(display, rs, c->chan, 0, DNofill);
if(pad==nil)
sysfatal("drawimgupdate: %r");
}
@@ -44,17 +46,17 @@
if(u.iscompr)
loadfn = loadrle;
- r = Rect(u.x, u.y, u.xm+1, u.ym+1);
- r = rectaddpt(r, screen->r.min);
-
+ r = rectaddpt(Rect(u.x, u.y, u.x+u.xsz, u.y+u.ysz), screen->r.min);
if(loadfn(pad, r, u.bytes, u.nbytes, c->cmap) < 0)
- sysfatal("%r");
+ sysfatal("drawimgupdate: %r");
+
+ r = rectaddpt(Rect(u.x, u.y, u.xm+1, u.ym+1), screen->r.min);
draw(screen, r, pad, nil, r.min);
p += n;
nr--;
}
- if(p != ep)
- fprint(2, "drawimgupdate: out of sync\n");
+// if(p != ep)
+// fprint(2, "drawimgupdate: out of sync: %d bytes left\n", (int)(ep-p));
flushimage(display, 1);
if(display->locking)
unlockdisplay(display);
@@ -97,7 +99,7 @@
}
if(loadfn(img, r, iu->bytes, iu->nbytes, c->cmap) < 0)
- sysfatal("%r");
+ sysfatal("loadmemimg: %r");
}
void
--- a/load.c
+++ b/load.c
@@ -22,6 +22,18 @@
for(a = data; a <data+ndata; a++)
*a = cmap[*a];
+ /* BUG: padding ignored
+
+ 2.2.9.1.1.3.1.2.2 Bitmap Data (TS_BITMAP_DATA):
+
+ ❝Uncompressed bitmap data is formatted as a bottom-up,
+ left-to-right series of pixels. Each pixel is a whole
+ number of bytes. Each row contains a multiple of four
+ bytes (including up to three bytes of padding, as
+ necessary).❞
+
+ */
+
n = bpl;
while(r.max.y > r.min.y){
a = bufimage(i->display, 21+n);
--- a/rd.c
+++ b/rd.c
@@ -94,7 +94,7 @@
unlockdisplay(display);
c->ysz = Dy(screen->r);
- c->xsz = (Dx(screen->r) +3) & ~3;
+ c->xsz = Dx(screen->r);
}
static int killpid[32];
--- a/rpc.c
+++ b/rpc.c
@@ -437,7 +437,7 @@
case ShDeactivate:
deactivate(c, &u);
break;
- case ShActivate: // server may engage capability re-exchange
+ case ShActivate: // server may initiate capability re-exchange
activate(c, &u);
break;
case ShEinfo: