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
227void finalhandshake(Rdp*);227void finalhandshake(Rdp*);
228void drawimgupdate(Rdp*,Share*);228void drawimgupdate(Rdp*,Share*);
229void loadcmap(Rdp*,Share*);229void loadcmap(Rdp*,Share*);
230void draworders(Rdp*,Share*);
231 230
232enum /* Imgupd.type */231enum /* Imgupd.type */
233{232{
@@ -260,9 +259,6 @@ struct Imgupd · 26 unmodified lines
260int getimgupd(Imgupd*, uchar*, uint);259int getimgupd(Imgupd*, uchar*, uint);
261int getfupd(Imgupd*, uchar*, uint);260int getfupd(Imgupd*, uchar*, uint);
262 261
263void drawmemimg(Rdp*, Imgupd*);
264
265
266enum 262enum
267{263{
268 /* 2.2.8.1.1.2.1 Basic (TS_SECURITY_HEADER) */264 /* 2.2.8.1.1.2.1 Basic (TS_SECURITY_HEADER) */
draw.c+34−60
@@ -7,29 +7,35 @@ · 6 unmodified lines
7static Image* pad;7static Image* pad;
8static Image* icache[3][600];8static Image* icache[3][600];
9 9
10static void drawupd(Rdp*,Imgupd*);
11static void padresize(Rdp*);10static void padresize(Rdp*);
12 11
13/* 2.2.9.1.1.3.1.2.1 Bitmap Update Data (TS_UPDATE_BITMAP_DATA) */12static void drawupd1(Rdp*,Imgupd*);
13
14
14void15void
15drawimgupdate(Rdp *c, Share* s)16drawimgupdate(Rdp *c, Share* s)
16{17{
18 int (*getupd)(Imgupd*, uchar*, uint);
17 uchar* p, *ep;19 uchar* p, *ep;
18 int n, nr;20 int n, nr;
19 Imgupd u;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 p = s->data;29 p = s->data;
23 ep = s->data + s->ndata;30 ep = s->data + s->ndata;
24 nr = s->nr;31 nr = s->nr;
25 32
26 if(display->locking)33 if(display->locking)
27 lockdisplay(display);34 lockdisplay(display);
28
29 while(p<ep && nr>0){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 sysfatal("getimgupd: %r");37 sysfatal("getimgupd: %r");
32 drawupd(c, &u);38 drawupd1(c, &u);
33 p += n;39 p += n;
34 nr--;40 nr--;
35 }41 }
@@ -38,31 +44,6 @@ drawimgupdate(Rdp *c, Share* s) · 2 unmodified lines
38 unlockdisplay(display);44 unlockdisplay(display);
39}45}
40 46
41/* 2.2.2.2 Fast-Path Orders Update (TS_FP_UPDATE_ORDERS) */
42void
43draworders(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
66static void47static void
67padresize(Rdp* c)48padresize(Rdp* c)
68{49{
@@ -100,32 +81,6 @@ imgupd(Rdp* c, Imgupd* up) · 31 unmodified lines
100 draw(screen, r, pad, nil, r.min);81 draw(screen, r, pad, nil, r.min);
101}82}
102 83
103void
104drawmemimg(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
129static void84static void
130scrblt(Rdp*, Imgupd* up)85scrblt(Rdp*, Imgupd* up)
131{86{
@@ -138,11 +93,30 @@ scrblt(Rdp*, Imgupd* up) · 6 unmodified lines
138}93}
139 94
140static void95static void
141memblt(Rdp* c, Imgupd* up)96memblt(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 if(up->clipped)112 if(up->clipped)
144 replclipr(screen, screen->repl, rectaddpt(up->clipr, screen->r.min));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 if(up->clipped)120 if(up->clipped)
147 replclipr(screen, screen->repl, screen->r);121 replclipr(screen, screen->repl, screen->r);
148}122}
@@ -183,7 +157,7 @@ cachecmap(Rdp*, Imgupd*) · 34 unmodified lines
183}157}
184 158
185static void159static void
186drawupd(Rdp* c, Imgupd* up)160drawupd1(Rdp* c, Imgupd* up)
187{161{
188 switch(up->type){162 switch(up->type){
189 case Ubitmap: imgupd(c, up); break;163 case Ubitmap: imgupd(c, up); break;
rpc.c+0−2
@@ -444,8 +444,6 @@ scanupdates(Rdp* c, Msg* m) · 443 unmodified lines
444 c->hupreason = u.err;444 c->hupreason = u.err;
445 break;445 break;
446 case ShUorders:446 case ShUorders:
447 draworders(c, &u);
448 break;
449 case ShUimg:447 case ShUimg:
450 drawimgupdate(c, &u);448 drawimgupdate(c, &u);
451 break;449 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