| @@ -7,29 +7,35 @@ · 6 unmodified lines |
| 7 | 7 | static Image* pad; |
| 8 | 8 | static Image* icache[3][600]; |
| 9 | 9 | |
| 10 | | −static void drawupd(Rdp*,Imgupd*); |
| 11 | 10 | static void padresize(Rdp*); |
| 12 | 11 | |
| 13 | | −/* 2.2.9.1.1.3.1.2.1 Bitmap Update Data (TS_UPDATE_BITMAP_DATA) */ |
| 12 | +static void drawupd1(Rdp*,Imgupd*); |
| 13 | + |
| 14 | + |
| 14 | 15 | void |
| 15 | 16 | drawimgupdate(Rdp *c, Share* s) |
| 16 | 17 | { |
| 18 | + int (*getupd)(Imgupd*, uchar*, uint); |
| 17 | 19 | uchar* p, *ep; |
| 18 | 20 | int n, nr; |
| 19 | 21 | Imgupd u; |
| 22 | + |
| 23 | + switch(s->type){ |
| 24 | + default: sysfatal("drawimgupdate: bad s->type"); |
| 25 | + case ShUimg: getupd = getimgupd; break; |
| 26 | + case ShUorders: getupd = getfupd; break; |
| 27 | + } |
| 20 | 28 | |
| 21 | | − assert(s->type == ShUimg); |
| 22 | 29 | p = s->data; |
| 23 | 30 | ep = s->data + s->ndata; |
| 24 | 31 | nr = s->nr; |
| 25 | 32 | |
| 26 | 33 | if(display->locking) |
| 27 | 34 | lockdisplay(display); |
| 28 | | − |
| 29 | 35 | while(p<ep && nr>0){ |
| 30 | | − if((n = getimgupd(&u, p, ep-p)) < 0) |
| 36 | + if((n = getupd(&u, p, ep-p)) < 0) |
| 31 | 37 | sysfatal("getimgupd: %r"); |
| 32 | | − drawupd(c, &u); |
| 38 | + drawupd1(c, &u); |
| 33 | 39 | p += n; |
| 34 | 40 | nr--; |
| 35 | 41 | } |
| @@ -38,31 +44,6 @@ drawimgupdate(Rdp *c, Share* s) · 2 unmodified lines |
| 38 | 44 | unlockdisplay(display); |
| 39 | 45 | } |
| 40 | 46 | |
| 41 | | −/* 2.2.2.2 Fast-Path Orders Update (TS_FP_UPDATE_ORDERS) */ |
| 42 | | −void |
| 43 | | −draworders(Rdp* c, Share* as) |
| 44 | | −{ |
| 45 | | − int n, count; |
| 46 | | − uchar *p, *ep; |
| 47 | | − Imgupd u; |
| 48 | | − |
| 49 | | − count = as->nr; |
| 50 | | − p = as->data; |
| 51 | | − ep = as->data + as->ndata; |
| 52 | | − |
| 53 | | − if(display->locking) |
| 54 | | − lockdisplay(display); |
| 55 | | − while(count> 0 && p<ep){ |
| 56 | | − n = getfupd(&u, p, ep-p); |
| 57 | | − drawupd(c, &u); |
| 58 | | − p += n; |
| 59 | | − count--; |
| 60 | | − } |
| 61 | | − flushimage(display, 1); |
| 62 | | − if(display->locking) |
| 63 | | − unlockdisplay(display); |
| 64 | | −} |
| 65 | | − |
| 66 | 47 | static void |
| 67 | 48 | padresize(Rdp* c) |
| 68 | 49 | { |
| @@ -100,32 +81,6 @@ imgupd(Rdp* c, Imgupd* up) · 31 unmodified lines |
| 100 | 81 | draw(screen, r, pad, nil, r.min); |
| 101 | 82 | } |
| 102 | 83 | |
| 103 | | −void |
| 104 | | −drawmemimg(Rdp*, Imgupd* iu) |
| 105 | | −{ |
| 106 | | − Image* img; |
| 107 | | − Rectangle r; |
| 108 | | − Point pt; |
| 109 | | − |
| 110 | | − /* called with display locked */ |
| 111 | | − |
| 112 | | − if(iu->cid >= nelem(icache) || iu->coff >= nelem(*icache)){ |
| 113 | | − fprint(2, "drawmemimg: bad cache spec [%d %d]\n", iu->cid, iu->coff); |
| 114 | | − return; |
| 115 | | − } |
| 116 | | − img = icache[iu->cid][iu->coff]; |
| 117 | | − if(img == nil){ |
| 118 | | − fprint(2, "drawmemimg: empty cache entry cid %d coff %d\n", iu->cid, iu->coff); |
| 119 | | − return; |
| 120 | | − } |
| 121 | | − |
| 122 | | − r = Rect(iu->x, iu->y, iu->xm+1, iu->ym+1); |
| 123 | | − r = rectaddpt(r, screen->r.min); |
| 124 | | − pt = Pt(iu->sx, iu->sy); |
| 125 | | − draw(screen, r, img, nil, pt); |
| 126 | | −} |
| 127 | | − |
| 128 | | − |
| 129 | 84 | static void |
| 130 | 85 | scrblt(Rdp*, Imgupd* up) |
| 131 | 86 | { |
| @@ -138,11 +93,30 @@ scrblt(Rdp*, Imgupd* up) · 6 unmodified lines |
| 138 | 93 | } |
| 139 | 94 | |
| 140 | 95 | static void |
| 141 | | −memblt(Rdp* c, Imgupd* up) |
| 96 | +memblt(Rdp*, Imgupd* up) |
| 142 | 97 | { |
| 98 | + Image* img; |
| 99 | + Rectangle r; |
| 100 | + Point pt; |
| 101 | + |
| 102 | + if(up->cid >= nelem(icache) || up->coff >= nelem(*icache)){ |
| 103 | + fprint(2, "drawmemimg: bad cache spec [%d %d]\n", up->cid, up->coff); |
| 104 | + return; |
| 105 | + } |
| 106 | + img = icache[up->cid][up->coff]; |
| 107 | + if(img == nil){ |
| 108 | + fprint(2, "drawmemimg: empty cache entry cid %d coff %d\n", up->cid, up->coff); |
| 109 | + return; |
| 110 | + } |
| 111 | + |
| 143 | 112 | if(up->clipped) |
| 144 | 113 | replclipr(screen, screen->repl, rectaddpt(up->clipr, screen->r.min)); |
| 145 | | − drawmemimg(c, up); |
| 114 | + |
| 115 | + r = Rect(up->x, up->y, up->xm+1, up->ym+1); |
| 116 | + r = rectaddpt(r, screen->r.min); |
| 117 | + pt = Pt(up->sx, up->sy); |
| 118 | + draw(screen, r, img, nil, pt); |
| 119 | + |
| 146 | 120 | if(up->clipped) |
| 147 | 121 | replclipr(screen, screen->repl, screen->r); |
| 148 | 122 | } |
| @@ -183,7 +157,7 @@ cachecmap(Rdp*, Imgupd*) · 34 unmodified lines |
| 183 | 157 | } |
| 184 | 158 | |
| 185 | 159 | static void |
| 186 | | −drawupd(Rdp* c, Imgupd* up) |
| 160 | +drawupd1(Rdp* c, Imgupd* up) |
| 187 | 161 | { |
| 188 | 162 | switch(up->type){ |
| 189 | 163 | case Ubitmap: imgupd(c, up); break; |