History

drawer dispatch

Yaroslav Kolomiiets committed 10 years ago

Commit daada081 parent 1025d6a3 files · +34 −66Browse files

Unified · Split

3 files
  1. dat.h +0 −4
  2. draw.c +34 −60
  3. rpc.c +0 −2
dat.h+0−4
@@ -227,7 +227,6 @@ void deactivate(Rdp*,Share*); · 226 unmodified lines
227227 void finalhandshake(Rdp*);
228228 void drawimgupdate(Rdp*,Share*);
229229 void loadcmap(Rdp*,Share*);
230−void draworders(Rdp*,Share*);
231230
232231 enum /* Imgupd.type */
233232 {
@@ -260,9 +259,6 @@ struct Imgupd · 26 unmodified lines
260259 int getimgupd(Imgupd*, uchar*, uint);
261260 int getfupd(Imgupd*, uchar*, uint);
262261
263−void drawmemimg(Rdp*, Imgupd*);
264−
265−
266262 enum
267263 {
268264 /* 2.2.8.1.1.2.1 Basic (TS_SECURITY_HEADER) */
draw.c+34−60
@@ -7,29 +7,35 @@ · 6 unmodified lines
77 static Image* pad;
88 static Image* icache[3][600];
99
10−static void drawupd(Rdp*,Imgupd*);
1110 static void padresize(Rdp*);
1211
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+
1415 void
1516 drawimgupdate(Rdp *c, Share* s)
1617 {
18+ int (*getupd)(Imgupd*, uchar*, uint);
1719 uchar* p, *ep;
1820 int n, nr;
1921 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+ }
2028
21− assert(s->type == ShUimg);
2229 p = s->data;
2330 ep = s->data + s->ndata;
2431 nr = s->nr;
2532
2633 if(display->locking)
2734 lockdisplay(display);
28−
2935 while(p<ep && nr>0){
30− if((n = getimgupd(&u, p, ep-p)) < 0)
36+ if((n = getupd(&u, p, ep-p)) < 0)
3137 sysfatal("getimgupd: %r");
32− drawupd(c, &u);
38+ drawupd1(c, &u);
3339 p += n;
3440 nr--;
3541 }
@@ -38,31 +44,6 @@ drawimgupdate(Rdp *c, Share* s) · 2 unmodified lines
3844 unlockdisplay(display);
3945 }
4046
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−
6647 static void
6748 padresize(Rdp* c)
6849 {
@@ -100,32 +81,6 @@ imgupd(Rdp* c, Imgupd* up) · 31 unmodified lines
10081 draw(screen, r, pad, nil, r.min);
10182 }
10283
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−
12984 static void
13085 scrblt(Rdp*, Imgupd* up)
13186 {
@@ -138,11 +93,30 @@ scrblt(Rdp*, Imgupd* up) · 6 unmodified lines
13893 }
13994
14095 static void
141−memblt(Rdp* c, Imgupd* up)
96+memblt(Rdp*, Imgupd* up)
14297 {
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+
143112 if(up->clipped)
144113 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+
146120 if(up->clipped)
147121 replclipr(screen, screen->repl, screen->r);
148122 }
@@ -183,7 +157,7 @@ cachecmap(Rdp*, Imgupd*) · 34 unmodified lines
183157 }
184158
185159 static void
186−drawupd(Rdp* c, Imgupd* up)
160+drawupd1(Rdp* c, Imgupd* up)
187161 {
188162 switch(up->type){
189163 case Ubitmap: imgupd(c, up); break;
rpc.c+0−2
@@ -444,8 +444,6 @@ scanupdates(Rdp* c, Msg* m) · 443 unmodified lines
444444 c->hupreason = u.err;
445445 break;
446446 case ShUorders:
447− draworders(c, &u);
448− break;
449447 case ShUimg:
450448 drawimgupdate(c, &u);
451449 break;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t