History

update libdraw code to 9front version, cleanup x11 code

cinap_lenrek committed 10 years ago

Commit a08fb221 parent 5dc9cad39 files · +832 −2306Browse files

Unified · Split

39 files
  1. gui-win32/Makefile +0 −4
  2. gui-win32/alloc.c +0 −23
  3. gui-win32/cload.c +0 −10
  4. gui-win32/draw.c +0 −22
  5. gui-win32/load.c +0 −10
  6. gui-win32/screen.c +1 −1
  7. gui-x11/x11.c +35 −430
  8. include/draw.h +11 −19
  9. include/memdraw.h +4 −34
  10. kern/devdraw.c +3 −4
  11. kern/devkbd.c +1 −0
  12. kern/screen.h +1 −1
  13. libdraw/Makefile +2 −0
  14. libdraw/alloc.c +41 −35
  15. libdraw/arith.c +6 −21
  16. libdraw/badrect.c +22 −0
  17. libdraw/chan.c +5 −1
  18. libdraw/defont.c +358 −372
  19. libdraw/fmt.c +22 −0
  20. libmemdraw/alloc.c +16 −13
  21. libmemdraw/arctest.c +0 −62
  22. libmemdraw/cload.c +2 −2
  23. libmemdraw/defont.c +1 −1
  24. libmemdraw/draw.c +243 −188
  25. libmemdraw/drawtest.c +0 −1004
  26. libmemdraw/ellipse.c +4 −4
  27. libmemdraw/fillpoly.c +1 −3
  28. libmemdraw/line.c +2 −3
  29. libmemdraw/load.c +9 −2
  30. libmemdraw/openmemsubfont.c +9 −6
  31. libmemdraw/read.c +0 −4
  32. libmemdraw/string.c +3 −4
  33. libmemdraw/subfont.c +1 −0
  34. libmemdraw/unload.c +1 −1
  35. libmemdraw/write.c +21 −15
  36. libmemlayer/draw.c +2 −2
  37. libmemlayer/lalloc.c +1 −1
  38. libmemlayer/lsetrefresh.c +3 −3
  39. libmemlayer/unload.c +1 −1
gui-win32/Makefile+0−4
@@ -3,10 +3,6 @@ include ../Make.config · 2 unmodified lines
3LIB=libgui.a3LIB=libgui.a
4 4
5OFILES=\5OFILES=\
6 alloc.$O\
7 cload.$O\
8 draw.$O\
9 load.$O\
10 screen.$O\6 screen.$O\
11 r16.$O7 r16.$O
12 8
gui-win32/alloc.c+0−23
@@ -1,23 +0,0 @@
1#include <u.h>
2#include <libc.h>
3#include <draw.h>
4#include <memdraw.h>
5
6Memimage*
7allocmemimage(Rectangle r, ulong chan)
8{
9 return _allocmemimage(r, chan);
10}
11
12void
13freememimage(Memimage *i)
14{
15 _freememimage(i);
16}
17
18void
19memfillcolor(Memimage *i, ulong val)
20{
21 _memfillcolor(i, val);
22}
23
gui-win32/cload.c+0−10
@@ -1,10 +0,0 @@
1#include <u.h>
2#include <libc.h>
3#include <draw.h>
4#include <memdraw.h>
5
6int
7cloadmemimage(Memimage *i, Rectangle r, uchar *data, int ndata)
8{
9 return _cloadmemimage(i, r, data, ndata);
10}
gui-win32/draw.c+0−22
@@ -1,22 +0,0 @@
1#include <u.h>
2#include <libc.h>
3#include <draw.h>
4#include <memdraw.h>
5
6void
7memimagedraw(Memimage *dst, Rectangle r, Memimage *src, Point sp, Memimage *mask, Point mp, int op)
8{
9 _memimagedraw(_memimagedrawsetup(dst, r, src, sp, mask, mp, op));
10}
11
12ulong
13pixelbits(Memimage *m, Point p)
14{
15 return _pixelbits(m, p);
16}
17
18void
19memimageinit(void)
20{
21 _memimageinit();
22}
gui-win32/load.c+0−10
@@ -1,10 +0,0 @@
1#include <u.h>
2#include <libc.h>
3#include <draw.h>
4#include <memdraw.h>
5
6int
7loadmemimage(Memimage *i, Rectangle r, uchar *data, int ndata)
8{
9 return _loadmemimage(i, r, data, ndata);
10}
gui-win32/screen.c+1−1
@@ -88,7 +88,7 @@ screeninit(void) · 87 unmodified lines
88}88}
89 89
90uchar*90uchar*
91attachscreen(Rectangle *r, ulong *chan, int *depth, int *width, int *softscreen, void **X)91attachscreen(Rectangle *r, ulong *chan, int *depth, int *width, int *softscreen)
92{92{
93 *r = gscreen->r;93 *r = gscreen->r;
94 *chan = gscreen->chan;94 *chan = gscreen->chan;
gui-x11/x11.c+35−430
@@ -37,42 +37,16 @@ typedef struct Cursor Cursor; · 36 unmodified lines
37/* perfect approximation to NTSC = .299r+.587g+.114b when 0 ≤ r,g,b < 256 */37/* perfect approximation to NTSC = .299r+.587g+.114b when 0 ≤ r,g,b < 256 */
38#define RGB2K(r,g,b) ((156763*(r)+307758*(g)+59769*(b))>>19)38#define RGB2K(r,g,b) ((156763*(r)+307758*(g)+59769*(b))>>19)
39 39
40enum
41{
42 PMundef = ~0 /* undefined pixmap id */
43};
44
45/*
46 * Structure pointed to by X field of Memimage
47 */
48typedef struct Xmem Xmem;
49struct Xmem
50{
51 int pmid; /* pixmap id for screen ldepth instance */
52 XImage *xi; /* local image if we currenty have the data */
53 int dirty;
54 Rectangle dirtyr;
55 Rectangle r;
56 uintptr pc; /* who wrote into xi */
57};
58
59static int xgcfillcolor;
60static int xgcfillcolor0;
61static int xgcsimplecolor0;
62static int xgcsimplepm0;
63
64static XDisplay* xdisplay; /* used holding draw lock */40static XDisplay* xdisplay; /* used holding draw lock */
65static int xtblbit;41static int xtblbit;
66static int plan9tox11[256]; /* Values for mapping between */42static int plan9tox11[256]; /* Values for mapping between */
67static int x11toplan9[256]; /* X11 and Plan 9 */43static int x11toplan9[256]; /* X11 and Plan 9 */
68static GC xgcfill, xgccopy, xgcsimplesrc, xgczero, xgcreplsrc;44static GC xgccopy;
69static GC xgcfill0, xgccopy0, xgcsimplesrc0, xgczero0, xgcreplsrc0;
70static ulong xscreenchan;45static ulong xscreenchan;
71static Drawable xscreenid;46static Drawable xscreenid;
47static XImage* xscreenimage;
72static Visual *xvis;48static Visual *xvis;
73 49
74static int xdraw(Memdrawparam*);
75
76#define glenda_width 4850#define glenda_width 48
77#define glenda_height 4851#define glenda_height 48
78static unsigned short glenda_bits[] = {52static unsigned short glenda_bits[] = {
@@ -94,133 +68,25 @@ static unsigned short glenda_bits[] = { · 15 unmodified lines
94 0xffff, 0x8807, 0xffe0, 0xffff, 0x003f, 0xfff0, 0xffff, 0x1fff, 0xfffe68 0xffff, 0x8807, 0xffe0, 0xffff, 0x003f, 0xfff0, 0xffff, 0x1fff, 0xfffe
95};69};
96 70
97/*
98 * Synchronize images between X bitmaps and in-memory bitmaps.
99 */
100static void
101addrect(Rectangle *rp, Rectangle r)
102{
103 if(rp->min.x >= rp->max.x)
104 *rp = r;
105 else
106 combinerect(rp, r);
107}
108
109static XImage*
110getXdata(Memimage *m, Rectangle r)
111{
112 uchar *p;
113 int x, y;
114 Xmem *xm;
115 Point xdelta, delta;
116 Point tp;
117
118 xm = m->X;
119 if(xm == nil)
120 return nil;
121
122 assert(xm != nil && xm->xi != nil);
123
124 if(xm->dirty == 0)
125 return xm->xi;
126
127 r = xm->dirtyr;
128 if(Dx(r)==0 || Dy(r)==0)
129 return xm->xi;
130
131 delta = subpt(r.min, m->r.min);
132 tp = xm->r.min; /* avoid unaligned access on digital unix */
133 xdelta = subpt(r.min, tp);
134
135 XGetSubImage(xdisplay, xm->pmid, delta.x, delta.y, Dx(r), Dy(r),
136 AllPlanes, ZPixmap, xm->xi, xdelta.x, xdelta.y);
137
138 if(xtblbit && m->chan == CMAP8)
139 for(y=r.min.y; y<r.max.y; y++)
140 for(x=r.min.x, p=byteaddr(m, Pt(x,y)); x<r.max.x; x++, p++)
141 *p = x11toplan9[*p];
142
143 xm->dirty = 0;
144 xm->dirtyr = Rect(0,0,0,0);
145 return xm->xi;
146}
147
148static void
149putXdata(Memimage *m, Rectangle r)
150{
151 Xmem *xm;
152 XImage *xi;
153 GC g;
154 Point xdelta, delta;
155 Point tp;
156 int x, y;
157 uchar *p;
158
159 xm = m->X;
160 if(xm == nil)
161 return;
162
163 assert(xm != nil);
164 assert(xm->xi != nil);
165
166 xi = xm->xi;
167
168 g = (m->chan == GREY1) ? xgccopy0 : xgccopy;
169
170 delta = subpt(r.min, m->r.min);
171 tp = xm->r.min; /* avoid unaligned access on digital unix */
172 xdelta = subpt(r.min, tp);
173
174 if(xtblbit && m->chan == CMAP8)
175 for(y=r.min.y; y<r.max.y; y++)
176 for(x=r.min.x, p=byteaddr(m, Pt(x,y)); x<r.max.x; x++, p++)
177 *p = plan9tox11[*p];
178
179 XPutImage(xdisplay, xm->pmid, g, xi, xdelta.x, xdelta.y, delta.x, delta.y, Dx(r), Dy(r));
180
181 if(xtblbit && m->chan == CMAP8)
182 for(y=r.min.y; y<r.max.y; y++)
183 for(x=r.min.x, p=byteaddr(m, Pt(x,y)); x<r.max.x; x++, p++)
184 *p = x11toplan9[*p];
185}
186
187static void
188dirtyXdata(Memimage *m, Rectangle r)
189{
190 Xmem *xm;
191
192 if((xm = m->X) != nil){
193 xm->dirty = 1;
194 addrect(&xm->dirtyr, r);
195 }
196}
197
198Memimage*71Memimage*
199xallocmemimage(Rectangle r, ulong chan, int pmid)72xallocmemimage(Rectangle r, ulong chan, int pmid, XImage **X)
200{73{
201 Memimage *m;74 Memimage *m;
202 Xmem *xm;
203 XImage *xi;75 XImage *xi;
204 int offset;76 int offset;
205 int d;77 int d;
206 78
207 m = _allocmemimage(r, chan);79 m = allocmemimage(r, chan);
208 if(m == nil)80 if(m == nil)
209 return nil;81 return nil;
210 if(chan != GREY1 && chan != xscreenchan)82 if(chan != GREY1 && chan != xscreenchan)
211 return m;83 return m;
212 84
213 d = m->depth;85 d = m->depth;
214 xm = mallocz(sizeof(Xmem), 1);86 if(d == 24)
215 if(pmid != PMundef)
216 xm->pmid = pmid;
217 else
218 xm->pmid = XCreatePixmap(xdisplay, xscreenid, Dx(r), Dy(r), (d==32) ? 24 : d);
219
220 if(m->depth == 24)
221 offset = r.min.x&(4-1);87 offset = r.min.x&(4-1);
222 else88 else
223 offset = r.min.x&(31/m->depth);89 offset = r.min.x&(31/d);
224 r.min.x -= offset;90 r.min.x -= offset;
225 91
226 assert(wordsperline(r, m->depth) <= m->width);92 assert(wordsperline(r, m->depth) <= m->width);
@@ -229,14 +95,10 @@ xallocmemimage(Rectangle r, ulong chan, int pmid) · 2 unmodified lines
229 (char*)m->data->bdata, Dx(r), Dy(r), 32, m->width*sizeof(ulong));95 (char*)m->data->bdata, Dx(r), Dy(r), 32, m->width*sizeof(ulong));
230 96
231 if(xi == nil){97 if(xi == nil){
232 _freememimage(m);98 freememimage(m);
233 return nil;99 return nil;
234 }100 }
235 101
236 xm->xi = xi;
237 xm->pc = getcallerpc(&r);
238 xm->r = r;
239
240 /*102 /*
241 * Set the parameters of the XImage so its memory looks exactly like a103 * Set the parameters of the XImage so its memory looks exactly like a
242 * Memimage, so we can call _memimagedraw on the same data. All frame104 * Memimage, so we can call _memimagedraw on the same data. All frame
@@ -247,256 +109,12 @@ xallocmemimage(Rectangle r, ulong chan, int pmid) · 4 unmodified lines
247 xi->byte_order = LSBFirst;109 xi->byte_order = LSBFirst;
248 xi->bitmap_bit_order = MSBFirst;110 xi->bitmap_bit_order = MSBFirst;
249 xi->bitmap_pad = 32;111 xi->bitmap_pad = 32;
250 xm->r = Rect(0,0,0,0);
251 XInitImage(xi);112 XInitImage(xi);
252 XFlush(xdisplay);113 XFlush(xdisplay);
253 114
254 m->X = xm;115 *X = xi;
255 return m;
256}
257
258void
259xfillcolor(Memimage *m, Rectangle r, ulong v)
260{
261 GC gc;
262 Xmem *dxm;
263
264 dxm = m->X;
265 assert(dxm != nil);
266 r = rectsubpt(r, m->r.min);
267
268 if(m->chan == GREY1){
269 gc = xgcfill0;
270 if(xgcfillcolor0 != v){
271 XSetForeground(xdisplay, gc, v);
272 xgcfillcolor0 = v;
273 }
274 }else{
275 if(m->chan == CMAP8 && xtblbit)
276 v = plan9tox11[v];
277
278 gc = xgcfill;
279 if(xgcfillcolor != v){
280 XSetForeground(xdisplay, gc, v);
281 xgcfillcolor = v;
282 }
283 }
284 XFillRectangle(xdisplay, dxm->pmid, gc, r.min.x, r.min.y, Dx(r), Dy(r));
285}
286 116
287/*117 return m;
288 * Replacements for libmemdraw routines.
289 * (They've been underscored.)
290 */
291Memimage*
292allocmemimage(Rectangle r, ulong chan)
293{
294 return xallocmemimage(r, chan, PMundef);
295}
296
297void
298freememimage(Memimage *m)
299{
300 Xmem *xm;
301
302 if(m == nil)
303 return;
304
305 if(m->data->ref == 1){
306 if((xm = m->X) != nil){
307 if(xm->xi){
308 xm->xi->data = nil;
309 XFree(xm->xi);
310 }
311 XFreePixmap(xdisplay, xm->pmid);
312 free(xm);
313 m->X = nil;
314 }
315 }
316 _freememimage(m);
317}
318
319void
320memfillcolor(Memimage *m, ulong val)
321{
322 _memfillcolor(m, val);
323 if(m->X){
324 if((val & 0xFF) == 0xFF)
325 xfillcolor(m, m->r, _rgbatoimg(m, val));
326 else
327 putXdata(m, m->r);
328 }
329}
330
331int
332loadmemimage(Memimage *i, Rectangle r, uchar *data, int ndata)
333{
334 int n;
335
336 n = _loadmemimage(i, r, data, ndata);
337 if(n > 0 && i->X)
338 putXdata(i, r);
339 return n;
340}
341
342int
343cloadmemimage(Memimage *i, Rectangle r, uchar *data, int ndata)
344{
345 int n;
346
347 n = _cloadmemimage(i, r, data, ndata);
348 if(n > 0 && i->X)
349 putXdata(i, r);
350 return n;
351}
352
353ulong
354pixelbits(Memimage *m, Point p)
355{
356 if(m->X)
357 getXdata(m, Rect(p.x, p.y, p.x+1, p.y+1));
358 return _pixelbits(m, p);
359}
360
361void
362memimageinit(void)
363{
364 static int didinit = 0;
365
366 if(didinit)
367 return;
368
369 didinit = 1;
370 _memimageinit();
371
372 xfillcolor(memblack, memblack->r, 0);
373 xfillcolor(memwhite, memwhite->r, 1);
374}
375
376void
377memimagedraw(Memimage *dst, Rectangle r, Memimage *src, Point sp, Memimage *mask, Point mp, int op)
378{
379 Memdrawparam *par;
380
381 if((par = _memimagedrawsetup(dst, r, src, sp, mask, mp, op)) == nil)
382 return;
383 _memimagedraw(par);
384 if(!xdraw(par))
385 putXdata(dst, par->r);
386}
387
388static int
389xdraw(Memdrawparam *par)
390{
391 return 0;
392}
393
394static int
395xdraw_broken(Memdrawparam *par)
396{
397 int dy, dx;
398 unsigned m;
399 Memimage *src, *dst, *mask;
400 Xmem *dxm, *sxm, *mxm;
401 GC gc;
402 Rectangle r, sr, mr;
403 ulong sdval;
404
405 dx = Dx(par->r);
406 dy = Dy(par->r);
407 src = par->src;
408 dst = par->dst;
409 mask = par->mask;
410 r = par->r;
411 sr = par->sr;
412 mr = par->mr;
413 sdval = par->sdval;
414
415 /*
416 * drawterm was distributed for years with
417 * "return 0;" right here.
418 * maybe we should give up on all this?
419 */
420
421 if((dxm = dst->X) == nil)
422 return 0;
423
424 /*
425 * If we have an opaque mask and source is one opaque pixel we can convert to the
426 * destination format and just XFillRectangle.
427 */
428 m = Simplesrc|Simplemask|Fullmask;
429 if((par->state&m)==m){
430 xfillcolor(dst, r, sdval);
431 dirtyXdata(dst, par->r);
432 return 1;
433 }
434
435 /*
436 * If no source alpha, an opaque mask, we can just copy the
437 * source onto the destination. If the channels are the same and
438 * the source is not replicated, XCopyArea suffices.
439 */
440 m = Simplemask|Fullmask;
441 if((par->state&(m|Replsrc))==m && src->chan == dst->chan && src->X){
442 sxm = src->X;
443 r = rectsubpt(r, dst->r.min);
444 sr = rectsubpt(sr, src->r.min);
445 if(dst->chan == GREY1)
446 gc = xgccopy0;
447 else
448 gc = xgccopy;
449 XCopyArea(xdisplay, sxm->pmid, dxm->pmid, gc,
450 sr.min.x, sr.min.y, dx, dy, r.min.x, r.min.y);
451 dirtyXdata(dst, par->r);
452 return 1;
453 }
454
455 /*
456 * If no source alpha, a 1-bit mask, and a simple source
457 * we can just copy through the mask onto the destination.
458 */
459 if(dst->X && mask->X && !(mask->flags&Frepl)
460 && mask->chan == GREY1 && (par->state&Simplesrc)){
461 Point p;
462
463 mxm = mask->X;
464 r = rectsubpt(r, dst->r.min);
465 mr = rectsubpt(mr, mask->r.min);
466 p = subpt(r.min, mr.min);
467 if(dst->chan == GREY1){
468 gc = xgcsimplesrc0;
469 if(xgcsimplecolor0 != sdval){
470 XSetForeground(xdisplay, gc, sdval);
471 xgcsimplecolor0 = sdval;
472 }
473 if(xgcsimplepm0 != mxm->pmid){
474 XSetStipple(xdisplay, gc, mxm->pmid);
475 xgcsimplepm0 = mxm->pmid;
476 }
477 }else{
478 /* somehow this doesn't work on rob's mac
479 gc = xgcsimplesrc;
480 if(dst->chan == CMAP8 && xtblbit)
481 sdval = plan9tox11[sdval];
482
483 if(xgcsimplecolor != sdval){
484 XSetForeground(xdisplay, gc, sdval);
485 xgcsimplecolor = sdval;
486 }
487 if(xgcsimplepm != mxm->pmid){
488 XSetStipple(xdisplay, gc, mxm->pmid);
489 xgcsimplepm = mxm->pmid;
490 }
491 */
492 return 0;
493 }
494 XSetTSOrigin(xdisplay, gc, p.x, p.y);
495 XFillRectangle(xdisplay, dxm->pmid, gc, r.min.x, r.min.y, dx, dy);
496 dirtyXdata(dst, par->r);
497 return 1;
498 }
499 return 0;
500}118}
501 119
502/*120/*
@@ -507,7 +125,7 @@ xdraw_broken(Memdrawparam *par) · 4 unmodified lines
507static XColor map[256]; /* Plan 9 colormap array */125static XColor map[256]; /* Plan 9 colormap array */
508static XColor map7[128]; /* Plan 9 colormap array */126static XColor map7[128]; /* Plan 9 colormap array */
509static uchar map7to8[128][2];127static uchar map7to8[128][2];
510static Colormap xcmap; /* Default shared colormap */128static Colormap xcmap; /* Default shared colormap */
511 129
512extern int mousequeue;130extern int mousequeue;
513 131
@@ -533,20 +151,34 @@ static void graphicscmap(XColor*); · 19 unmodified lines
533static int xscreendepth;151static int xscreendepth;
534static XDisplay* xkmcon; /* used only in xproc */152static XDisplay* xkmcon; /* used only in xproc */
535static XDisplay* xsnarfcon; /* used holding clip.lk */153static XDisplay* xsnarfcon; /* used holding clip.lk */
536static ulong xblack;
537static ulong xwhite;
538 154
539static int putsnarf, assertsnarf;155static int putsnarf, assertsnarf;
540 156
541 Memimage *gscreen;157Memimage *gscreen;
542 Screeninfo screen;158Screeninfo screen;
543 159
544void160void
545flushmemscreen(Rectangle r)161flushmemscreen(Rectangle r)
546{162{
163 int x, y;
164 uchar *p;
165
547 assert(!drawcanqlock());166 assert(!drawcanqlock());
548 if(r.min.x >= r.max.x || r.min.y >= r.max.y)167 if(r.min.x >= r.max.x || r.min.y >= r.max.y)
549 return;168 return;
169
170 if(xtblbit && gscreen->chan == CMAP8)
171 for(y=r.min.y; y<r.max.y; y++)
172 for(x=r.min.x, p=byteaddr(gscreen, Pt(x,y)); x<r.max.x; x++, p++)
173 *p = plan9tox11[*p];
174
175 XPutImage(xdisplay, xscreenid, xgccopy, xscreenimage, r.min.x, r.min.y, r.min.x, r.min.y, Dx(r), Dy(r));
176
177 if(xtblbit && gscreen->chan == CMAP8)
178 for(y=r.min.y; y<r.max.y; y++)
179 for(x=r.min.x, p=byteaddr(gscreen, Pt(x,y)); x<r.max.x; x++, p++)
180 *p = x11toplan9[*p];
181
550 XCopyArea(xdisplay, xscreenid, xdrawable, xgccopy, r.min.x, r.min.y, Dx(r), Dy(r), r.min.x, r.min.y);182 XCopyArea(xdisplay, xscreenid, xdrawable, xgccopy, r.min.x, r.min.y, Dx(r), Dy(r), r.min.x, r.min.y);
551 XFlush(xdisplay);183 XFlush(xdisplay);
552}184}
@@ -567,14 +199,12 @@ screeninit(void) · 14 unmodified lines
567}199}
568 200
569uchar*201uchar*
570attachscreen(Rectangle *r, ulong *chan, int *depth,202attachscreen(Rectangle *r, ulong *chan, int *depth, int *width, int *softscreen)
571 int *width, int *softscreen, void **X)
572{203{
573 *r = gscreen->r;204 *r = gscreen->r;
574 *chan = gscreen->chan;205 *chan = gscreen->chan;
575 *depth = gscreen->depth;206 *depth = gscreen->depth;
576 *width = gscreen->width;207 *width = gscreen->width;
577 *X = gscreen->X;
578 *softscreen = 1;208 *softscreen = 1;
579 209
580 return gscreen->data->bdata;210 return gscreen->data->bdata;
@@ -708,7 +338,7 @@ static Memimage* · 127 unmodified lines
708xinitscreen(void)338xinitscreen(void)
709{339{
710 Memimage *gscreen;340 Memimage *gscreen;
711 int i, xsize, ysize, pmid;341 int i, xsize, ysize;
712 char *argv[2];342 char *argv[2];
713 char *disp_val;343 char *disp_val;
714 Window rootwin;344 Window rootwin;
@@ -868,31 +498,8 @@ xinitscreen(void) · 153 unmodified lines
868 XFlush(xdisplay);498 XFlush(xdisplay);
869 499
870 xscreenid = XCreatePixmap(xdisplay, xdrawable, Dx(r), Dy(r), xscreendepth);500 xscreenid = XCreatePixmap(xdisplay, xdrawable, Dx(r), Dy(r), xscreendepth);
871 gscreen = xallocmemimage(r, xscreenchan, xscreenid);501 gscreen = xallocmemimage(r, xscreenchan, xscreenid, &xscreenimage);
872
873 xgcfill = creategc(xscreenid);
874 XSetFillStyle(xdisplay, xgcfill, FillSolid);
875 xgccopy = creategc(xscreenid);502 xgccopy = creategc(xscreenid);
876 xgcsimplesrc = creategc(xscreenid);
877 XSetFillStyle(xdisplay, xgcsimplesrc, FillStippled);
878 xgczero = creategc(xscreenid);
879 xgcreplsrc = creategc(xscreenid);
880 XSetFillStyle(xdisplay, xgcreplsrc, FillTiled);
881
882 pmid = XCreatePixmap(xdisplay, xdrawable, 1, 1, 1);
883 xgcfill0 = creategc(pmid);
884 XSetForeground(xdisplay, xgcfill0, 0);
885 XSetFillStyle(xdisplay, xgcfill0, FillSolid);
886 xgccopy0 = creategc(pmid);
887 xgcsimplesrc0 = creategc(pmid);
888 XSetFillStyle(xdisplay, xgcsimplesrc0, FillStippled);
889 xgczero0 = creategc(pmid);
890 xgcreplsrc0 = creategc(pmid);
891 XSetFillStyle(xdisplay, xgcreplsrc0, FillTiled);
892 XFreePixmap(xdisplay, pmid);
893
894 XSetForeground(xdisplay, xgccopy, plan9tox11[0]);
895 XFillRectangle(xdisplay, xscreenid, xgccopy, 0, 0, xsize, ysize);
896 503
897 xkmcon = XOpenDisplay(NULL);504 xkmcon = XOpenDisplay(NULL);
898 if(xkmcon == 0){505 if(xkmcon == 0){
@@ -917,8 +524,6 @@ xinitscreen(void) · 18 unmodified lines
917 text = XInternAtom(xkmcon, "TEXT", False);524 text = XInternAtom(xkmcon, "TEXT", False);
918 compoundtext = XInternAtom(xkmcon, "COMPOUND_TEXT", False);525 compoundtext = XInternAtom(xkmcon, "COMPOUND_TEXT", False);
919 526
920 xblack = screen->black_pixel;
921 xwhite = screen->white_pixel;
922 return gscreen;527 return gscreen;
923}528}
924 529
include/draw.h+11−19
@@ -1,8 +1,3 @@
1#ifdef PLAN9
2#pragma src "/sys/src/libdraw"
3#pragma lib "libdraw.a"
4#endif
5
6typedef struct Cachefont Cachefont;1typedef struct Cachefont Cachefont;
7typedef struct Cacheinfo Cacheinfo;2typedef struct Cacheinfo Cacheinfo;
8typedef struct Cachesubf Cachesubf;3typedef struct Cachesubf Cachesubf;
@@ -17,10 +12,6 @@ typedef struct RGB RGB; · 8 unmodified lines
17typedef struct Screen Screen;12typedef struct Screen Screen;
18typedef struct Subfont Subfont;13typedef struct Subfont Subfont;
19 14
20#ifdef VARARGCK
21#pragma varargck type "R" Rectangle
22#pragma varargck type "P" Point
23#endif
24extern int Rfmt(Fmt*);15extern int Rfmt(Fmt*);
25extern int Pfmt(Fmt*);16extern int Pfmt(Fmt*);
26 17
@@ -140,11 +131,12 @@ enum { · 113 unmodified lines
140 RGB15 = CHAN4(CIgnore, 1, CRed, 5, CGreen, 5, CBlue, 5),131 RGB15 = CHAN4(CIgnore, 1, CRed, 5, CGreen, 5, CBlue, 5),
141 RGB16 = CHAN3(CRed, 5, CGreen, 6, CBlue, 5),132 RGB16 = CHAN3(CRed, 5, CGreen, 6, CBlue, 5),
142 RGB24 = CHAN3(CRed, 8, CGreen, 8, CBlue, 8),133 RGB24 = CHAN3(CRed, 8, CGreen, 8, CBlue, 8),
143 BGR24 = CHAN3(CBlue, 8, CGreen, 8, CRed, 8),
144 RGBA32 = CHAN4(CRed, 8, CGreen, 8, CBlue, 8, CAlpha, 8),134 RGBA32 = CHAN4(CRed, 8, CGreen, 8, CBlue, 8, CAlpha, 8),
145 ARGB32 = CHAN4(CAlpha, 8, CRed, 8, CGreen, 8, CBlue, 8), /* stupid VGAs */135 ARGB32 = CHAN4(CAlpha, 8, CRed, 8, CGreen, 8, CBlue, 8), /* stupid VGAs */
146 XRGB32 = CHAN4(CIgnore, 8, CRed, 8, CGreen, 8, CBlue, 8),136 XRGB32 = CHAN4(CIgnore, 8, CRed, 8, CGreen, 8, CBlue, 8),
147 XBGR32 = CHAN4(CIgnore, 8, CBlue, 8, CGreen, 8, CRed, 8),137 BGR24 = CHAN3(CBlue, 8, CGreen, 8, CRed, 8),
138 ABGR32 = CHAN4(CAlpha, 8, CBlue, 8, CGreen, 8, CRed, 8),
139 XBGR32 = CHAN4(CIgnore, 8, CBlue, 8, CGreen, 8, CRed, 8),
148};140};
149 141
150extern char* chantostr(char*, ulong);142extern char* chantostr(char*, ulong);
@@ -175,7 +167,7 @@ struct Screen · 24 unmodified lines
175 167
176struct Display168struct Display
177{169{
178 QLock qlock;170 QLock qlock;
179 int locking; /*program is using lockdisplay */171 int locking; /*program is using lockdisplay */
180 int dirno;172 int dirno;
181 int fd;173 int fd;
@@ -194,13 +186,13 @@ struct Display · 12 unmodified lines
194 Image *transparent;186 Image *transparent;
195 Image *image;187 Image *image;
196 uchar *buf;188 uchar *buf;
197 int bufsize;189 int bufsize;
198 uchar *bufp;190 uchar *bufp;
199 Font *defaultfont;191 Font *defaultfont;
200 Subfont *defaultsubfont;192 Subfont *defaultsubfont;
201 Image *windows;193 Image *windows;
202 Image *screenimage;194 Image *screenimage;
203 int _isnewdisplay;195 int _isnewdisplay;
204};196};
205 197
206struct Image198struct Image
@@ -210,7 +202,7 @@ struct Image · 3 unmodified lines
210 Rectangle r; /* rectangle in data area, local coords */202 Rectangle r; /* rectangle in data area, local coords */
211 Rectangle clipr; /* clipping region */203 Rectangle clipr; /* clipping region */
212 int depth; /* number of bits per pixel */204 int depth; /* number of bits per pixel */
213 ulong chan;205 ulong chan;
214 int repl; /* flag: data replicates to tile clipr */206 int repl; /* flag: data replicates to tile clipr */
215 Screen *screen; /* 0 if not a window */207 Screen *screen; /* 0 if not a window */
216 Image *next; /* next in list of windows */208 Image *next; /* next in list of windows */
@@ -397,6 +389,7 @@ extern int cmap2rgb(int); · 180 unmodified lines
397extern int cmap2rgba(int);389extern int cmap2rgba(int);
398extern void icossin(int, int*, int*);390extern void icossin(int, int*, int*);
399extern void icossin2(int, int, int*, int*);391extern void icossin2(int, int, int*, int*);
392extern int badrect(Rectangle);
400 393
401/*394/*
402 * Graphics395 * Graphics
@@ -480,7 +473,6 @@ extern Subfont* _getsubfont(Display*, char*); · 77 unmodified lines
480extern Subfont* getdefont(Display*);473extern Subfont* getdefont(Display*);
481extern void lockdisplay(Display*);474extern void lockdisplay(Display*);
482extern void unlockdisplay(Display*);475extern void unlockdisplay(Display*);
483extern int drawlsetrefresh(ulong, int, void*, void*);
484 476
485/*477/*
486 * Predefined 478 * Predefined
@@ -495,7 +487,7 @@ extern Rectangle ZR; · 8 unmodified lines
495 */487 */
496extern Display *display;488extern Display *display;
497extern Font *font;489extern Font *font;
498/* extern Image *screen; */490// extern Image *screen;
499extern Screen *_screen;491extern Screen *_screen;
500extern int _cursorfd;492extern int _cursorfd;
501extern int _drawdebug; /* set to 1 to see errors from flushimage */493extern int _drawdebug; /* set to 1 to see errors from flushimage */
@@ -518,6 +510,6 @@ extern void _twiddlecompressed(uchar*, int); · 16 unmodified lines
518extern int _compblocksize(Rectangle, int);510extern int _compblocksize(Rectangle, int);
519 511
520/* XXX backwards helps; should go */512/* XXX backwards helps; should go */
521extern int log2[];513// extern int log2[]; /* was used by libmemlayer/line.c */
522extern ulong drawld2chan[];514extern ulong drawld2chan[];
523extern void drawsetdebug(int);515extern void drawsetdebug(int);
include/memdraw.h+4−34
@@ -1,8 +1,3 @@
1#ifdef PLAN9
2#pragma src "/sys/src/libmemdraw"
3#pragma lib "libmemdraw.a"
4#endif
5
6typedef struct Memimage Memimage;1typedef struct Memimage Memimage;
7typedef struct Memdata Memdata;2typedef struct Memdata Memdata;
8typedef struct Memsubfont Memsubfont;3typedef struct Memsubfont Memsubfont;
@@ -54,8 +49,6 @@ struct Memimage · 45 unmodified lines
54 int shift[NChan];49 int shift[NChan];
55 int mask[NChan];50 int mask[NChan];
56 int nbits[NChan];51 int nbits[NChan];
57
58 void *X;
59};52};
60 53
61struct Memcmap54struct Memcmap
@@ -119,26 +112,20 @@ struct Memdrawparam · 57 unmodified lines
119 */112 */
120 113
121extern Memimage* allocmemimage(Rectangle, ulong);114extern Memimage* allocmemimage(Rectangle, ulong);
122extern Memimage* _allocmemimage(Rectangle, ulong);115extern Memimage* allocmemimaged(Rectangle, ulong, Memdata*);
123extern Memimage* allocmemimaged(Rectangle, ulong, Memdata*, void*);
124extern Memimage* readmemimage(int);116extern Memimage* readmemimage(int);
125extern Memimage* creadmemimage(int);117extern Memimage* creadmemimage(int);
126extern int writememimage(int, Memimage*);118extern int writememimage(int, Memimage*);
127extern void freememimage(Memimage*);119extern void freememimage(Memimage*);
128extern void _freememimage(Memimage*);
129extern int _loadmemimage(Memimage*, Rectangle, uchar*, int);
130extern int _cloadmemimage(Memimage*, Rectangle, uchar*, int);
131extern int _unloadmemimage(Memimage*, Rectangle, uchar*, int);
132extern int loadmemimage(Memimage*, Rectangle, uchar*, int);120extern int loadmemimage(Memimage*, Rectangle, uchar*, int);
133extern int cloadmemimage(Memimage*, Rectangle, uchar*, int);121extern int cloadmemimage(Memimage*, Rectangle, uchar*, int);
134extern int unloadmemimage(Memimage*, Rectangle, uchar*, int);122extern int unloadmemimage(Memimage*, Rectangle, uchar*, int);
135extern ulong* wordaddr(Memimage*, Point);123extern ulong* wordaddr(Memimage*, Point);
136extern uchar* byteaddr(Memimage*, Point);124extern uchar* byteaddr(Memimage*, Point);
125extern int drawclipnorepl(Memimage*, Rectangle*, Memimage*, Point*, Memimage*, Point*, Rectangle*, Rectangle*);
137extern int drawclip(Memimage*, Rectangle*, Memimage*, Point*, Memimage*, Point*, Rectangle*, Rectangle*);126extern int drawclip(Memimage*, Rectangle*, Memimage*, Point*, Memimage*, Point*, Rectangle*, Rectangle*);
138extern void memfillcolor(Memimage*, ulong);127extern void memfillcolor(Memimage*, ulong);
139extern void _memfillcolor(Memimage*, ulong);
140extern int memsetchan(Memimage*, ulong);128extern int memsetchan(Memimage*, ulong);
141extern ulong _rgbatoimg(Memimage*, ulong);
142 129
143/*130/*
144 * Graphics131 * Graphics
@@ -148,8 +135,6 @@ extern void memline(Memimage*, Point, Point, int, int, int, Memimage*, Point, in · 3 unmodified lines
148extern void mempoly(Memimage*, Point*, int, int, int, int, Memimage*, Point, int);135extern void mempoly(Memimage*, Point*, int, int, int, int, Memimage*, Point, int);
149extern void memfillpoly(Memimage*, Point*, int, int, Memimage*, Point, int);136extern void memfillpoly(Memimage*, Point*, int, int, Memimage*, Point, int);
150extern void _memfillpolysc(Memimage*, Point*, int, int, Memimage*, Point, int, int, int, int);137extern void _memfillpolysc(Memimage*, Point*, int, int, Memimage*, Point, int, int, int, int);
151extern Memdrawparam* _memimagedrawsetup(Memimage*, Rectangle, Memimage*, Point, Memimage*, Point, int);
152extern void _memimagedraw(Memdrawparam*);
153extern void memimagedraw(Memimage*, Rectangle, Memimage*, Point, Memimage*, Point, int);138extern void memimagedraw(Memimage*, Rectangle, Memimage*, Point, Memimage*, Point, int);
154extern int hwdraw(Memdrawparam*);139extern int hwdraw(Memdrawparam*);
155extern void memimageline(Memimage*, Point, Point, int, int, int, Memimage*, Point, int);140extern void memimageline(Memimage*, Point, Point, int, int, int, Memimage*, Point, int);
@@ -160,8 +145,7 @@ extern void memarc(Memimage*, Point, int, int, int, Memimage*, Point, int, int, · 4 unmodified lines
160extern Rectangle memlinebbox(Point, Point, int, int, int);145extern Rectangle memlinebbox(Point, Point, int, int, int);
161extern int memlineendsize(int);146extern int memlineendsize(int);
162extern void _memmkcmap(void);147extern void _memmkcmap(void);
163extern void _memimageinit(void);148extern int memimageinit(void);
164extern void memimageinit(void);
165 149
166/*150/*
167 * Subfont management151 * Subfont management
@@ -193,18 +177,4 @@ extern void rdb(void); · 25 unmodified lines
193extern int iprint(char*, ...);177extern int iprint(char*, ...);
194extern int drawdebug;178extern int drawdebug;
195 179
196/*180extern ulong pixelbits(Memimage*, Point);
197 * doprint interface: numbconv bit strings
198 */
199#ifdef VARARGCK
200#pragma varargck argpos iprint 1
201#pragma varargck type "llb" vlong
202#pragma varargck type "llb" uvlong
203#pragma varargck type "lb" long
204#pragma varargck type "lb" ulong
205#pragma varargck type "b" int
206#pragma varargck type "b" uint
207#endif
208
209extern ulong _pixelbits(Memimage*,Point);
210extern ulong pixelbits(Memimage*, Point);
kern/devdraw.c+3−4
@@ -921,19 +921,18 @@ initscreenimage(void) · 920 unmodified lines
921{921{
922 int width, depth;922 int width, depth;
923 ulong chan;923 ulong chan;
924 void *X;
925 Rectangle r;924 Rectangle r;
926 925
927 if(screenimage != nil)926 if(screenimage != nil)
928 return 1;927 return 1;
929 928
930 screendata.base = nil;929 screendata.base = nil;
931 screendata.bdata = attachscreen(&r, &chan, &depth, &width, &sdraw.softscreen, &X);930 screendata.bdata = attachscreen(&r, &chan, &depth, &width, &sdraw.softscreen);
932 if(screendata.bdata == nil && X == nil)931 if(screendata.bdata == nil)
933 return 0;932 return 0;
934 screendata.ref = 1;933 screendata.ref = 1;
935 934
936 screenimage = allocmemimaged(r, chan, &screendata, X);935 screenimage = allocmemimaged(r, chan, &screendata);
937 if(screenimage == nil){936 if(screenimage == nil){
938 /* RSC: BUG: detach screen */937 /* RSC: BUG: detach screen */
939 return 0;938 return 0;
kern/devkbd.c+1−0
@@ -117,6 +117,7 @@ kbdwrite(Chan *c, void *va, long n, vlong off) · 116 unmodified lines
117 USED(n);117 USED(n);
118 USED(off);118 USED(off);
119 error(Eperm);119 error(Eperm);
120 return -1; /* never reached */
120}121}
121 122
122Dev kbddevtab = {123Dev kbddevtab = {
kern/screen.h+1−1
@@ -55,7 +55,7 @@ void setcursor(void); · 54 unmodified lines
55void mouseset(Point);55void mouseset(Point);
56void drawflushr(Rectangle);56void drawflushr(Rectangle);
57void flushmemscreen(Rectangle);57void flushmemscreen(Rectangle);
58uchar *attachscreen(Rectangle*, ulong*, int*, int*, int*, void**);58uchar *attachscreen(Rectangle*, ulong*, int*, int*, int*);
59 59
60void drawqlock(void);60void drawqlock(void);
61void drawqunlock(void);61void drawqunlock(void);
libdraw/Makefile+2−0
@@ -5,10 +5,12 @@ LIB=libdraw.a · 4 unmodified lines
5OFILES=\5OFILES=\
6 alloc.$O\6 alloc.$O\
7 arith.$O\7 arith.$O\
8 badrect.$O\
8 bytesperline.$O\9 bytesperline.$O\
9 chan.$O\10 chan.$O\
10 defont.$O\11 defont.$O\
11 drawrepl.$O\12 drawrepl.$O\
13 fmt.$O\
12 icossin.$O\14 icossin.$O\
13 icossin2.$O\15 icossin2.$O\
14 rectclip.$O\16 rectclip.$O\
libdraw/alloc.c+41−35
@@ -3,13 +3,18 @@ · 2 unmodified lines
3#include <draw.h>3#include <draw.h>
4 4
5Image*5Image*
6allocimage(Display *d, Rectangle r, ulong chan, int repl, ulong val)6allocimage(Display *d, Rectangle r, ulong chan, int repl, ulong col)
7{7{
8 return _allocimage(nil, d, r, chan, repl, val, 0, 0);8 Image *i;
9
10 i = _allocimage(nil, d, r, chan, repl, col, 0, 0);
11 if(i != nil)
12 setmalloctag(i, getcallerpc(&d));
13 return i;
9}14}
10 15
11Image*16Image*
12_allocimage(Image *ai, Display *d, Rectangle r, ulong chan, int repl, ulong val, int screenid, int refresh)17_allocimage(Image *ai, Display *d, Rectangle r, ulong chan, int repl, ulong col, int screenid, int refresh)
13{18{
14 uchar *a;19 uchar *a;
15 char *err;20 char *err;
@@ -18,9 +23,13 @@ _allocimage(Image *ai, Display *d, Rectangle r, ulong chan, int repl, ulong val, · 2 unmodified lines
18 int id;23 int id;
19 int depth;24 int depth;
20 25
21 err = 0;26 err = nil;
22 i = 0;27 i = nil;
23 28
29 if(badrect(r)){
30 werrstr("bad rectangle");
31 return nil;
32 }
24 if(chan == 0){33 if(chan == 0){
25 werrstr("bad channel descriptor");34 werrstr("bad channel descriptor");
26 return nil;35 return nil;
@@ -30,18 +39,18 @@ _allocimage(Image *ai, Display *d, Rectangle r, ulong chan, int repl, ulong val, · 3 unmodified lines
30 if(depth == 0){39 if(depth == 0){
31 err = "bad channel descriptor";40 err = "bad channel descriptor";
32 Error:41 Error:
33 if(err)42 if(err != nil)
34 werrstr("allocimage: %s", err);43 werrstr("allocimage: %s", err);
35 else44 else
36 werrstr("allocimage: %r");45 werrstr("allocimage: %r");
37 free(i);46 free(i);
38 return 0;47 return nil;
39 }48 }
40 49
41 /* flush pending data so we don't get error allocating the image */50 /* flush pending data so we don't get error allocating the image */
42 flushimage(d, 0);51 flushimage(d, 0);
43 a = bufimage(d, 1+4+4+1+4+1+4*4+4*4+4);52 a = bufimage(d, 1+4+4+1+4+1+4*4+4*4+4);
44 if(a == 0)53 if(a == nil)
45 goto Error;54 goto Error;
46 d->imageid++;55 d->imageid++;
47 id = d->imageid;56 id = d->imageid;
@@ -64,17 +73,17 @@ _allocimage(Image *ai, Display *d, Rectangle r, ulong chan, int repl, ulong val, · 16 unmodified lines
64 BPLONG(a+35, clipr.min.y);73 BPLONG(a+35, clipr.min.y);
65 BPLONG(a+39, clipr.max.x);74 BPLONG(a+39, clipr.max.x);
66 BPLONG(a+43, clipr.max.y);75 BPLONG(a+43, clipr.max.y);
67 BPLONG(a+47, val);76 BPLONG(a+47, col);
68 if(flushimage(d, 0) < 0)77 if(flushimage(d, 0) < 0)
69 goto Error;78 goto Error;
70 79
71 if(ai)80 if(ai != nil)
72 i = ai;81 i = ai;
73 else{82 else{
74 i = malloc(sizeof(Image));83 i = malloc(sizeof(Image));
75 if(i == nil){84 if(i == nil){
76 a = bufimage(d, 1+4);85 a = bufimage(d, 1+4);
77 if(a){86 if(a != nil){
78 a[0] = 'f';87 a[0] = 'f';
79 BPLONG(a+1, id);88 BPLONG(a+1, id);
80 flushimage(d, 0);89 flushimage(d, 0);
@@ -89,8 +98,8 @@ _allocimage(Image *ai, Display *d, Rectangle r, ulong chan, int repl, ulong val, · 8 unmodified lines
89 i->r = r;98 i->r = r;
90 i->clipr = clipr;99 i->clipr = clipr;
91 i->repl = repl;100 i->repl = repl;
92 i->screen = 0;101 i->screen = nil;
93 i->next = 0;102 i->next = nil;
94 return i;103 return i;
95}104}
96 105
@@ -103,25 +112,24 @@ namedimage(Display *d, char *name) · 6 unmodified lines
103 int id, n;112 int id, n;
104 ulong chan;113 ulong chan;
105 114
106 err = 0;115 err = nil;
107 i = 0;116 i = nil;
108 117
109 n = strlen(name);118 n = strlen(name);
110 if(n >= 256){119 if(n >= 256){
111 err = "name too long";120 err = "name too long";
112 Error:121 Error:
113 if(err)122 if(err != nil)
114 werrstr("namedimage: %s", err);123 werrstr("namedimage: %s", err);
115 else124 else
116 werrstr("namedimage: %r");125 werrstr("namedimage: %r");
117 if(i)126 free(i);
118 free(i);127 return nil;
119 return 0;
120 }128 }
121 /* flush pending data so we don't get error allocating the image */129 /* flush pending data so we don't get error allocating the image */
122 flushimage(d, 0);130 flushimage(d, 0);
123 a = bufimage(d, 1+4+1+n);131 a = bufimage(d, 1+4+1+n);
124 if(a == 0)132 if(a == nil)
125 goto Error;133 goto Error;
126 d->imageid++;134 d->imageid++;
127 id = d->imageid;135 id = d->imageid;
@@ -140,7 +148,7 @@ namedimage(Display *d, char *name) · 12 unmodified lines
140 if(i == nil){148 if(i == nil){
141 Error1:149 Error1:
142 a = bufimage(d, 1+4);150 a = bufimage(d, 1+4);
143 if(a){151 if(a != nil){
144 a[0] = 'f';152 a[0] = 'f';
145 BPLONG(a+1, id);153 BPLONG(a+1, id);
146 flushimage(d, 0);154 flushimage(d, 0);
@@ -164,8 +172,8 @@ namedimage(Display *d, char *name) · 17 unmodified lines
164 i->clipr.min.y = atoi(buf+9*12);172 i->clipr.min.y = atoi(buf+9*12);
165 i->clipr.max.x = atoi(buf+10*12);173 i->clipr.max.x = atoi(buf+10*12);
166 i->clipr.max.y = atoi(buf+11*12);174 i->clipr.max.y = atoi(buf+11*12);
167 i->screen = 0;175 i->screen = nil;
168 i->next = 0;176 i->next = nil;
169 return i;177 return i;
170}178}
171 179
@@ -177,7 +185,7 @@ nameimage(Image *i, char *name, int in) · 5 unmodified lines
177 185
178 n = strlen(name);186 n = strlen(name);
179 a = bufimage(i->display, 1+4+1+1+n);187 a = bufimage(i->display, 1+4+1+1+n);
180 if(a == 0)188 if(a == nil)
181 return 0;189 return 0;
182 a[0] = 'N';190 a[0] = 'N';
183 BPLONG(a+1, i->id);191 BPLONG(a+1, i->id);
@@ -196,23 +204,16 @@ _freeimage1(Image *i) · 12 unmodified lines
196 Display *d;204 Display *d;
197 Image *w;205 Image *w;
198 206
199 if(i == 0)207 if(i == nil || i->display == nil)
200 return 0;208 return 0;
201 /* make sure no refresh events occur on this if we block in the write */
202 d = i->display;209 d = i->display;
203 /* flush pending data so we don't get error deleting the image */
204 flushimage(d, 0);210 flushimage(d, 0);
205 a = bufimage(d, 1+4);211 if(i->screen != nil){
206 if(a == 0)
207 return -1;
208 a[0] = 'f';
209 BPLONG(a+1, i->id);
210 if(i->screen){
211 w = d->windows;212 w = d->windows;
212 if(w == i)213 if(w == i)
213 d->windows = i->next;214 d->windows = i->next;
214 else215 else
215 while(w){216 while(w != nil){
216 if(w->next == i){217 if(w->next == i){
217 w->next = i->next;218 w->next = i->next;
218 break;219 break;
@@ -220,7 +221,12 @@ _freeimage1(Image *i) · 1 unmodified line
220 w = w->next;221 w = w->next;
221 }222 }
222 }223 }
223 if(flushimage(d, i->screen!=0) < 0)224 a = bufimage(d, 1+4);
225 if(a == nil)
226 return -1;
227 a[0] = 'f';
228 BPLONG(a+1, i->id);
229 if(flushimage(d, i->screen!=nil) < 0)
224 return -1;230 return -1;
225 231
226 return 0;232 return 0;
libdraw/arith.c+6−21
@@ -159,15 +159,18 @@ combinerect(Rectangle *r1, Rectangle r2) · 158 unmodified lines
159 r1->max.y = r2.max.y;159 r1->max.y = r2.max.y;
160}160}
161 161
162ulong162ulong drawld2chan[] = {
163drawld2chan[] = {
164 GREY1,163 GREY1,
165 GREY2,164 GREY2,
166 GREY4,165 GREY4,
167 CMAP8,166 CMAP8,
168};167};
169 168
170int log2[] = { -1, 0, 1, -1, 2, -1, -1, -1, 3, -1, -1, -1, -1, -1, -1, -1, 4, -1, -1, -1, -1, -1, -1, -1, 4 /* BUG */, -1, -1, -1, -1, -1, -1, -1, 5 };169/*
170 * was used by libmemlayer/line.c; made static, instead of deleting it,
171 * to avoid updating many binaries on sources.
172 */
173static int log2[] = { -1, 0, 1, -1, 2, -1, -1, -1, 3, -1, -1, -1, -1, -1, -1, -1, 4, -1, -1, -1, -1, -1, -1, -1, 4 /* BUG */, -1, -1, -1, -1, -1, -1, -1, 5 };
171 174
172ulong175ulong
173setalpha(ulong color, uchar alpha)176setalpha(ulong color, uchar alpha)
@@ -186,21 +189,3 @@ setalpha(ulong color, uchar alpha) · 12 unmodified lines
186 189
187Point ZP;190Point ZP;
188Rectangle ZR;191Rectangle ZR;
189int
190Rfmt(Fmt *f)
191{
192 Rectangle r;
193
194 r = va_arg(f->args, Rectangle);
195 return fmtprint(f, "%P %P", r.min, r.max);
196}
197
198int
199Pfmt(Fmt *f)
200{
201 Point p;
202
203 p = va_arg(f->args, Point);
204 return fmtprint(f, "[%d %d]", p.x, p.y);
205}
206
libdraw/badrect.c+22−0
@@ -0,0 +1,22 @@
1#include <u.h>
2#include <libc.h>
3#include <draw.h>
4
5/*
6 * check for zero, negative size or insanely huge rectangle.
7 */
8int
9badrect(Rectangle r)
10{
11 int x, y;
12 uint z;
13
14 x = Dx(r);
15 y = Dy(r);
16 if(x > 0 && y > 0){
17 z = x*y;
18 if(z/x == y && z < 0x10000000)
19 return 0;
20 }
21 return 1;
22}
libdraw/chan.c+5−1
@@ -41,9 +41,10 @@ strtochan(char *s) · 40 unmodified lines
41{41{
42 char *p, *q;42 char *p, *q;
43 ulong c;43 ulong c;
44 int t, n;44 int t, n, d;
45 45
46 c = 0;46 c = 0;
47 d = 0;
47 p=s;48 p=s;
48 while(*p && xisspace(*p))49 while(*p && xisspace(*p))
49 p++;50 p++;
@@ -55,9 +56,12 @@ strtochan(char *s) · 5 unmodified lines
55 if(p[1] < '0' || p[1] > '9')56 if(p[1] < '0' || p[1] > '9')
56 return 0;57 return 0;
57 n = p[1]-'0';58 n = p[1]-'0';
59 d += n;
58 c = (c<<8) | __DC(t, n);60 c = (c<<8) | __DC(t, n);
59 p += 2;61 p += 2;
60 }62 }
63 if(d==0 || (d>8 && d%8) || (d<8 && 8%d))
64 return 0;
61 return c;65 return c;
62}66}
63 67
libdraw/defont.c+358−372
@@ -3,384 +3,370 @@ · 2 unmodified lines
3#include <draw.h>3#include <draw.h>
4 4
5/*5/*
6 * lucm/latin1.9, in uncompressed form6 * vga/vga00, in uncompressed form
7 */7 */
8uchar8uchar
9defontdata[] =9defontdata[] =
10{10{
110x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x30,0x20,0x20,0x20,0x20,0x20,110x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x30,0x20,0x20,0x20,0x20,0x20,
120x20,0x20,0x20,0x20,0x20,0x20,0x30,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,120x20,0x20,0x20,0x20,0x20,0x20,0x30,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
130x20,0x20,0x30,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x32,0x33,0x30,0x34,0x20,130x20,0x20,0x30,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x32,0x30,0x34,0x38,0x20,
140x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x31,0x35,0x20,0x00,0x00,0x00,0x00,140x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x31,0x36,0x20,0x00,0x00,0x00,0x00,
150x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,150x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
160x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,160x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
170x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,170x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
180x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,180x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
190x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,190x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
200x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,200x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x30,0x00,0x00,0x00,
210x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,210x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
220x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,220x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
230x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xff,0xff,230x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
240xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,240x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
250xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,250x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
260xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,260x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x0c,0x10,0x76,
270x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,270x6c,0x38,0x00,0x00,0x30,0x0c,0x10,0x6c,0x30,0x0c,0x18,0x66,0x00,0x76,0x60,0x0c,
280x00,0x00,0x00,0x00,0x30,0x06,0x06,0x03,0x42,0x40,0x00,0x00,0x00,0x18,0x03,0x03,280x10,0x76,0x6c,0x00,0x00,0x60,0x0c,0x10,0x6c,0x0c,0x00,0x00,0x00,0x00,0x00,0x00,
290x02,0x43,0x00,0x60,0x60,0x48,0x00,0x0d,0x0c,0x01,0x81,0x80,0xd0,0x90,0x00,0x00,290x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
300x18,0x01,0x81,0x81,0x40,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,300x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x70,0xe0,
310x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,310xe0,0xe0,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xe0,0xe0,0xe0,0xe0,
320x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x7f,0x9c,0x1c,320xe0,0x90,0x70,0xe0,0x70,0x00,0x70,0xe0,0x00,0x00,0x00,0x00,0x00,0x00,0x66,0x00,
330x0e,0x07,0x01,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xe0,0x70,330x18,0x00,0x00,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
340x38,0x1c,0x0e,0x04,0x81,0xc1,0xc0,0x70,0x00,0x1c,0x1c,0x00,0x00,0x00,0x00,0x00,340x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
350x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,350x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
360x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,360x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x00,0x30,0x00,0x00,0x00,
370x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,370x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
380x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,380x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
390x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,390x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
400x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,400x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x38,
410x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xaa,0x80,0xc0,0x63,0xe3,410x00,0x00,0x00,0x7c,0x00,0x00,0x3c,0x00,0x00,0x00,0x00,0x00,0x38,0x00,0x70,0x70,
420xf1,0xf8,0xfe,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xfc,0x7f,0xff,0xff,0x1f,0x8f,420x00,0x00,0x00,0x00,0x00,0x30,0x38,0x00,0xc0,0xc0,0xe0,0x00,0x30,0x18,0x38,0xdc,
430xc7,0xe3,0xf1,0xfb,0x7e,0x3e,0x3f,0x8f,0xff,0xe3,0xe3,0xff,0xff,0xff,0xff,0xff,430x6c,0x6c,0x00,0x00,0x18,0x18,0x38,0x6c,0x18,0x18,0x3c,0x66,0x00,0xdc,0x30,0x18,
440x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,440x38,0xdc,0x6c,0x00,0x00,0x30,0x18,0x38,0x6c,0x18,0x00,0x00,0x00,0x00,0x10,0x00,
450x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,450x00,0x38,0x00,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x00,0x00,
460x00,0x00,0x00,0x00,0x0c,0x18,0x09,0x05,0x82,0x40,0xc0,0x00,0x00,0x06,0x0c,0x04,460x10,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x00,0xda,0x00,0x80,0x80,
470x82,0x40,0xc1,0x80,0x90,0x48,0x00,0x16,0x03,0x06,0x02,0x41,0x60,0x90,0x00,0x00,470x80,0x80,0x90,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x90,0x90,0x90,0x90,
480x06,0x06,0x02,0x41,0x41,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,480x90,0xd0,0x80,0x80,0x90,0x00,0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x18,0x66,0x00,
490x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,490x7c,0x00,0x38,0x30,0x0c,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x18,0x7c,0x7c,
500x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3e,0x7f,0xa0,0x10,500x0c,0xfe,0x38,0xfe,0x7c,0x7c,0x00,0x00,0x00,0x00,0x00,0x7c,0x00,0x10,0xfc,0x3c,
510x08,0x04,0x02,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x90,0x48,510xf8,0xfe,0xfe,0x3c,0xc6,0x3c,0x1e,0xe6,0xf0,0xc6,0xc6,0x7c,0xfc,0x7c,0xfc,0x7c,
520x24,0x12,0x09,0x06,0x82,0x01,0x00,0x90,0x00,0x20,0x10,0x00,0x00,0x00,0x00,0x00,520x7e,0xc6,0xc6,0xc6,0xc6,0x66,0xfe,0x3c,0x00,0x3c,0x6c,0x00,0x18,0x00,0xe0,0x00,
530x00,0x00,0x04,0x80,0x00,0x40,0x00,0x00,0x38,0x06,0x18,0x00,0x00,0x00,0x00,0x00,530x1c,0x00,0x38,0x00,0xe0,0x18,0x06,0xe0,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
540x00,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,540x10,0x00,0x00,0x00,0x00,0x00,0x00,0x0e,0x18,0x70,0x76,0x00,0x00,0x00,0x00,0x00,
550x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,550x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
560x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,560x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x6c,
570x00,0x00,0x07,0xc6,0x01,0xf0,0x00,0x00,0x0c,0x00,0x18,0x00,0x00,0x30,0x00,0x3c,570x00,0x66,0x18,0xc6,0x6c,0x3c,0x6c,0x00,0x00,0x00,0x38,0x00,0x6c,0x00,0xd8,0xd8,
580x00,0x60,0x06,0x01,0x8c,0x07,0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,580x0c,0x00,0x7f,0x00,0x00,0x70,0x6c,0x00,0xc0,0xc0,0x30,0x30,0x00,0x00,0x6c,0x00,
590x00,0x00,0x00,0x00,0x00,0x00,0x01,0xe0,0xc3,0xc0,0x01,0x54,0x9c,0xc0,0x5f,0xef,590x00,0x38,0x3e,0x3c,0x00,0x00,0x44,0x00,0x00,0x00,0x42,0x00,0xf8,0x00,0x00,0x00,
600xf7,0xfb,0xfd,0xbf,0xff,0xff,0xff,0xff,0xff,0xff,0xfb,0x7f,0xff,0xff,0x6f,0xb7,600x44,0x00,0x00,0x00,0x7a,0x00,0x00,0x44,0x00,0x00,0xf0,0x3c,0x60,0x18,0x38,0x76,
610xdb,0xed,0xf6,0xf9,0x7d,0xfe,0xff,0x6f,0xff,0xdf,0xef,0xff,0xff,0xff,0xff,0xff,610x6c,0x6c,0x00,0x00,0x60,0x0c,0x38,0x6c,0x30,0x0c,0x38,0x66,0x76,0x76,0x60,0x0c,
620xff,0x00,0x01,0x00,0x00,0x00,0x00,0x30,0x00,0x14,0x00,0x00,0x00,0x00,0x00,0x00,620x38,0x76,0x6c,0x00,0x00,0x60,0x18,0x38,0xcc,0x0c,0xe0,0x6c,0x02,0x00,0xe0,0xe0,
630x00,0x38,0x00,0x00,0x00,0x00,0x00,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,630xe0,0xe0,0xf0,0x18,0x70,0x48,0x20,0x48,0x70,0x38,0x38,0x38,0x90,0x90,0x90,0x90,
640x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x20,0x00,0x00,0x00,0x00,0x00,640x90,0xb0,0x60,0xe0,0x80,0xe0,0x60,0xe0,0x70,0x38,0x70,0x48,0x00,0x3c,0x66,0x6c,
650x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,650xc6,0x00,0x6c,0x30,0x18,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x6c,0x38,0xc6,0xc6,
660x00,0x00,0x00,0x00,0x00,0x00,0x00,0x78,0x30,0x06,0x06,0x06,0x82,0x80,0xc0,0x00,660x1c,0xc0,0x60,0xc6,0xc6,0xc6,0x00,0x00,0x06,0x00,0x60,0xc6,0x7c,0x38,0x66,0x66,
670x00,0x18,0x03,0x03,0x02,0x41,0x80,0x30,0x30,0x24,0x76,0x0d,0x0c,0x00,0xc0,0xc0,670x6c,0x66,0x66,0x66,0xc6,0x18,0x0c,0x66,0x60,0xee,0xe6,0xc6,0x66,0xc6,0x66,0xc6,
680xd0,0x50,0x00,0x00,0x18,0x01,0x81,0x81,0x40,0x30,0x00,0x28,0x0f,0x7f,0xbc,0x1c,680x7e,0xc6,0xc6,0xc6,0xc6,0x66,0xc6,0x30,0x80,0x0c,0xc6,0x00,0x00,0x00,0x60,0x00,
690x0e,0x07,0x03,0xc0,0x10,0x70,0x24,0x10,0x09,0x07,0x03,0x80,0xe0,0x70,0x90,0x48,690x0c,0x00,0x6c,0x00,0x60,0x18,0x06,0x60,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
700x24,0x12,0x09,0x05,0x81,0x81,0xc0,0x80,0x70,0x18,0x1c,0x07,0x01,0xc1,0xc0,0x90,700x30,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x18,0xdc,0x00,0x00,0x00,0x00,0x00,
710x00,0x0c,0x04,0x84,0x83,0xe1,0xc0,0xe0,0x38,0x0c,0x0c,0x02,0x00,0x00,0x00,0x00,710x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
720x00,0x06,0x1c,0x06,0x0f,0x87,0xc0,0x63,0xf8,0x78,0xfe,0x3e,0x0e,0x00,0x00,0x00,720x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x3c,0x64,
730x00,0x00,0x00,0x7c,0x1c,0x0c,0x1f,0x03,0xc7,0xc3,0xf1,0xf8,0x3c,0x63,0x3f,0x0f,730x00,0x66,0x18,0x60,0x6c,0x42,0x6c,0x00,0x00,0x00,0x44,0x7c,0x6c,0x00,0x30,0x30,
740x8c,0x66,0x06,0x19,0x84,0x78,0x7e,0x1e,0x1f,0x07,0xcf,0xf3,0x1b,0x0d,0x86,0x63,740x18,0x00,0xdb,0x00,0x00,0x30,0x6c,0x00,0xc2,0xc2,0x62,0x30,0x10,0x10,0x10,0x10,
750x61,0x9f,0xc6,0x06,0x00,0x30,0x00,0x00,0x10,0x00,0x18,0x00,0x00,0x30,0x00,0x60,750x10,0x10,0x6c,0x66,0xfe,0xfe,0xfe,0xfe,0x3c,0x3c,0x3c,0x3c,0x6c,0xc6,0x7c,0x7c,
760x00,0x60,0x06,0x01,0x8c,0x00,0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x80,760x7c,0x7c,0x7c,0x00,0xc4,0xc6,0xc6,0xc6,0xc6,0x66,0x60,0x66,0x30,0x30,0x6c,0xdc,
770x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0xc0,0x60,0x00,0xaa,0xb6,0xc0,0x43,0xe3,770x6c,0x38,0x00,0x00,0x30,0x18,0x6c,0x6c,0x18,0x18,0x6c,0x66,0x1c,0xdc,0x30,0x18,
780xf1,0xf8,0xfc,0x3f,0xef,0x8f,0xdb,0xef,0xf6,0xf8,0xfb,0xff,0x1f,0x8f,0x6f,0xb7,780x6c,0xdc,0x6c,0x00,0x00,0x30,0x30,0x6c,0xcc,0x18,0x60,0x6c,0x80,0x00,0x10,0x80,
790xdb,0xed,0xf6,0xfa,0x7e,0x7e,0x3f,0x7f,0x8f,0xe7,0xe3,0xf8,0xfe,0x3e,0x3f,0x6f,790x80,0x80,0x90,0x3c,0x48,0x48,0x20,0x48,0x40,0x48,0x40,0x40,0x90,0x90,0x90,0x90,
800x00,0x00,0x01,0x01,0xc8,0x0b,0x0c,0x30,0x7c,0x14,0x0f,0x0f,0x00,0x00,0x00,0x00,800x90,0x90,0x10,0x80,0x80,0x80,0x10,0x80,0x40,0x40,0x48,0x48,0x00,0x3c,0x24,0x6c,
810x78,0x00,0x1c,0x00,0x0f,0x07,0x81,0x80,0x00,0x7c,0x00,0x00,0x1c,0x0f,0x80,0x04,810xc2,0xc2,0x6c,0x20,0x30,0x0c,0x00,0x00,0x00,0x00,0x00,0x02,0xc6,0x78,0x06,0x06,
820x42,0x23,0x90,0x00,0x18,0x0c,0x06,0x03,0x01,0x80,0xc0,0x3c,0x3c,0x3f,0x1f,0x8f,820x3c,0xc0,0xc0,0x06,0xc6,0xc6,0x18,0x18,0x0c,0x00,0x30,0xc6,0xc6,0x6c,0x66,0xc2,
830xc7,0xe7,0xe3,0xf1,0xf8,0xfc,0x7c,0x30,0x8f,0x07,0x83,0xc1,0xe0,0xf0,0x00,0x3d,830x66,0x62,0x62,0xc2,0xc6,0x18,0x0c,0x66,0x60,0xfe,0xf6,0xc6,0x66,0xc6,0x66,0xc6,
840x31,0x98,0xcc,0x66,0x36,0x19,0x80,0xcc,0x0c,0x18,0x09,0x0b,0x02,0x81,0x20,0x00,840x5a,0xc6,0xc6,0xc6,0x6c,0x66,0x86,0x30,0xc0,0x0c,0x00,0x00,0x00,0x00,0x60,0x00,
850x00,0x06,0x0c,0x04,0x82,0x40,0x60,0xc0,0x48,0x24,0x18,0x16,0x03,0x03,0x01,0x21,850x0c,0x00,0x64,0x00,0x60,0x00,0x00,0x60,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
860x60,0x50,0x00,0x00,0x06,0x06,0x02,0x41,0x40,0xc1,0x80,0x28,0x87,0x7f,0x84,0x10,860x30,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x18,0x00,0x10,0x00,0x00,0x00,0x00,
870x08,0x04,0x02,0x40,0x38,0x48,0x24,0x10,0x09,0x04,0x04,0x81,0x00,0x80,0x90,0x48,870x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
880x24,0x12,0x09,0x04,0x80,0x41,0x00,0x80,0x40,0x04,0x10,0x04,0x02,0x01,0x20,0x90,880x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x66,0x60,
890x00,0x0c,0x04,0x84,0x86,0x53,0x65,0xb0,0x08,0x18,0x06,0x0a,0x80,0x00,0x00,0x00,890x66,0x3c,0x18,0x38,0x00,0x99,0x3e,0x00,0x00,0x00,0xba,0x00,0x38,0x18,0x60,0x18,
900x00,0x0c,0x36,0x0e,0x19,0xcc,0xe0,0xe3,0xf8,0xcc,0xfe,0x63,0x1b,0x00,0x00,0x00,900x00,0x00,0xdb,0x00,0x00,0x30,0x38,0x00,0xc6,0xc6,0x36,0x00,0x38,0x38,0x38,0x38,
910x00,0x00,0x00,0xc6,0x62,0x0c,0x19,0x86,0x66,0x63,0x01,0x80,0x66,0x63,0x0c,0x01,910x38,0x38,0xcc,0xc2,0x66,0x66,0x66,0x66,0x18,0x18,0x18,0x18,0x66,0xe6,0xc6,0xc6,
920x8c,0xc6,0x06,0x19,0xc4,0xcc,0x63,0x33,0x19,0x8c,0x61,0x83,0x1b,0x0d,0x86,0x63,920xc6,0xc6,0xc6,0x00,0xce,0xc6,0xc6,0xc6,0xc6,0x66,0x7c,0x66,0x00,0x00,0x00,0x00,
930x61,0x80,0xc6,0x03,0x00,0x30,0x30,0x00,0x1c,0x00,0x18,0x00,0x00,0x30,0x00,0x60,930x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3c,0x00,0x00,0x00,
940x00,0x60,0x00,0x00,0x0c,0x00,0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x80,940x00,0x00,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x00,0x82,0x00,0xe0,0xe0,
950x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0xc0,0x60,0x01,0x54,0x86,0xc0,0x7b,0xef,950xe0,0xe0,0x90,0x3c,0x70,0x78,0x20,0x48,0x70,0x40,0x30,0x30,0xe0,0xe0,0xe0,0xe0,
960xf7,0xfb,0xfd,0xbf,0xc7,0xb7,0xdb,0xef,0xf6,0xfb,0xfb,0x7e,0xff,0x7f,0x6f,0xb7,960xe0,0x90,0xe0,0xe0,0x70,0xe0,0xe0,0xe0,0x70,0x58,0x70,0x48,0x00,0x3c,0x00,0xfe,
970xdb,0xed,0xf6,0xfb,0x7f,0xbe,0xff,0x7f,0xbf,0xfb,0xef,0xfb,0xfd,0xfe,0xdf,0x6f,970xc0,0xc6,0x38,0x00,0x30,0x0c,0x66,0x18,0x00,0x00,0x00,0x06,0xc6,0x18,0x0c,0x06,
980xff,0x00,0x07,0x83,0x24,0x13,0x0c,0x30,0xc6,0x00,0x10,0x81,0x80,0x00,0x00,0x00,980x6c,0xc0,0xc0,0x06,0xc6,0xc6,0x18,0x18,0x18,0x7e,0x18,0x0c,0xc6,0xc6,0x66,0xc0,
990x84,0x00,0x22,0x00,0x01,0x80,0xc0,0x00,0x00,0xf4,0x00,0x00,0x2c,0x18,0xc0,0x0c,990x66,0x68,0x68,0xc0,0xc6,0x18,0x0c,0x6c,0x60,0xfe,0xfe,0xc6,0x66,0xc6,0x66,0x60,
1000x46,0x20,0x90,0x00,0x18,0x0c,0x06,0x03,0x01,0x80,0xc0,0x70,0x66,0x30,0x18,0x0c,1000x18,0xc6,0xc6,0xc6,0x7c,0x66,0x0c,0x30,0xe0,0x0c,0x00,0x00,0x00,0x78,0x78,0x7c,
1010x06,0x01,0x80,0xc0,0x60,0x30,0x66,0x38,0x99,0x8c,0xc6,0x63,0x31,0x98,0x00,0x66,1010x3c,0x7c,0x60,0x76,0x6c,0x38,0x0e,0x66,0x18,0xec,0xdc,0x7c,0xdc,0x76,0xdc,0x7c,
1020x31,0x98,0xcc,0x66,0x36,0x19,0x80,0xcc,0x00,0x00,0x00,0x00,0x00,0x00,0xc0,0x00,1020xfc,0xcc,0x66,0xc6,0xc6,0xc6,0xfe,0x18,0x18,0x18,0x00,0x38,0x00,0x00,0x00,0x00,
1030x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x6c,0x00,0x00,0x00,0x00,0x00,1030x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
1040x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x00,0xff,0x7f,0xb8,0x1c,1040x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x60,0xf0,
1050x0e,0x07,0x02,0x40,0x7c,0x70,0x3c,0x10,0x09,0x07,0x04,0x00,0xc0,0x60,0xe0,0x70,1050x3c,0x18,0x18,0x6c,0x00,0xa5,0x00,0x36,0x00,0x00,0xb2,0x00,0x00,0x18,0xc8,0xd8,
1060x38,0x1c,0x0e,0x04,0x83,0x81,0xc0,0x70,0x70,0x38,0x1c,0x07,0x02,0xc1,0xc0,0x90,1060x00,0xcc,0xdb,0x00,0x00,0x30,0x00,0xd8,0xcc,0xcc,0xec,0x30,0x6c,0x6c,0x6c,0x6c,
1070x00,0x0c,0x00,0x04,0x86,0x43,0x69,0xb0,0x30,0x18,0x06,0x07,0x01,0x00,0x00,0x00,1070x6c,0x6c,0xcc,0xc0,0x62,0x62,0x62,0x62,0x18,0x18,0x18,0x18,0x66,0xf6,0xc6,0xc6,
1080x00,0x0c,0x63,0x16,0x00,0xc0,0x61,0x62,0x01,0x80,0x06,0x63,0x31,0x80,0x00,0x00,1080xc6,0xc6,0xc6,0x66,0xce,0xc6,0xc6,0xc6,0xc6,0x66,0x66,0x66,0x78,0x78,0x78,0x78,
1090x60,0x00,0xc0,0x06,0x43,0x16,0x19,0x8c,0x06,0x33,0x01,0x80,0xc0,0x63,0x0c,0x01,1090x78,0x78,0xcc,0x7c,0x7c,0x7c,0x7c,0x7c,0x38,0x38,0x38,0x38,0x06,0xdc,0x7c,0x7c,
1100x8c,0x86,0x07,0x39,0xc5,0x86,0x63,0x61,0x99,0x8c,0x01,0x83,0x1b,0x0d,0xb6,0x63,1100x7c,0x7c,0x7c,0x18,0x7a,0xcc,0xcc,0xcc,0xcc,0xc6,0x7c,0xc6,0x02,0x00,0x1c,0x1c,
1110x31,0x01,0x86,0x03,0x00,0x30,0x30,0x00,0x1c,0x3e,0x1b,0x03,0xc1,0xf0,0xf0,0x60,1110x18,0x24,0x1c,0x3c,0x48,0x48,0x20,0x30,0x40,0x40,0x08,0x08,0x10,0x1c,0x1c,0x1c,
1120x3e,0x6e,0x3e,0x0f,0x8c,0x60,0xc5,0xb1,0xb8,0x38,0x6c,0x0f,0x8c,0xc7,0xc1,0x83,1120x1c,0x0c,0x44,0x1c,0x0c,0x80,0x24,0x1c,0x40,0x48,0x50,0x48,0x00,0x18,0x00,0x6c,
1130x19,0x8d,0x82,0x63,0x31,0x9f,0xc1,0x80,0xc0,0xc0,0x00,0xaa,0x86,0xc0,0x47,0xe3,1130x7c,0x0c,0x76,0x00,0x30,0x0c,0x3c,0x18,0x00,0x00,0x00,0x0c,0xd6,0x18,0x18,0x3c,
1140xf1,0xf8,0xfd,0xbf,0x83,0x8f,0xc3,0xef,0xf6,0xf8,0xfc,0xff,0x3f,0x9f,0x1f,0x8f,1140xcc,0xfc,0xfc,0x0c,0x7c,0x7e,0x00,0x00,0x30,0x00,0x0c,0x18,0xde,0xc6,0x7c,0xc0,
1150xc7,0xe3,0xf1,0xfb,0x7c,0x7e,0x3f,0x8f,0x8f,0xc7,0xe3,0xf8,0xfd,0x3e,0x3f,0x6f,1150x66,0x78,0x78,0xc0,0xfe,0x18,0x0c,0x78,0x60,0xd6,0xde,0xc6,0x7c,0xc6,0x7c,0x38,
1160x00,0x0c,0x0d,0x43,0x03,0xe1,0x88,0x30,0xc0,0x00,0x27,0x41,0x80,0x00,0x00,0x01,1160x18,0xc6,0xc6,0xd6,0x38,0x3c,0x18,0x30,0x70,0x0c,0x00,0x00,0x00,0x0c,0x6c,0xc6,
1170x72,0x00,0x22,0x04,0x01,0x80,0xc0,0x03,0x18,0xf4,0x00,0x00,0x0c,0x18,0xc0,0x04,1170x6c,0xc6,0xf0,0xcc,0x76,0x18,0x06,0x6c,0x18,0xfe,0x66,0xc6,0x66,0xcc,0x76,0xc6,
1180x82,0x43,0x20,0x18,0x2c,0x16,0x0b,0x05,0x82,0xc1,0x60,0xb0,0xc0,0x30,0x18,0x0c,1180x30,0xcc,0x66,0xc6,0x6c,0xc6,0xcc,0x70,0x00,0x0e,0x00,0x6c,0x00,0x00,0x00,0x00,
1190x06,0x01,0x80,0xc0,0x60,0x30,0x63,0x38,0xb0,0xd8,0x6c,0x36,0x1b,0x0c,0x00,0xc7,1190x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
1200x31,0x98,0xcc,0x66,0x33,0x11,0xf8,0xc8,0x7c,0x3e,0x1f,0x0f,0x87,0xc3,0xe1,0xd8,1200x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x60,0x60,
1210x3c,0x1e,0x0f,0x07,0x83,0xc7,0xc3,0xe1,0xf0,0xf8,0x06,0x37,0x07,0x03,0x81,0xc0,1210x66,0x7e,0x00,0xc6,0x00,0xa1,0x7e,0x6c,0xfe,0x00,0xaa,0x00,0x00,0x7e,0xf8,0x70,
1220xe0,0x70,0x10,0x1d,0x31,0x98,0xcc,0x66,0x33,0x19,0xb0,0xc6,0x8f,0x7f,0x87,0x03,1220x00,0xcc,0x7b,0x00,0x00,0x78,0x7c,0x6c,0x18,0x18,0x18,0x30,0xc6,0xc6,0xc6,0xc6,
1230x81,0x80,0x90,0x30,0x6c,0x48,0x24,0x10,0x06,0x04,0x04,0x80,0x20,0x10,0x10,0x0e,1230xc6,0xc6,0xfe,0xc0,0x68,0x68,0x68,0x68,0x18,0x18,0x18,0x18,0xf6,0xfe,0xc6,0xc6,
1240x07,0x03,0x81,0xc0,0x60,0x88,0x38,0x0c,0x40,0x09,0x03,0x84,0x02,0x41,0x40,0x90,1240xc6,0xc6,0xc6,0x3c,0xd6,0xc6,0xc6,0xc6,0xc6,0x3c,0x66,0x6c,0x0c,0x0c,0x0c,0x0c,
1250x00,0x0c,0x00,0x1f,0xe7,0x41,0xd1,0xa0,0x00,0x30,0x03,0x0a,0x81,0x00,0x00,0x00,1250x0c,0x0c,0x76,0xc6,0xc6,0xc6,0xc6,0xc6,0x18,0x18,0x18,0x18,0x7e,0x66,0xc6,0xc6,
1260x00,0x18,0x63,0x06,0x00,0xc0,0xc2,0x62,0x01,0xb0,0x0c,0x72,0x31,0x86,0x03,0x00,1260xc6,0xc6,0xc6,0x00,0xc4,0xcc,0xcc,0xcc,0xcc,0xc6,0x66,0xc6,0x80,0x00,0x08,0x08,
1270xc0,0x00,0x60,0x06,0x8f,0x16,0x19,0x0c,0x06,0x33,0x01,0x80,0xc0,0x63,0x0c,0x01,1270x24,0x34,0x24,0x3c,0x70,0x48,0x38,0x30,0x40,0x38,0x70,0x70,0x10,0x24,0x24,0x24,
1280x8d,0x06,0x07,0x39,0x65,0x86,0x63,0x61,0x99,0x0e,0x01,0x83,0x19,0x89,0xb6,0x32,1280x24,0x12,0x28,0x08,0x12,0xe0,0x24,0x20,0x40,0x38,0x48,0x30,0x00,0x18,0x00,0x6c,
1290x33,0x03,0x06,0x01,0x80,0x30,0x78,0x00,0x00,0x03,0x1d,0x86,0x23,0x31,0x99,0xfc,1290x06,0x18,0xdc,0x00,0x30,0x0c,0xff,0x7e,0x00,0xfe,0x00,0x18,0xd6,0x18,0x30,0x06,
1300x66,0x77,0x06,0x01,0x8c,0x40,0xc6,0xd9,0xdc,0x6c,0x76,0x19,0x8d,0xcc,0x27,0xf3,1300xfe,0x06,0xc6,0x18,0xc6,0x06,0x00,0x00,0x60,0x00,0x06,0x18,0xde,0xfe,0x66,0xc0,
1310x19,0x8d,0x82,0x63,0x31,0x80,0xc0,0x80,0xc0,0x80,0x01,0x54,0x8c,0xc0,0x78,0xfc,1310x66,0x68,0x68,0xde,0xc6,0x18,0x0c,0x78,0x60,0xc6,0xce,0xc6,0x60,0xc6,0x6c,0x0c,
1320x7e,0x7f,0x6f,0xcf,0x93,0xb7,0xdb,0xef,0xf9,0xfb,0xff,0xff,0xdf,0xef,0xef,0xf1,1320x18,0xc6,0xc6,0xd6,0x38,0x18,0x30,0x30,0x38,0x0c,0x00,0x00,0x00,0x7c,0x66,0xc0,
1330xf8,0xfc,0x7e,0x3f,0x9f,0x77,0xc7,0xf3,0xbf,0xf6,0xfc,0x7b,0xfd,0xbe,0xbf,0x6f,1330xcc,0xfe,0x60,0xcc,0x66,0x18,0x06,0x78,0x18,0xd6,0x66,0xc6,0x66,0xcc,0x66,0x60,
1340xff,0x0c,0x19,0x03,0x03,0x61,0x98,0x30,0x78,0x00,0x28,0x4f,0x83,0x30,0x00,0x01,1340x30,0xcc,0x66,0xd6,0x38,0xc6,0x18,0x18,0x18,0x18,0x00,0xc6,0x00,0x00,0x00,0x00,
1350x4a,0x00,0x1c,0x04,0x03,0x03,0x80,0x03,0x18,0xf4,0x00,0x00,0x0c,0x18,0xd9,0x84,1350x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
1360x82,0x40,0xa0,0x18,0x2c,0x16,0x0b,0x05,0x82,0xc1,0x60,0xb0,0xc0,0x30,0x18,0x0c,1360x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x60,0x60,
1370x06,0x01,0x80,0xc0,0x60,0x30,0x63,0x2c,0xb0,0xd8,0x6c,0x36,0x1b,0x0c,0x64,0xcb,1370x66,0x18,0x18,0xc6,0x00,0xa1,0x00,0xd8,0x06,0x3c,0x44,0x00,0x00,0x18,0x00,0x00,
1380x31,0x98,0xcc,0x66,0x33,0x31,0x8c,0xd8,0x06,0x03,0x01,0x80,0xc0,0x60,0x30,0x6c,1380x00,0xcc,0x1b,0x00,0x00,0x00,0x00,0x36,0x30,0x30,0x30,0x60,0xc6,0xc6,0xc6,0xc6,
1390x62,0x33,0x19,0x8c,0xc6,0x60,0xc0,0x60,0x30,0x18,0x1e,0x3b,0x8d,0x86,0xc3,0x61,1390xc6,0xc6,0xcc,0xc0,0x78,0x78,0x78,0x78,0x18,0x18,0x18,0x18,0x66,0xde,0xc6,0xc6,
1400xb0,0xd8,0x10,0x36,0x31,0x98,0xcc,0x66,0x33,0x19,0xd8,0xc6,0x0f,0x7f,0x82,0x01,1400xc6,0xc6,0xc6,0x18,0xd6,0xc6,0xc6,0xc6,0xc6,0x18,0x66,0x66,0x7c,0x7c,0x7c,0x7c,
1410x02,0x40,0xd0,0x40,0x6c,0x70,0x24,0x1c,0x06,0x04,0x03,0x01,0xc0,0xe0,0x10,0x12,1410x7c,0x7c,0x36,0xc0,0xfe,0xfe,0xfe,0xfe,0x18,0x18,0x18,0x18,0xc6,0x66,0xc6,0xc6,
1420x09,0x04,0x82,0x40,0x90,0x50,0x10,0x12,0x70,0x09,0x04,0x04,0x01,0xc1,0x20,0x60,1420xc6,0xc6,0xc6,0x7e,0xce,0xcc,0xcc,0xcc,0xcc,0xc6,0x66,0xc6,0x82,0x00,0x08,0x08,
1430x00,0x0c,0x00,0x04,0x83,0xc0,0x20,0xcc,0x00,0x30,0x03,0x02,0x01,0x00,0x00,0x00,1430x24,0x2c,0x20,0x66,0x07,0x07,0x07,0x07,0x0e,0x00,0x06,0x07,0x10,0x20,0x20,0x20,
1440x00,0x18,0x63,0x06,0x01,0x83,0x84,0x63,0xf1,0xd8,0x18,0x3c,0x31,0x86,0x03,0x01,1440x20,0x1e,0x10,0x08,0x1e,0x11,0x24,0x18,0x0e,0x07,0x07,0x07,0x00,0x18,0x00,0x6c,
1450x83,0xf8,0x30,0x1c,0x9b,0x33,0x1e,0x0c,0x06,0x33,0xe1,0x80,0xc0,0x7f,0x0c,0x01,1450x06,0x30,0xcc,0x00,0x30,0x0c,0x3c,0x18,0x00,0x00,0x00,0x30,0xc6,0x18,0x60,0x06,
1460x8f,0x06,0x07,0x79,0x65,0x86,0x66,0x61,0x9e,0x07,0x81,0x83,0x19,0x89,0xb6,0x1c,1460x0c,0x06,0xc6,0x30,0xc6,0x06,0x00,0x00,0x30,0x7e,0x0c,0x18,0xde,0xc6,0x66,0xc0,
1470x1a,0x03,0x06,0x01,0x80,0x30,0x48,0x00,0x00,0x03,0x18,0xcc,0x06,0x33,0x18,0x60,1470x66,0x60,0x60,0xc6,0xc6,0x18,0xcc,0x6c,0x60,0xc6,0xc6,0xc6,0x60,0xc6,0x66,0x06,
1480xc6,0x63,0x06,0x01,0x8c,0x80,0xc6,0xd9,0x8c,0xc6,0x63,0x31,0x8e,0x4c,0x01,0x83,1480x18,0xc6,0xc6,0xd6,0x7c,0x18,0x60,0x30,0x1c,0x0c,0x00,0x00,0x00,0xcc,0x66,0xc0,
1490x19,0x8d,0x92,0x32,0x31,0x81,0x87,0x00,0xc0,0x70,0xe4,0xaa,0x98,0xc0,0x7d,0xfe,1490xcc,0xc0,0x60,0xcc,0x66,0x18,0x06,0x78,0x18,0xd6,0x66,0xc6,0x66,0xcc,0x60,0x38,
1500xfd,0xbf,0x2f,0xbf,0x93,0x8f,0xdb,0xe3,0xf9,0xfb,0xff,0x1e,0x3f,0x1f,0xef,0xed,1500x30,0xcc,0x66,0xd6,0x38,0xc6,0x30,0x18,0x18,0x18,0x00,0xc6,0x00,0x00,0x00,0x00,
1510xf6,0xfb,0x7d,0xbf,0x6f,0xaf,0xef,0xed,0x8f,0xf6,0xfb,0xfb,0xfe,0x3e,0xdf,0x9f,1510x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
1520x00,0x00,0x19,0x0f,0xc6,0x30,0xd0,0x00,0xcc,0x00,0x28,0x59,0x86,0x67,0xf0,0x01,1520x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3c,0x66,0x60,
1530x72,0x00,0x00,0x3f,0x86,0x00,0xc0,0x03,0x18,0xf4,0x00,0x00,0x0c,0x18,0xcc,0xc5,1530x66,0x7e,0x18,0x6c,0x00,0xa5,0x00,0x6c,0x06,0x00,0x38,0x00,0x00,0x18,0x00,0x00,
1540x32,0x83,0x4c,0x00,0x66,0x33,0x19,0x8c,0xc6,0x63,0x31,0xbc,0xc0,0x3e,0x1f,0x0f,1540x00,0xcc,0x1b,0x18,0x00,0x00,0x00,0x6c,0x66,0x60,0x66,0xc0,0xfe,0xfe,0xfe,0xfe,
1550x87,0xc1,0x80,0xc0,0x60,0x30,0xfb,0x2c,0xb0,0xd8,0x6c,0x36,0x1b,0x0c,0x38,0xcb,1550xfe,0xfe,0xcc,0xc0,0x68,0x68,0x68,0x68,0x18,0x18,0x18,0x18,0x66,0xce,0xc6,0xc6,
1560x31,0x98,0xcc,0x66,0x31,0xa1,0x8c,0xcc,0x06,0x03,0x01,0x80,0xc0,0x60,0x30,0x6c,1560xc6,0xc6,0xc6,0x3c,0xe6,0xc6,0xc6,0xc6,0xc6,0x18,0x66,0x66,0xcc,0xcc,0xcc,0xcc,
1570xc0,0x63,0x31,0x98,0xcc,0x60,0xc0,0x60,0x30,0x18,0x37,0x31,0x98,0xcc,0x66,0x33,1570xcc,0xcc,0x7e,0xc0,0xc0,0xc0,0xc0,0xc0,0x18,0x18,0x18,0x18,0xc6,0x66,0xc6,0xc6,
1580x19,0x8c,0x00,0x67,0x31,0x98,0xcc,0x66,0x33,0x19,0x8c,0xc6,0x1f,0x7f,0x82,0x01,1580xc6,0xc6,0xc6,0x00,0xd6,0xcc,0xcc,0xcc,0xcc,0xc6,0x66,0xc6,0x02,0x00,0x08,0x08,
1590x02,0x40,0xb0,0x40,0x6c,0x07,0x03,0x83,0x80,0xe0,0xe0,0x00,0x18,0x0e,0x10,0x10,1590x24,0x24,0x20,0xc3,0x08,0x02,0x04,0x02,0x08,0x0e,0x09,0x02,0x10,0x20,0x20,0x20,
1600x08,0x04,0x02,0x00,0xf0,0x20,0x10,0x1e,0x08,0x89,0x03,0x00,0xe0,0x38,0x1c,0x0e,1600x20,0x12,0x10,0x08,0x12,0x1b,0x24,0x04,0x10,0x08,0x08,0x08,0x00,0x00,0x00,0xfe,
1610x00,0x0c,0x00,0x04,0x81,0xe0,0x41,0x6c,0x00,0x30,0x03,0x00,0x0f,0xe0,0x03,0xf8,1610x86,0x60,0xcc,0x00,0x30,0x0c,0x66,0x18,0x18,0x00,0x00,0x60,0xc6,0x18,0xc0,0x06,
1620x00,0x30,0x63,0x06,0x03,0x00,0xc7,0xf0,0x39,0x8c,0x30,0x3e,0x1b,0x80,0x00,0x03,1620x0c,0x06,0xc6,0x30,0xc6,0x06,0x18,0x18,0x18,0x00,0x18,0x00,0xdc,0xc6,0x66,0xc2,
1630x00,0x00,0x18,0x30,0x9b,0x23,0x19,0x0c,0x06,0x33,0x01,0xf8,0xc6,0x63,0x0c,0x01,1630x66,0x62,0x60,0xc6,0xc6,0x18,0xcc,0x66,0x62,0xc6,0xc6,0xc6,0x60,0xd6,0x66,0xc6,
1640x8d,0x86,0x05,0xd9,0x35,0x86,0x7c,0x61,0x9b,0x01,0xc1,0x83,0x19,0x99,0xb4,0x1c,1640x18,0xc6,0x6c,0xfe,0x6c,0x18,0xc2,0x30,0x0e,0x0c,0x00,0x00,0x00,0xcc,0x66,0xc0,
1650x0c,0x06,0x06,0x00,0xc0,0x30,0xcc,0x00,0x00,0x3f,0x18,0xcc,0x06,0x33,0xf8,0x60,1650xcc,0xc0,0x60,0xcc,0x66,0x18,0x06,0x6c,0x18,0xd6,0x66,0xc6,0x66,0xcc,0x60,0x0c,
1660xc6,0x63,0x06,0x01,0x8f,0x00,0xc6,0xd9,0x8c,0xc6,0x63,0x31,0x8c,0x0f,0x81,0x83,1660x30,0xcc,0x66,0xd6,0x38,0xc6,0x60,0x18,0x18,0x18,0x00,0xc6,0x00,0x00,0x00,0x00,
1670x18,0xd9,0xba,0x1c,0x1b,0x03,0x00,0x80,0xc0,0x81,0x75,0x54,0x98,0xc0,0x7d,0xfe,1670x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
1680xfd,0xbf,0x4f,0xbf,0x93,0xf8,0xfc,0x7c,0x7f,0x1f,0x1f,0x6f,0xe7,0xf1,0xef,0xef,1680x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3c,0x3c,0x60,
1690xf7,0xfb,0xfd,0xff,0x0f,0xdf,0xef,0xe1,0xf7,0x76,0xfc,0xff,0x1f,0xc7,0xe3,0xf1,1690x3c,0x18,0x18,0x38,0x00,0x99,0x00,0x36,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
1700xff,0x08,0x19,0x03,0x06,0x31,0xf8,0x00,0xc6,0x00,0x28,0x5b,0x8c,0xc0,0x11,0xf1,1700x00,0xcc,0x1b,0x00,0x00,0x00,0x00,0xd8,0xce,0xdc,0xce,0xc6,0xc6,0xc6,0xc6,0xc6,
1710x4a,0x00,0x00,0x04,0x0c,0x00,0xc0,0x03,0x18,0x74,0x38,0x00,0x0c,0x18,0xc6,0x65,1710xc6,0xc6,0xcc,0xc2,0x62,0x62,0x62,0x62,0x18,0x18,0x18,0x18,0x66,0xc6,0xc6,0xc6,
1720x52,0xb8,0x54,0x18,0x46,0x23,0x11,0x88,0xc4,0x62,0x31,0x30,0xc0,0x30,0x18,0x0c,1720xc6,0xc6,0xc6,0x66,0xe6,0xc6,0xc6,0xc6,0xc6,0x18,0x7c,0x66,0xcc,0xcc,0xcc,0xcc,
1730x06,0x01,0x80,0xc0,0x60,0x30,0x63,0x26,0xb0,0xd8,0x6c,0x36,0x1b,0x0c,0x10,0xd3,1730xcc,0xcc,0xd8,0xc0,0xc0,0xc0,0xc0,0xc0,0x18,0x18,0x18,0x18,0xc6,0x66,0xc6,0xc6,
1740x31,0x98,0xcc,0x66,0x30,0xc1,0x8c,0xc6,0x7e,0x3f,0x1f,0x8f,0xc7,0xe3,0xf1,0xfc,1740xc6,0xc6,0xc6,0x18,0xe6,0xcc,0xcc,0xcc,0xcc,0xc6,0x66,0xc6,0x80,0x00,0x08,0x08,
1750xc0,0x7f,0x3f,0x9f,0xcf,0xe0,0xc0,0x60,0x30,0x18,0x63,0x31,0x98,0xcc,0x66,0x33,1750x18,0x24,0x1c,0xff,0x06,0x02,0x07,0x02,0x0e,0x09,0x09,0x02,0x1c,0x1c,0x1c,0x1c,
1760x19,0x8c,0xfe,0x6b,0x31,0x98,0xcc,0x66,0x31,0xb1,0x8c,0x6c,0x0e,0x7f,0x82,0x01,1760x1c,0x12,0x10,0x08,0x12,0x15,0x18,0x38,0x0c,0x06,0x06,0x06,0x00,0x18,0x00,0x6c,
1770x01,0x80,0x90,0x30,0xc6,0x08,0x01,0x02,0x00,0x40,0x80,0xe0,0x24,0x04,0x1c,0x10,1770xc6,0xc6,0xcc,0x00,0x18,0x18,0x00,0x00,0x18,0x00,0x18,0xc0,0x6c,0x18,0xc6,0xc6,
1780x08,0x04,0x02,0x00,0x90,0x20,0x10,0x12,0x0d,0x86,0x00,0x81,0x00,0x40,0x20,0x10,1780x0c,0xc6,0xc6,0x30,0xc6,0x0c,0x18,0x18,0x0c,0x00,0x30,0x18,0xc0,0xc6,0x66,0x66,
1790x00,0x04,0x00,0x1f,0xe1,0x70,0xbb,0x28,0x00,0x30,0x03,0x00,0x01,0x00,0x00,0x00,1790x6c,0x66,0x60,0x66,0xc6,0x18,0xcc,0x66,0x66,0xc6,0xc6,0xc6,0x60,0xde,0x66,0xc6,
1800x00,0x30,0x63,0x06,0x06,0x00,0x67,0xf0,0x19,0x8c,0x30,0x67,0x0d,0x80,0x00,0x01,1800x18,0xc6,0x38,0xee,0xc6,0x18,0xc6,0x30,0x06,0x0c,0x00,0x00,0x00,0xcc,0x66,0xc6,
1810x83,0xf8,0x30,0x30,0x9b,0x7f,0x19,0x8c,0x06,0x33,0x01,0x80,0xc6,0x63,0x0c,0x01,1810xcc,0xc6,0x60,0xcc,0x66,0x18,0x06,0x66,0x18,0xd6,0x66,0xc6,0x66,0xcc,0x60,0xc6,
1820x8c,0xc6,0x05,0xd9,0x35,0x86,0x60,0x61,0x99,0x80,0xe1,0x83,0x18,0xd0,0xdc,0x26,1820x36,0xcc,0x3c,0xfe,0x6c,0xc6,0xc6,0x18,0x18,0x18,0x00,0xfe,0x00,0x00,0x00,0x00,
1830x0c,0x0c,0x06,0x00,0xc0,0x30,0x84,0x00,0x00,0x63,0x18,0xcc,0x06,0x33,0x00,0x60,1830x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
1840xc6,0x63,0x06,0x01,0x8d,0x80,0xc6,0xd9,0x8c,0xc6,0x63,0x31,0x8c,0x03,0xe1,0x83,1840x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3c,0x18,0xe6,
1850x18,0xd9,0xba,0x1c,0x1b,0x06,0x01,0x80,0xc0,0xc1,0x38,0xaa,0x80,0xc0,0x7d,0xfe,1850x66,0x18,0x18,0x0c,0x00,0x42,0x00,0x00,0x06,0x00,0x00,0x00,0x00,0x7e,0x00,0x00,
1860xfe,0x7f,0x6f,0xcf,0x39,0xf7,0xfe,0xfd,0xff,0xbf,0x7f,0x0f,0xdb,0xfb,0xe3,0xef,1860x00,0xcc,0x1b,0x00,0x00,0x00,0x00,0x00,0x9e,0x86,0x9e,0xc6,0xc6,0xc6,0xc6,0xc6,
1870xf7,0xfb,0xfd,0xff,0x6f,0xdf,0xef,0xed,0xf2,0x79,0xff,0x7e,0xff,0xbf,0xdf,0xef,1870xc6,0xc6,0xcc,0x66,0x66,0x66,0x66,0x66,0x18,0x18,0x18,0x18,0x6c,0xc6,0xc6,0xc6,
1880x00,0x0c,0x19,0x03,0x03,0x60,0x60,0x30,0x66,0x00,0x28,0x4d,0xc6,0x60,0x10,0x00,1880xc6,0xc6,0xc6,0x00,0x46,0xc6,0xc6,0xc6,0xc6,0x18,0x60,0x66,0xcc,0xcc,0xcc,0xcc,
1890x84,0x00,0x00,0x04,0x0f,0x87,0x80,0x03,0x18,0x14,0x38,0x00,0x3f,0x0f,0x8c,0xc2,1890xcc,0xcc,0xd8,0xc6,0xc6,0xc6,0xc6,0xc6,0x18,0x18,0x18,0x18,0xc6,0x66,0xc6,0xc6,
1900x90,0x84,0xa4,0x18,0xfe,0x7f,0x3f,0x9f,0xcf,0xe7,0xf1,0xf0,0xc0,0x30,0x18,0x0c,1900xc6,0xc6,0xc6,0x18,0x46,0xcc,0xcc,0xcc,0xcc,0xc6,0x66,0xc6,0xb6,0x00,0x05,0x05,
1910x06,0x01,0x80,0xc0,0x60,0x30,0x63,0x26,0xb0,0xd8,0x6c,0x36,0x1b,0x0c,0x38,0xd3,1910x07,0x0c,0x09,0x18,0x01,0x02,0x04,0x02,0x08,0x0e,0x09,0x02,0x07,0x02,0x06,0x06,
1920x31,0x98,0xcc,0x66,0x30,0xc1,0x98,0xc6,0xc6,0x63,0x31,0x98,0xcc,0x66,0x33,0x60,1920x02,0x09,0x09,0x0e,0x09,0x15,0x0e,0x07,0x02,0x01,0x01,0x01,0x00,0x18,0x00,0x6c,
1930xc0,0x60,0x30,0x18,0x0c,0x00,0xc0,0x60,0x30,0x18,0x63,0x31,0x98,0xcc,0x66,0x33,1930x7c,0x86,0x76,0x00,0x0c,0x30,0x00,0x00,0x18,0x00,0x18,0x80,0x38,0x7e,0xfe,0x7c,
1940x19,0x8c,0x00,0x6b,0x31,0x98,0xcc,0x66,0x31,0xb1,0x8c,0x6c,0x1c,0x7f,0x81,0x20,1940x1e,0x7c,0x7c,0x30,0x7c,0x78,0x00,0x30,0x06,0x00,0x60,0x18,0x7c,0xc6,0xfc,0x3c,
1950x90,0x38,0x18,0x0b,0x83,0x06,0x01,0x03,0x80,0x40,0xe0,0x90,0x24,0x04,0x03,0x8e,1950xf8,0xfe,0xf0,0x3a,0xc6,0x3c,0x78,0xe6,0xfe,0xc6,0xc6,0x7c,0xf0,0x7c,0xe6,0x7c,
1960x86,0xc3,0x61,0x90,0x24,0x12,0x0e,0x04,0x8a,0x81,0xc7,0x70,0xc0,0x30,0x18,0x0c,1960x3c,0x7c,0x10,0x6c,0xc6,0x3c,0xfe,0x3c,0x02,0x3c,0x00,0x00,0x00,0x76,0x7c,0x7c,
1970x00,0x00,0x00,0x04,0x81,0x31,0x6f,0x30,0x00,0x18,0x06,0x00,0x01,0x00,0x00,0x00,1970x76,0x7c,0xf0,0x7c,0xe6,0x3c,0x06,0xe6,0x3c,0xc6,0x66,0x7c,0x7c,0x7c,0xf0,0x7c,
1980x00,0x60,0x63,0x06,0x0c,0x00,0x60,0x60,0x19,0x8c,0x60,0x63,0x01,0x80,0x00,0x00,1980x1c,0x76,0x18,0x6c,0xc6,0x7e,0xfe,0x0e,0x18,0x70,0x00,0x00,0x00,0x00,0x00,0x00,
1990xc0,0x00,0x60,0x00,0x4d,0xe1,0x99,0x8c,0x06,0x33,0x01,0x80,0xc6,0x63,0x0c,0x01,1990x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
2000x8c,0xc6,0x04,0x99,0x1d,0x86,0x60,0x61,0x99,0x80,0x61,0x83,0x18,0xd0,0xdc,0x63,2000x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x18,0xfc,
2010x0c,0x0c,0x06,0x00,0x60,0x30,0x84,0x00,0x00,0x63,0x18,0xcc,0x06,0x33,0x00,0x60,2010x00,0x18,0x18,0xc6,0x00,0x3c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
2020x6e,0x63,0x06,0x01,0x8c,0xc0,0xc6,0xd9,0x8c,0xc6,0x63,0x31,0x8c,0x00,0x61,0x83,2020x00,0xf6,0x1b,0x00,0x00,0x00,0x00,0x00,0x3e,0x0c,0x3e,0x7c,0xc6,0xc6,0xc6,0xc6,
2030x18,0xd0,0xcc,0x26,0x0e,0x0c,0x03,0x00,0xc0,0x60,0x01,0x54,0x98,0xc0,0x7e,0xdf,2030xc6,0xc6,0xce,0x3c,0xfe,0xfe,0xfe,0xfe,0x3c,0x3c,0x3c,0x3c,0xf8,0xc6,0x7c,0x7c,
2040x6f,0xc7,0xe7,0xf4,0x7c,0xf9,0xfe,0xfc,0x7f,0xbf,0x1f,0x5f,0xdb,0xfb,0xfc,0x71,2040x7c,0x7c,0x7c,0x00,0xbc,0x7c,0x7c,0x7c,0x7c,0x3c,0xf0,0xec,0x76,0x76,0x76,0x76,
2050x79,0x3c,0x9e,0x6f,0xdb,0xed,0xf1,0xfb,0x75,0x7e,0x38,0x8f,0x3f,0xcf,0xe7,0xf3,2050x76,0x76,0x6e,0x7c,0x7c,0x7c,0x7c,0x7c,0x3c,0x3c,0x3c,0x3c,0x7c,0x66,0x7c,0x7c,
2060xff,0x0c,0x0d,0x03,0x03,0xe1,0xf8,0x30,0x3c,0x00,0x27,0x40,0x03,0x30,0x00,0x00,2060x7c,0x7c,0x7c,0x00,0xbc,0x76,0x76,0x76,0x76,0x7e,0x7c,0x7e,0x00,0x00,0x05,0x05,
2070x78,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x18,0x14,0x00,0x00,0x00,0x00,0x19,0x82,2070x02,0x12,0x0a,0x00,0x0e,0x02,0x04,0x02,0x08,0x0a,0x06,0x07,0x04,0x06,0x09,0x01,
2080xf8,0x98,0xbe,0x70,0xc3,0x61,0xb0,0xd8,0x6c,0x36,0x1b,0x30,0xc0,0x30,0x18,0x0c,2080x06,0x0a,0x0d,0x09,0x0d,0x11,0x09,0x09,0x1c,0x0e,0x0e,0x0e,0x00,0x00,0x00,0x00,
2090x06,0x01,0x80,0xc0,0x60,0x30,0x63,0x23,0xb0,0xd8,0x6c,0x36,0x1b,0x0c,0x4c,0xe3,2090x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
2100x31,0x98,0xcc,0x66,0x30,0xc1,0xf0,0xc6,0xc6,0x63,0x31,0x98,0xcc,0x66,0x33,0x60,2100x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
2110xc0,0x60,0x30,0x18,0x0c,0x00,0xc0,0x60,0x30,0x18,0x63,0x31,0x98,0xcc,0x66,0x33,2110x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0c,0x00,0x00,
2120x19,0x8c,0x10,0x73,0x31,0x98,0xcc,0x66,0x30,0xe1,0x8c,0x38,0x1c,0x7f,0x80,0xa0,2120x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
2130x50,0x10,0x24,0x0d,0xff,0x01,0x01,0x02,0x00,0x40,0x80,0xf0,0x24,0x04,0x02,0x01,2130x00,0x00,0x00,0x0c,0x00,0x00,0x66,0x00,0x00,0x00,0x00,0x00,0x60,0x0c,0x00,0x00,
2140x81,0x20,0x10,0x30,0x28,0x1a,0x09,0x06,0x8a,0x81,0x20,0x90,0x20,0x08,0x04,0x02,2140x00,0x00,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
2150x00,0x0c,0x00,0x04,0x85,0x32,0x6f,0xb8,0x00,0x18,0x06,0x00,0x01,0x01,0xc0,0x00,2150x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
2160x70,0x60,0x36,0x06,0x1f,0xcc,0xe0,0x63,0x30,0xd8,0x60,0x63,0x33,0x06,0x03,0x00,2160x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
2170x60,0x00,0xc0,0x30,0x60,0x61,0x99,0x86,0x66,0x63,0x01,0x80,0x66,0x63,0x0c,0x03,2170x00,0x00,0x00,0x7c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
2180x0c,0x66,0x04,0x19,0x1c,0xcc,0x60,0x33,0x18,0xcc,0x61,0x81,0xb0,0x60,0xcc,0x63,2180x00,0xc0,0x00,0x00,0x18,0x00,0x00,0x00,0x06,0x18,0x06,0x00,0x00,0x00,0x00,0x00,
2190x0c,0x18,0x06,0x00,0x60,0x30,0x00,0x00,0x00,0x67,0x19,0x86,0x23,0x71,0x88,0x60,2190x00,0x00,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
2200x36,0x63,0x06,0x01,0x8c,0x60,0xc6,0xd9,0x8c,0x6c,0x66,0x1b,0x8c,0x08,0x61,0x83,2200x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
2210xb8,0x70,0xcc,0x63,0x0c,0x18,0x03,0x00,0xc0,0x60,0x00,0xaa,0x98,0xc0,0x7f,0x5f,2210x00,0x00,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
2220xaf,0xef,0xdb,0xf2,0x00,0xfe,0xfe,0xfd,0xff,0xbf,0x7f,0x6f,0xdb,0xfb,0xfd,0xfe,2220x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x60,0x06,0x00,0x00,0x02,0x02,
2230x7e,0xdf,0xef,0xcf,0xd7,0xe5,0xf6,0xf9,0x75,0x7e,0xdf,0x6f,0xdf,0xf7,0xfb,0xfd,2230x02,0x12,0x0c,0x00,0x00,0x00,0x00,0x00,0x00,0x09,0x00,0x00,0x07,0x02,0x02,0x06,
2240x00,0x0c,0x07,0xc6,0x04,0x10,0x60,0x30,0x06,0x00,0x10,0x80,0x00,0x00,0x00,0x00,2240x0a,0x0c,0x0b,0x0e,0x0b,0x00,0x0e,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
2250x00,0x00,0x00,0x3f,0x80,0x00,0x00,0x03,0xb8,0x14,0x00,0x00,0x00,0x00,0x00,0x04,2250x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
2260x11,0x21,0x04,0xc0,0xc3,0x61,0xb0,0xd8,0x6c,0x36,0x1b,0x30,0x66,0x30,0x18,0x0c,2260x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
2270x06,0x01,0x80,0xc0,0x60,0x30,0x66,0x23,0x99,0x8c,0xc6,0x63,0x31,0x98,0x00,0x66,2270x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0e,0x00,0x00,
2280x1b,0x0d,0x86,0xc3,0x60,0xc1,0x80,0xc6,0xce,0x67,0x33,0x99,0xcc,0xe6,0x73,0x74,2280x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0x00,0x00,0x00,0x00,
2290x62,0x31,0x18,0x8c,0x46,0x20,0xc0,0x60,0x30,0x18,0x36,0x31,0x8d,0x86,0xc3,0x61,2290x00,0x00,0x00,0xcc,0x00,0x00,0x66,0x00,0x00,0x00,0x00,0x00,0x60,0x0c,0x00,0x00,
2300xb0,0xd8,0x10,0x36,0x3b,0x9d,0xce,0xe7,0x70,0xc1,0x98,0x30,0x00,0x7f,0x80,0xc0,2300x00,0x00,0x00,0x00,0x00,0x0c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
2310x60,0x10,0x24,0x0c,0x38,0x0e,0x01,0x02,0x00,0x40,0x80,0xa0,0x18,0x0e,0x03,0x00,2310x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
2320x80,0x40,0x60,0x50,0x30,0x16,0x0e,0x05,0x88,0x81,0xc0,0x81,0xc0,0x70,0x38,0x1c,2320x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
2330x00,0x0c,0x00,0x04,0x83,0xe0,0x39,0xcc,0x00,0x0c,0x0c,0x00,0x00,0x01,0xc0,0x00,2330x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
2340x70,0xc0,0x1c,0x06,0x1f,0xc7,0xc0,0x61,0xe0,0x70,0x60,0x3e,0x1e,0x06,0x03,0x00,2340x00,0xc0,0x00,0x00,0x0c,0x00,0x00,0x00,0x06,0x3e,0x06,0x00,0x00,0x00,0x00,0x00,
2350x00,0x00,0x00,0x30,0x1e,0x61,0x9f,0x03,0xc7,0xc3,0xf1,0x80,0x3e,0x63,0x3f,0x1e,2350x00,0x00,0x00,0x0c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
2360x0c,0x67,0xe4,0x19,0x0c,0x78,0x60,0x1e,0x18,0xc7,0xc1,0x80,0xe0,0x60,0xcc,0x63,2360x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
2370x0c,0x1f,0xc6,0x00,0x30,0x30,0x00,0x00,0x00,0x3b,0x9f,0x03,0xc1,0xb0,0xf0,0x60,2370x00,0x00,0x00,0x0c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
2380x06,0x63,0x06,0x01,0x8c,0x70,0xc6,0xd9,0x8c,0x38,0x7c,0x0d,0x8c,0x07,0xc0,0xf1,2380x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0c,0x60,0x0c,0x00,0x00,0x05,0x05,
2390xd8,0x60,0xcc,0x63,0x0c,0x1f,0xc3,0x00,0xc0,0x60,0x01,0x54,0x80,0xc0,0x7f,0x3f,2390x02,0x16,0x0a,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x02,0x04,0x01,
2400x9f,0xef,0xdb,0xf3,0xc7,0xf1,0xfe,0xfd,0xff,0xbf,0x7f,0xff,0xe7,0xf1,0xfc,0xff,2400x1f,0x0a,0x09,0x09,0x09,0x00,0x09,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
2410x7f,0xbf,0x9f,0xaf,0xcf,0xe9,0xf1,0xfa,0x77,0x7e,0x3f,0x7e,0x3f,0x8f,0xc7,0xe3,2410x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
2420xff,0x0c,0x01,0x0f,0xe8,0x08,0x60,0x30,0xc6,0x00,0x0f,0x00,0x00,0x00,0x00,0x00,2420x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
2430x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0xd8,0x14,0x00,0x00,0x00,0x00,0x00,0x04,2430x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
2440x11,0x3d,0x04,0xc0,0xc3,0x61,0xb0,0xd8,0x6c,0x36,0x1b,0x3c,0x3c,0x3f,0x1f,0x8f,2440x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
2450xc7,0xe7,0xe3,0xf1,0xf8,0xfc,0x7c,0x21,0x8f,0x07,0x83,0xc1,0xe0,0xf0,0x00,0xbc,2450x00,0x00,0x00,0x78,0x00,0x00,0x3c,0x00,0x00,0x00,0x00,0x00,0xf0,0x1e,0x00,0x00,
2460x0e,0x07,0x03,0x81,0xc0,0xc1,0x80,0xcc,0x77,0x3b,0x9d,0xce,0xe7,0x73,0xb9,0x98,2460x00,0x00,0x00,0x00,0x00,0xf8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
2470x3c,0x1e,0x0f,0x07,0x83,0xc0,0xc0,0x60,0x30,0x18,0x1c,0x31,0x87,0x03,0x81,0xc0,2470x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
2480xe0,0x70,0x00,0x5c,0x1d,0x8e,0xc7,0x63,0xb0,0xc1,0xf0,0x30,0x00,0x7f,0x81,0x40,2480x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
2490xa0,0x10,0x28,0x0a,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x90,0x00,0x00,0x02,0x00,2490x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
2500x80,0x80,0x10,0xf8,0x28,0x12,0x09,0x04,0x80,0x01,0x20,0x80,0x00,0x00,0x00,0x00,2500x00,0xc0,0x00,0x00,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
2510x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x06,0x18,0x00,0x00,0x00,0x40,0x00,2510x00,0x00,0x00,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
2520x00,0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,2520x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
2530x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,2530x00,0x00,0x00,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
2540x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,2540x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xf8,0xf0,0xf8,0x00,0x00,0x05,0x05,
2550x00,0x00,0x07,0xc0,0x31,0xf0,0x01,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,2550x02,0x0d,0x09,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x07,0x0f,0x06,
2560xcc,0x00,0x00,0x01,0x80,0x00,0x00,0x00,0x00,0x00,0x60,0x01,0x80,0x00,0x00,0x00,2560x02,0x09,0x09,0x0e,0x09,0x00,0x0e,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
2570x00,0x00,0x00,0x00,0x18,0x00,0x01,0xe0,0xc3,0xc0,0x00,0x00,0xff,0xc0,0x7e,0xbf,2570x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
2580x5f,0xef,0xd7,0xf5,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xfd,0xff,2580x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
2590x7f,0x7f,0xef,0x07,0xd7,0xed,0xf6,0xfb,0x7f,0xfe,0xdf,0x7f,0xff,0xff,0xff,0xff,2590x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
2600x00,0x0c,0x01,0x00,0x00,0x00,0x00,0x30,0x7c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,2600x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
2610x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x14,0x00,0x08,0x00,0x00,0x00,0x00,2610x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
2620x00,0x00,0x00,0xc6,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x00,0x00,2620x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
2630x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,2630x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
2640x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,2640x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
2650x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,2650x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
2660x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x81,0x80,0x60,0x00,0x7f,0x81,0x20,2660x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
2670x90,0x10,0x1c,0x0a,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x80,2670x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
2680x81,0xe0,0x60,0x10,0x24,0x12,0x0e,0x04,0x80,0x01,0xc0,0x70,0x00,0x00,0x00,0x00,2680x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
2690x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x00,2690x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
2700x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,2700x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x32,0x35,0x36,0x20,
2710x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,2710x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x31,0x36,0x20,0x20,0x20,0x20,0x20,0x20,
2720x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,2720x20,0x20,0x20,0x20,0x38,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
2730x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,2730x00,0x00,0x00,0x0f,0x00,0x08,0x08,0x00,0x00,0x0f,0x00,0x08,0x10,0x00,0x00,0x0f,
2740x78,0x00,0x00,0x1f,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x01,0x80,0x00,0x00,0x00,2740x00,0x08,0x18,0x00,0x00,0x0f,0x00,0x08,0x20,0x00,0x00,0x0f,0x00,0x08,0x28,0x00,
2750x00,0x00,0x00,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7f,0xfe,0xdf,2750x00,0x0f,0x00,0x08,0x30,0x00,0x00,0x0f,0x00,0x08,0x38,0x00,0x00,0x0f,0x00,0x08,
2760x6f,0xef,0xe3,0xf5,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xfc,0x7f,2760x40,0x00,0x00,0x0f,0x00,0x08,0x48,0x00,0x00,0x0f,0x00,0x08,0x50,0x00,0x00,0x0f,
2770x7e,0x1f,0x9f,0xef,0xdb,0xed,0xf1,0xfb,0x7f,0xfe,0x3f,0x8f,0xff,0xff,0xff,0xff,2770x00,0x08,0x58,0x00,0x00,0x0f,0x00,0x08,0x60,0x00,0x00,0x0f,0x00,0x08,0x68,0x00,
2780x00,0x0c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,2780x00,0x0f,0x00,0x08,0x70,0x00,0x00,0x0f,0x00,0x08,0x78,0x00,0x00,0x0f,0x00,0x08,
2790x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x30,0x00,0x00,0x00,0x00,2790x80,0x00,0x00,0x0f,0x00,0x08,0x88,0x00,0x00,0x0f,0x00,0x08,0x90,0x00,0x00,0x0f,
2800x00,0x00,0x00,0x7c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x00,0x00,0x00,2800x00,0x08,0x98,0x00,0x00,0x0f,0x00,0x08,0xa0,0x00,0x00,0x0f,0x00,0x08,0xa8,0x00,
2810x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,2810x00,0x0f,0x00,0x08,0xb0,0x00,0x00,0x0f,0x00,0x08,0xb8,0x00,0x00,0x0f,0x00,0x08,
2820x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,2820xc0,0x00,0x00,0x0f,0x00,0x08,0xc8,0x00,0x00,0x0f,0x00,0x08,0xd0,0x00,0x00,0x0f,
2830x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,2830x00,0x08,0xd8,0x00,0x00,0x0f,0x00,0x08,0xe0,0x00,0x00,0x0f,0x00,0x08,0xe8,0x00,
2840x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x81,0x80,0x60,0x20,0x20,0x20,0x20,2840x00,0x0f,0x00,0x08,0xf0,0x00,0x00,0x0f,0x00,0x08,0xf8,0x00,0x00,0x0f,0x00,0x08,
2850x20,0x20,0x20,0x20,0x32,0x35,0x36,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,2850x00,0x01,0x00,0x0f,0x00,0x08,0x08,0x01,0x00,0x0f,0x00,0x08,0x10,0x01,0x00,0x0f,
2860x20,0x31,0x35,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x31,0x33,0x20,2860x00,0x08,0x18,0x01,0x00,0x0f,0x00,0x08,0x20,0x01,0x00,0x0f,0x00,0x08,0x28,0x01,
2870x00,0x00,0x01,0x0c,0x00,0x09,0x09,0x00,0x01,0x0f,0x00,0x09,0x12,0x00,0x01,0x0f,2870x00,0x0f,0x00,0x08,0x30,0x01,0x00,0x0f,0x00,0x08,0x38,0x01,0x00,0x0f,0x00,0x08,
2880x00,0x09,0x1b,0x00,0x01,0x0f,0x00,0x09,0x24,0x00,0x01,0x0f,0x00,0x09,0x2d,0x00,2880x40,0x01,0x00,0x0f,0x00,0x08,0x48,0x01,0x00,0x0f,0x00,0x08,0x50,0x01,0x00,0x0f,
2890x01,0x0f,0x00,0x09,0x36,0x00,0x01,0x0f,0x00,0x09,0x3f,0x00,0x03,0x0d,0x00,0x09,2890x00,0x08,0x58,0x01,0x00,0x0f,0x00,0x08,0x60,0x01,0x00,0x0f,0x00,0x08,0x68,0x01,
2900x48,0x00,0x03,0x0d,0x00,0x09,0x51,0x00,0x03,0x0d,0x00,0x09,0x5a,0x00,0x03,0x0d,2900x00,0x0f,0x00,0x08,0x70,0x01,0x00,0x0f,0x00,0x08,0x78,0x01,0x00,0x0f,0x00,0x08,
2910x00,0x09,0x63,0x00,0x03,0x0d,0x00,0x09,0x6c,0x00,0x03,0x0d,0x00,0x09,0x75,0x00,2910x80,0x01,0x00,0x0f,0x00,0x08,0x88,0x01,0x00,0x0f,0x00,0x08,0x90,0x01,0x00,0x0f,
2920x03,0x0e,0x00,0x09,0x7e,0x00,0x03,0x0d,0x00,0x09,0x87,0x00,0x03,0x0d,0x00,0x09,2920x00,0x08,0x98,0x01,0x00,0x0f,0x00,0x08,0xa0,0x01,0x00,0x0f,0x00,0x08,0xa8,0x01,
2930x90,0x00,0x01,0x0f,0x00,0x09,0x99,0x00,0x01,0x0f,0x00,0x09,0xa2,0x00,0x01,0x0f,2930x00,0x0f,0x00,0x08,0xb0,0x01,0x00,0x0f,0x00,0x08,0xb8,0x01,0x00,0x0f,0x00,0x08,
2940x00,0x09,0xab,0x00,0x01,0x0f,0x00,0x09,0xb4,0x00,0x01,0x0f,0x00,0x09,0xbd,0x00,2940xc0,0x01,0x00,0x0f,0x00,0x08,0xc8,0x01,0x00,0x0f,0x00,0x08,0xd0,0x01,0x00,0x0f,
2950x01,0x0f,0x00,0x09,0xc6,0x00,0x01,0x0f,0x00,0x09,0xcf,0x00,0x01,0x0f,0x00,0x09,2950x00,0x08,0xd8,0x01,0x00,0x0f,0x00,0x08,0xe0,0x01,0x00,0x0f,0x00,0x08,0xe8,0x01,
2960xd8,0x00,0x01,0x0f,0x00,0x09,0xe1,0x00,0x03,0x0d,0x00,0x09,0xea,0x00,0x01,0x0f,2960x00,0x0f,0x00,0x08,0xf0,0x01,0x00,0x0f,0x00,0x08,0xf8,0x01,0x00,0x0f,0x00,0x08,
2970x00,0x09,0xf3,0x00,0x01,0x0f,0x00,0x09,0xfc,0x00,0x03,0x0d,0x00,0x09,0x05,0x01,2970x00,0x02,0x00,0x0f,0x00,0x08,0x08,0x02,0x00,0x0f,0x00,0x08,0x10,0x02,0x00,0x0f,
2980x03,0x0d,0x00,0x09,0x0e,0x01,0x03,0x0d,0x00,0x09,0x17,0x01,0x03,0x0d,0x00,0x09,2980x00,0x08,0x18,0x02,0x00,0x0f,0x00,0x08,0x20,0x02,0x00,0x0f,0x00,0x08,0x28,0x02,
2990x20,0x01,0x00,0x00,0x00,0x09,0x29,0x01,0x03,0x0d,0x00,0x09,0x32,0x01,0x02,0x05,2990x00,0x0f,0x00,0x08,0x30,0x02,0x00,0x0f,0x00,0x08,0x38,0x02,0x00,0x0f,0x00,0x08,
3000x00,0x09,0x3b,0x01,0x03,0x0d,0x00,0x09,0x44,0x01,0x02,0x0e,0x00,0x09,0x4d,0x01,3000x40,0x02,0x00,0x0f,0x00,0x08,0x48,0x02,0x00,0x0f,0x00,0x08,0x50,0x02,0x00,0x0f,
3010x03,0x0d,0x00,0x09,0x56,0x01,0x03,0x0d,0x00,0x09,0x5f,0x01,0x02,0x06,0x00,0x09,3010x00,0x08,0x58,0x02,0x00,0x0f,0x00,0x08,0x60,0x02,0x00,0x0f,0x00,0x08,0x68,0x02,
3020x68,0x01,0x02,0x0e,0x00,0x09,0x71,0x01,0x02,0x0e,0x00,0x09,0x7a,0x01,0x03,0x08,3020x00,0x0f,0x00,0x08,0x70,0x02,0x00,0x0f,0x00,0x08,0x78,0x02,0x00,0x0f,0x00,0x08,
3030x00,0x09,0x83,0x01,0x05,0x0c,0x00,0x09,0x8c,0x01,0x0b,0x0f,0x00,0x09,0x95,0x01,3030x80,0x02,0x00,0x0f,0x00,0x08,0x88,0x02,0x00,0x0f,0x00,0x08,0x90,0x02,0x00,0x0f,
3040x08,0x09,0x00,0x09,0x9e,0x01,0x0b,0x0d,0x00,0x09,0xa7,0x01,0x02,0x0e,0x00,0x09,3040x00,0x08,0x98,0x02,0x00,0x0f,0x00,0x08,0xa0,0x02,0x00,0x0f,0x00,0x08,0xa8,0x02,
3050xb0,0x01,0x03,0x0d,0x00,0x09,0xb9,0x01,0x03,0x0d,0x00,0x09,0xc2,0x01,0x03,0x0d,3050x00,0x0f,0x00,0x08,0xb0,0x02,0x00,0x0f,0x00,0x08,0xb8,0x02,0x00,0x0f,0x00,0x08,
3060x00,0x09,0xcb,0x01,0x03,0x0d,0x00,0x09,0xd4,0x01,0x03,0x0d,0x00,0x09,0xdd,0x01,3060xc0,0x02,0x00,0x0f,0x00,0x08,0xc8,0x02,0x00,0x0f,0x00,0x08,0xd0,0x02,0x00,0x0f,
3070x03,0x0d,0x00,0x09,0xe6,0x01,0x03,0x0d,0x00,0x09,0xef,0x01,0x03,0x0d,0x00,0x09,3070x00,0x08,0xd8,0x02,0x00,0x0f,0x00,0x08,0xe0,0x02,0x00,0x0f,0x00,0x08,0xe8,0x02,
3080xf8,0x01,0x03,0x0d,0x00,0x09,0x01,0x02,0x03,0x0d,0x00,0x09,0x0a,0x02,0x06,0x0d,3080x00,0x0f,0x00,0x08,0xf0,0x02,0x00,0x0f,0x00,0x08,0xf8,0x02,0x00,0x0f,0x00,0x08,
3090x00,0x09,0x13,0x02,0x06,0x0f,0x00,0x09,0x1c,0x02,0x05,0x0c,0x00,0x09,0x25,0x02,3090x00,0x03,0x00,0x0f,0x00,0x08,0x08,0x03,0x00,0x0f,0x00,0x08,0x10,0x03,0x00,0x0f,
3100x07,0x0a,0x00,0x09,0x2e,0x02,0x05,0x0c,0x00,0x09,0x37,0x02,0x03,0x0d,0x00,0x09,3100x00,0x08,0x18,0x03,0x00,0x0f,0x00,0x08,0x20,0x03,0x00,0x0f,0x00,0x08,0x28,0x03,
3110x40,0x02,0x03,0x0d,0x00,0x09,0x49,0x02,0x03,0x0d,0x00,0x09,0x52,0x02,0x03,0x0d,3110x00,0x0f,0x00,0x08,0x30,0x03,0x00,0x0f,0x00,0x08,0x38,0x03,0x00,0x0f,0x00,0x08,
3120x00,0x09,0x5b,0x02,0x03,0x0d,0x00,0x09,0x64,0x02,0x03,0x0d,0x00,0x09,0x6d,0x02,3120x40,0x03,0x00,0x0f,0x00,0x08,0x48,0x03,0x00,0x0f,0x00,0x08,0x50,0x03,0x00,0x0f,
3130x03,0x0d,0x00,0x09,0x76,0x02,0x03,0x0d,0x00,0x09,0x7f,0x02,0x03,0x0d,0x00,0x09,3130x00,0x08,0x58,0x03,0x00,0x0f,0x00,0x08,0x60,0x03,0x00,0x0f,0x00,0x08,0x68,0x03,
3140x88,0x02,0x03,0x0d,0x00,0x09,0x91,0x02,0x03,0x0d,0x00,0x09,0x9a,0x02,0x03,0x0d,3140x00,0x0f,0x00,0x08,0x70,0x03,0x00,0x0f,0x00,0x08,0x78,0x03,0x00,0x0f,0x00,0x08,
3150x00,0x09,0xa3,0x02,0x03,0x0d,0x00,0x09,0xac,0x02,0x03,0x0d,0x00,0x09,0xb5,0x02,3150x80,0x03,0x00,0x0f,0x00,0x08,0x88,0x03,0x00,0x0f,0x00,0x08,0x90,0x03,0x00,0x0f,
3160x03,0x0d,0x00,0x09,0xbe,0x02,0x03,0x0d,0x00,0x09,0xc7,0x02,0x03,0x0d,0x00,0x09,3160x00,0x08,0x98,0x03,0x00,0x0f,0x00,0x08,0xa0,0x03,0x00,0x0f,0x00,0x08,0xa8,0x03,
3170xd0,0x02,0x03,0x0d,0x00,0x09,0xd9,0x02,0x03,0x0f,0x00,0x09,0xe2,0x02,0x03,0x0d,3170x00,0x0f,0x00,0x08,0xb0,0x03,0x00,0x0f,0x00,0x08,0xb8,0x03,0x00,0x0f,0x00,0x08,
3180x00,0x09,0xeb,0x02,0x03,0x0d,0x00,0x09,0xf4,0x02,0x03,0x0d,0x00,0x09,0xfd,0x02,3180xc0,0x03,0x00,0x0f,0x00,0x08,0xc8,0x03,0x00,0x0f,0x00,0x08,0xd0,0x03,0x00,0x0f,
3190x03,0x0d,0x00,0x09,0x06,0x03,0x03,0x0d,0x00,0x09,0x0f,0x03,0x03,0x0d,0x00,0x09,3190x00,0x08,0xd8,0x03,0x00,0x0f,0x00,0x08,0xe0,0x03,0x00,0x0f,0x00,0x08,0xe8,0x03,
3200x18,0x03,0x03,0x0d,0x00,0x09,0x21,0x03,0x03,0x0d,0x00,0x09,0x2a,0x03,0x03,0x0d,3200x00,0x0f,0x00,0x08,0xf0,0x03,0x00,0x0f,0x00,0x08,0xf8,0x03,0x00,0x0f,0x00,0x08,
3210x00,0x09,0x33,0x03,0x02,0x0e,0x00,0x09,0x3c,0x03,0x02,0x0e,0x00,0x09,0x45,0x03,3210x00,0x04,0x00,0x0f,0x00,0x08,0x08,0x04,0x00,0x0f,0x00,0x08,0x10,0x04,0x00,0x0f,
3220x02,0x0e,0x00,0x09,0x4e,0x03,0x04,0x0b,0x00,0x09,0x57,0x03,0x0d,0x0e,0x00,0x09,3220x00,0x08,0x18,0x04,0x00,0x0f,0x00,0x08,0x20,0x04,0x00,0x0f,0x00,0x08,0x28,0x04,
3230x60,0x03,0x02,0x06,0x00,0x09,0x69,0x03,0x05,0x0d,0x00,0x09,0x72,0x03,0x02,0x0d,3230x00,0x0f,0x00,0x08,0x30,0x04,0x00,0x0f,0x00,0x08,0x38,0x04,0x00,0x0f,0x00,0x08,
3240x00,0x09,0x7b,0x03,0x05,0x0d,0x00,0x09,0x84,0x03,0x02,0x0d,0x00,0x09,0x8d,0x03,3240x40,0x04,0x00,0x0f,0x00,0x08,0x48,0x04,0x00,0x0f,0x00,0x08,0x50,0x04,0x00,0x0f,
3250x05,0x0d,0x00,0x09,0x96,0x03,0x02,0x0d,0x00,0x09,0x9f,0x03,0x05,0x0f,0x00,0x09,3250x00,0x08,0x58,0x04,0x00,0x0f,0x00,0x08,0x60,0x04,0x00,0x0f,0x00,0x08,0x68,0x04,
3260xa8,0x03,0x02,0x0d,0x00,0x09,0xb1,0x03,0x02,0x0d,0x00,0x09,0xba,0x03,0x02,0x0f,3260x00,0x0f,0x00,0x08,0x70,0x04,0x00,0x0f,0x00,0x08,0x78,0x04,0x00,0x0f,0x00,0x08,
3270x00,0x09,0xc3,0x03,0x02,0x0d,0x00,0x09,0xcc,0x03,0x02,0x0d,0x00,0x09,0xd5,0x03,3270x80,0x04,0x00,0x0f,0x00,0x08,0x88,0x04,0x00,0x0f,0x00,0x08,0x90,0x04,0x00,0x0f,
3280x05,0x0d,0x00,0x09,0xde,0x03,0x05,0x0d,0x00,0x09,0xe7,0x03,0x05,0x0d,0x00,0x09,3280x00,0x08,0x98,0x04,0x00,0x0f,0x00,0x08,0xa0,0x04,0x00,0x0f,0x00,0x08,0xa8,0x04,
3290xf0,0x03,0x05,0x0f,0x00,0x09,0xf9,0x03,0x05,0x0f,0x00,0x09,0x02,0x04,0x05,0x0d,3290x00,0x0f,0x00,0x08,0xb0,0x04,0x00,0x0f,0x00,0x08,0xb8,0x04,0x00,0x0f,0x00,0x08,
3300x00,0x09,0x0b,0x04,0x05,0x0d,0x00,0x09,0x14,0x04,0x03,0x0d,0x00,0x09,0x1d,0x04,3300xc0,0x04,0x00,0x0f,0x00,0x08,0xc8,0x04,0x00,0x0f,0x00,0x08,0xd0,0x04,0x00,0x0f,
3310x05,0x0d,0x00,0x09,0x26,0x04,0x05,0x0d,0x00,0x09,0x2f,0x04,0x05,0x0d,0x00,0x09,3310x00,0x08,0xd8,0x04,0x00,0x0f,0x00,0x08,0xe0,0x04,0x00,0x0f,0x00,0x08,0xe8,0x04,
3320x38,0x04,0x05,0x0d,0x00,0x09,0x41,0x04,0x05,0x0f,0x00,0x09,0x4a,0x04,0x05,0x0d,3320x00,0x0f,0x00,0x08,0xf0,0x04,0x00,0x0f,0x00,0x08,0xf8,0x04,0x00,0x0f,0x00,0x08,
3330x00,0x09,0x53,0x04,0x02,0x0e,0x00,0x09,0x5c,0x04,0x02,0x0e,0x00,0x09,0x65,0x04,3330x00,0x05,0x00,0x0f,0x00,0x08,0x08,0x05,0x00,0x0f,0x00,0x08,0x10,0x05,0x00,0x0f,
3340x02,0x0e,0x00,0x09,0x6e,0x04,0x07,0x0a,0x00,0x09,0x77,0x04,0x01,0x0d,0x00,0x09,3340x00,0x08,0x18,0x05,0x00,0x0f,0x00,0x08,0x20,0x05,0x00,0x0f,0x00,0x08,0x28,0x05,
3350x80,0x04,0x00,0x0e,0x00,0x09,0x89,0x04,0x00,0x0f,0x00,0x09,0x92,0x04,0x00,0x0f,3350x00,0x0f,0x00,0x08,0x30,0x05,0x00,0x0f,0x00,0x08,0x38,0x05,0x00,0x0f,0x00,0x08,
3360x00,0x09,0x9b,0x04,0x00,0x0f,0x00,0x09,0xa4,0x04,0x00,0x0f,0x00,0x09,0xad,0x04,3360x40,0x05,0x00,0x0f,0x00,0x08,0x48,0x05,0x00,0x0f,0x00,0x08,0x50,0x05,0x00,0x0f,
3370x00,0x0f,0x00,0x09,0xb6,0x04,0x00,0x0f,0x00,0x09,0xbf,0x04,0x00,0x0f,0x00,0x09,3370x00,0x08,0x58,0x05,0x00,0x0f,0x00,0x08,0x60,0x05,0x00,0x0f,0x00,0x08,0x68,0x05,
3380xc8,0x04,0x00,0x0f,0x00,0x09,0xd1,0x04,0x00,0x0f,0x00,0x09,0xda,0x04,0x00,0x0f,3380x00,0x0f,0x00,0x08,0x70,0x05,0x00,0x0f,0x00,0x08,0x78,0x05,0x00,0x0f,0x00,0x08,
3390x00,0x09,0xe3,0x04,0x00,0x0f,0x00,0x09,0xec,0x04,0x00,0x0f,0x00,0x09,0xf5,0x04,3390x80,0x05,0x00,0x0f,0x00,0x08,0x88,0x05,0x00,0x0f,0x00,0x08,0x90,0x05,0x00,0x0f,
3400x00,0x0f,0x00,0x09,0xfe,0x04,0x00,0x0f,0x00,0x09,0x07,0x05,0x00,0x0f,0x00,0x09,3400x00,0x08,0x98,0x05,0x00,0x0f,0x00,0x08,0xa0,0x05,0x00,0x0f,0x00,0x08,0xa8,0x05,
3410x10,0x05,0x00,0x0f,0x00,0x09,0x19,0x05,0x00,0x0f,0x00,0x09,0x22,0x05,0x00,0x0f,3410x00,0x0f,0x00,0x08,0xb0,0x05,0x00,0x0f,0x00,0x08,0xb8,0x05,0x00,0x0f,0x00,0x08,
3420x00,0x09,0x2b,0x05,0x00,0x0f,0x00,0x09,0x34,0x05,0x00,0x0f,0x00,0x09,0x3d,0x05,3420xc0,0x05,0x00,0x0f,0x00,0x08,0xc8,0x05,0x00,0x0f,0x00,0x08,0xd0,0x05,0x00,0x0f,
3430x00,0x0f,0x00,0x09,0x46,0x05,0x00,0x0f,0x00,0x09,0x4f,0x05,0x00,0x0f,0x00,0x09,3430x00,0x08,0xd8,0x05,0x00,0x0f,0x00,0x08,0xe0,0x05,0x00,0x0f,0x00,0x08,0xe8,0x05,
3440x58,0x05,0x00,0x0f,0x00,0x09,0x61,0x05,0x00,0x0f,0x00,0x09,0x6a,0x05,0x00,0x0f,3440x00,0x0f,0x00,0x08,0xf0,0x05,0x00,0x0f,0x00,0x08,0xf8,0x05,0x00,0x0f,0x00,0x08,
3450x00,0x09,0x73,0x05,0x00,0x0f,0x00,0x09,0x7c,0x05,0x00,0x0f,0x00,0x09,0x85,0x05,3450x00,0x06,0x00,0x0f,0x00,0x08,0x08,0x06,0x00,0x0f,0x00,0x08,0x10,0x06,0x00,0x0f,
3460x00,0x0f,0x00,0x09,0x8e,0x05,0x00,0x0f,0x00,0x09,0x97,0x05,0x00,0x0f,0x00,0x09,3460x00,0x08,0x18,0x06,0x00,0x0f,0x00,0x08,0x20,0x06,0x00,0x0f,0x00,0x08,0x28,0x06,
3470xa0,0x05,0x00,0x0d,0x00,0x09,0xa9,0x05,0x05,0x0f,0x00,0x09,0xb2,0x05,0x02,0x0e,3470x00,0x0f,0x00,0x08,0x30,0x06,0x00,0x0f,0x00,0x08,0x38,0x06,0x00,0x0f,0x00,0x08,
3480x00,0x09,0xbb,0x05,0x03,0x0d,0x00,0x09,0xc4,0x05,0x03,0x0d,0x00,0x09,0xcd,0x05,3480x40,0x06,0x00,0x0f,0x00,0x08,0x48,0x06,0x00,0x0f,0x00,0x08,0x50,0x06,0x00,0x0f,
3490x03,0x0d,0x00,0x09,0xd6,0x05,0x02,0x0e,0x00,0x09,0xdf,0x05,0x03,0x0e,0x00,0x09,3490x00,0x08,0x58,0x06,0x00,0x0f,0x00,0x08,0x60,0x06,0x00,0x0f,0x00,0x08,0x68,0x06,
3500xe8,0x05,0x02,0x04,0x00,0x09,0xf1,0x05,0x03,0x0d,0x00,0x09,0xfa,0x05,0x03,0x0a,3500x00,0x0f,0x00,0x08,0x70,0x06,0x00,0x0f,0x00,0x08,0x78,0x06,0x00,0x0f,0x00,0x08,
3510x00,0x09,0x03,0x06,0x06,0x0b,0x00,0x09,0x0c,0x06,0x07,0x0a,0x00,0x09,0x15,0x06,3510x80,0x06,0x00,0x0f,0x00,0x08,0x88,0x06,0x00,0x0f,0x00,0x08,0x90,0x06,0x00,0x0f,
3520x08,0x09,0x00,0x09,0x1e,0x06,0x03,0x0b,0x00,0x09,0x27,0x06,0x02,0x03,0x00,0x09,3520x00,0x08,0x98,0x06,0x00,0x0f,0x00,0x08,0xa0,0x06,0x00,0x0f,0x00,0x08,0xa8,0x06,
3530x30,0x06,0x03,0x07,0x00,0x09,0x39,0x06,0x05,0x0c,0x00,0x09,0x42,0x06,0x03,0x0a,3530x00,0x0f,0x00,0x08,0xb0,0x06,0x00,0x0f,0x00,0x08,0xb8,0x06,0x00,0x0f,0x00,0x08,
3540x00,0x09,0x4b,0x06,0x03,0x0a,0x00,0x09,0x54,0x06,0x02,0x04,0x00,0x09,0x5d,0x06,3540xc0,0x06,0x00,0x0f,0x00,0x08,0xc8,0x06,0x00,0x0f,0x00,0x08,0xd0,0x06,0x00,0x0f,
3550x05,0x0f,0x00,0x09,0x66,0x06,0x03,0x0e,0x00,0x09,0x6f,0x06,0x08,0x0a,0x00,0x09,3550x00,0x08,0xd8,0x06,0x00,0x0f,0x00,0x08,0xe0,0x06,0x00,0x0f,0x00,0x08,0xe8,0x06,
3560x78,0x06,0x0d,0x0f,0x00,0x09,0x81,0x06,0x03,0x0a,0x00,0x09,0x8a,0x06,0x03,0x0a,3560x00,0x0f,0x00,0x08,0xf0,0x06,0x00,0x0f,0x00,0x08,0xf8,0x06,0x00,0x0f,0x00,0x08,
3570x00,0x09,0x93,0x06,0x06,0x0b,0x00,0x09,0x9c,0x06,0x03,0x0d,0x00,0x09,0xa5,0x06,3570x00,0x07,0x00,0x0f,0x00,0x08,0x08,0x07,0x00,0x0f,0x00,0x08,0x10,0x07,0x00,0x0f,
3580x03,0x0d,0x00,0x09,0xae,0x06,0x03,0x0d,0x00,0x09,0xb7,0x06,0x05,0x0f,0x00,0x09,3580x00,0x08,0x18,0x07,0x00,0x0f,0x00,0x08,0x20,0x07,0x00,0x0f,0x00,0x08,0x28,0x07,
3590xc0,0x06,0x00,0x0d,0x00,0x09,0xc9,0x06,0x00,0x0d,0x00,0x09,0xd2,0x06,0x00,0x0d,3590x00,0x0f,0x00,0x08,0x30,0x07,0x00,0x0f,0x00,0x08,0x38,0x07,0x00,0x0f,0x00,0x08,
3600x00,0x09,0xdb,0x06,0x00,0x0d,0x00,0x09,0xe4,0x06,0x00,0x0d,0x00,0x09,0xed,0x06,3600x40,0x07,0x00,0x0f,0x00,0x08,0x48,0x07,0x00,0x0f,0x00,0x08,0x50,0x07,0x00,0x0f,
3610x01,0x0d,0x00,0x09,0xf6,0x06,0x03,0x0d,0x00,0x09,0xff,0x06,0x03,0x0f,0x00,0x09,3610x00,0x08,0x58,0x07,0x00,0x0f,0x00,0x08,0x60,0x07,0x00,0x0f,0x00,0x08,0x68,0x07,
3620x08,0x07,0x00,0x0d,0x00,0x09,0x11,0x07,0x00,0x0d,0x00,0x09,0x1a,0x07,0x00,0x0d,3620x00,0x0f,0x00,0x08,0x70,0x07,0x00,0x0f,0x00,0x08,0x78,0x07,0x00,0x0f,0x00,0x08,
3630x00,0x09,0x23,0x07,0x00,0x0d,0x00,0x09,0x2c,0x07,0x00,0x0d,0x00,0x09,0x35,0x07,3630x80,0x07,0x00,0x0f,0x00,0x08,0x88,0x07,0x00,0x0f,0x00,0x08,0x90,0x07,0x00,0x0f,
3640x00,0x0d,0x00,0x09,0x3e,0x07,0x00,0x0d,0x00,0x09,0x47,0x07,0x00,0x0d,0x00,0x09,3640x00,0x08,0x98,0x07,0x00,0x0f,0x00,0x08,0xa0,0x07,0x00,0x0f,0x00,0x08,0xa8,0x07,
3650x50,0x07,0x03,0x0d,0x00,0x09,0x59,0x07,0x00,0x0d,0x00,0x09,0x62,0x07,0x00,0x0d,3650x00,0x0f,0x00,0x08,0xb0,0x07,0x00,0x0f,0x00,0x08,0xb8,0x07,0x00,0x0f,0x00,0x08,
3660x00,0x09,0x6b,0x07,0x00,0x0d,0x00,0x09,0x74,0x07,0x00,0x0d,0x00,0x09,0x7d,0x07,3660xc0,0x07,0x00,0x0f,0x00,0x08,0xc8,0x07,0x00,0x0f,0x00,0x08,0xd0,0x07,0x00,0x0f,
3670x00,0x0d,0x00,0x09,0x86,0x07,0x00,0x0d,0x00,0x09,0x8f,0x07,0x06,0x0b,0x00,0x09,3670x00,0x08,0xd8,0x07,0x00,0x0f,0x00,0x08,0xe0,0x07,0x00,0x0f,0x00,0x08,0xe8,0x07,
3680x98,0x07,0x03,0x0d,0x00,0x09,0xa1,0x07,0x00,0x0d,0x00,0x09,0xaa,0x07,0x00,0x0d,3680x00,0x0f,0x00,0x08,0xf0,0x07,0x00,0x0f,0x00,0x08,0xf8,0x07,0x00,0x0f,0x00,0x08,
3690x00,0x09,0xb3,0x07,0x00,0x0d,0x00,0x09,0xbc,0x07,0x00,0x0d,0x00,0x09,0xc5,0x07,3690x00,0x08,0x00,0x0f,0x00,0x08,
3700x00,0x0d,0x00,0x09,0xce,0x07,0x03,0x0d,0x00,0x09,0xd7,0x07,0x02,0x0d,0x00,0x09,
3710xe0,0x07,0x02,0x0d,0x00,0x09,0xe9,0x07,0x02,0x0d,0x00,0x09,0xf2,0x07,0x02,0x0d,
3720x00,0x09,0xfb,0x07,0x02,0x0d,0x00,0x09,0x04,0x08,0x02,0x0d,0x00,0x09,0x0d,0x08,
3730x02,0x0d,0x00,0x09,0x16,0x08,0x05,0x0d,0x00,0x09,0x1f,0x08,0x05,0x0f,0x00,0x09,
3740x28,0x08,0x02,0x0d,0x00,0x09,0x31,0x08,0x02,0x0d,0x00,0x09,0x3a,0x08,0x02,0x0d,
3750x00,0x09,0x43,0x08,0x02,0x0d,0x00,0x09,0x4c,0x08,0x02,0x0d,0x00,0x09,0x55,0x08,
3760x02,0x0d,0x00,0x09,0x5e,0x08,0x02,0x0d,0x00,0x09,0x67,0x08,0x02,0x0d,0x00,0x09,
3770x70,0x08,0x02,0x0d,0x00,0x09,0x79,0x08,0x02,0x0d,0x00,0x09,0x82,0x08,0x02,0x0d,
3780x00,0x09,0x8b,0x08,0x02,0x0d,0x00,0x09,0x94,0x08,0x02,0x0d,0x00,0x09,0x9d,0x08,
3790x02,0x0d,0x00,0x09,0xa6,0x08,0x02,0x0d,0x00,0x09,0xaf,0x08,0x05,0x0c,0x00,0x09,
3800xb8,0x08,0x05,0x0d,0x00,0x09,0xc1,0x08,0x02,0x0d,0x00,0x09,0xca,0x08,0x02,0x0d,
3810x00,0x09,0xd3,0x08,0x02,0x0d,0x00,0x09,0xdc,0x08,0x02,0x0d,0x00,0x09,0xe5,0x08,
3820x02,0x0f,0x00,0x09,0xee,0x08,0x03,0x0f,0x00,0x09,0xf7,0x08,0x02,0x0f,0x00,0x09,
3830x00,0x09,0x00,0x00,0x00,0x00,
384};370};
385 371
386int sizeofdefont = sizeof defontdata;372int sizeofdefont = sizeof defontdata;
libdraw/fmt.c+22−0
@@ -0,0 +1,22 @@
1#include <u.h>
2#include <libc.h>
3#include <draw.h>
4
5int
6Rfmt(Fmt *f)
7{
8 Rectangle r;
9
10 r = va_arg(f->args, Rectangle);
11 return fmtprint(f, "%P %P", r.min, r.max);
12}
13
14int
15Pfmt(Fmt *f)
16{
17 Point p;
18
19 p = va_arg(f->args, Point);
20 return fmtprint(f, "[%d %d]", p.x, p.y);
21}
22
libmemdraw/alloc.c+16−13
@@ -23,20 +23,20 @@ memimagemove(void *from, void *to) · 22 unmodified lines
23}23}
24 24
25Memimage*25Memimage*
26allocmemimaged(Rectangle r, ulong chan, Memdata *md, void *X)26allocmemimaged(Rectangle r, ulong chan, Memdata *md)
27{27{
28 int d;28 int d;
29 ulong l;29 ulong l;
30 Memimage *i;30 Memimage *i;
31 31
32 if(Dx(r) <= 0 || Dy(r) <= 0){
33 werrstr("bad rectangle %R", r);
34 return nil;
35 }
36 if((d = chantodepth(chan)) == 0) {32 if((d = chantodepth(chan)) == 0) {
37 werrstr("bad channel descriptor %.8lux", chan);33 werrstr("bad channel descriptor %.8lux", chan);
38 return nil;34 return nil;
39 }35 }
36 if(badrect(r)){
37 werrstr("bad rectangle %R", r);
38 return nil;
39 }
40 40
41 l = wordsperline(r, d);41 l = wordsperline(r, d);
42 42
@@ -44,7 +44,6 @@ allocmemimaged(Rectangle r, ulong chan, Memdata *md, void *X) · 1 unmodified line
44 if(i == nil)44 if(i == nil)
45 return nil;45 return nil;
46 46
47 i->X = X;
48 i->data = md;47 i->data = md;
49 i->zero = sizeof(ulong)*l*r.min.y;48 i->zero = sizeof(ulong)*l*r.min.y;
50 49
@@ -67,11 +66,11 @@ allocmemimaged(Rectangle r, ulong chan, Memdata *md, void *X) · 16 unmodified lines
67}66}
68 67
69Memimage*68Memimage*
70_allocmemimage(Rectangle r, ulong chan)69allocmemimage(Rectangle r, ulong chan)
71{70{
72 int d;71 int d;
73 u32int l, nw;
74 uchar *p;72 uchar *p;
73 ulong l, nw;
75 Memdata *md;74 Memdata *md;
76 Memimage *i;75 Memimage *i;
77 76
@@ -79,8 +78,13 @@ _allocmemimage(Rectangle r, ulong chan) · 1 unmodified line
79 werrstr("bad channel descriptor %.8lux", chan);78 werrstr("bad channel descriptor %.8lux", chan);
80 return nil;79 return nil;
81 }80 }
81 if(badrect(r)){
82 werrstr("bad rectangle %R", r);
83 return nil;
84 }
82 85
83 l = wordsperline(r, d);86 l = wordsperline(r, d);
87
84 nw = l*Dy(r);88 nw = l*Dy(r);
85 md = malloc(sizeof(Memdata));89 md = malloc(sizeof(Memdata));
86 if(md == nil)90 if(md == nil)
@@ -104,7 +108,7 @@ _allocmemimage(Rectangle r, ulong chan) · 17 unmodified lines
104 md->bdata = p;108 md->bdata = p;
105 md->allocd = 1;109 md->allocd = 1;
106 110
107 i = allocmemimaged(r, chan, md, nil);111 i = allocmemimaged(r, chan, md);
108 if(i == nil){112 if(i == nil){
109 poolfree(imagmem, md->base);113 poolfree(imagmem, md->base);
110 free(md);114 free(md);
@@ -115,11 +119,11 @@ _allocmemimage(Rectangle r, ulong chan) · 4 unmodified lines
115}119}
116 120
117void121void
118_freememimage(Memimage *i)122freememimage(Memimage *i)
119{123{
120 if(i == nil)124 if(i == nil)
121 return;125 return;
122 if(i->data->ref-- == 1 && i->data->allocd){126 if(--i->data->ref == 0 && i->data->allocd){
123 if(i->data->base)127 if(i->data->base)
124 poolfree(imagmem, i->data->base);128 poolfree(imagmem, i->data->base);
125 free(i->data);129 free(i->data);
@@ -141,8 +145,7 @@ byteaddr(Memimage *i, Point p) · 15 unmodified lines
141{145{
142 uchar *a;146 uchar *a;
143 147
144 a = i->data->bdata+i->zero+sizeof(ulong)*p.y*i->width;148 a = i->data->bdata+i->zero+(int)(sizeof(ulong)*p.y*i->width);
145
146 if(i->depth < 8){149 if(i->depth < 8){
147 /*150 /*
148 * We need to always round down,151 * We need to always round down,
libmemdraw/arctest.c+0−62
@@ -1,62 +0,0 @@
1#include <u.h>
2#include <libc.h>
3#include <draw.h>
4#include <memdraw.h>
5#include <memlayer.h>
6
7extern int drawdebug;
8void
9main(int argc, char **argv)
10{
11 char cc;
12 Memimage *x;
13 Point c = {208,871};
14 int a = 441;
15 int b = 441;
16 int thick = 0;
17 Point sp = {0,0};
18 int alpha = 51;
19 int phi = 3;
20 vlong t0, t1;
21 int i, n;
22 vlong del;
23
24 memimageinit();
25
26 x = allocmemimage(Rect(0,0,1000,1000), CMAP8);
27 n = atoi(argv[1]);
28
29 t0 = nsec();
30 t0 = nsec();
31 t0 = nsec();
32 t1 = nsec();
33 del = t1-t0;
34 t0 = nsec();
35 for(i=0; i<n; i++)
36 memarc(x, c, a, b, thick, memblack, sp, alpha, phi, SoverD);
37 t1 = nsec();
38 print("%lld %lld\n", t1-t0-del, del);
39}
40
41int drawdebug = 0;
42
43void
44rdb(void)
45{
46}
47
48int
49iprint(char *fmt, ...)
50{
51 int n;
52 va_list va;
53 char buf[1024];
54
55 va_start(va, fmt);
56 n = doprint(buf, buf+sizeof buf, fmt, va) - buf;
57 va_end(va);
58
59 write(1,buf,n);
60 return 1;
61}
62
libmemdraw/cload.c+2−2
@@ -4,12 +4,12 @@ · 3 unmodified lines
4#include <memdraw.h>4#include <memdraw.h>
5 5
6int6int
7_cloadmemimage(Memimage *i, Rectangle r, uchar *data, int ndata)7cloadmemimage(Memimage *i, Rectangle r, uchar *data, int ndata)
8{8{
9 int y, bpl, c, cnt, offs;9 int y, bpl, c, cnt, offs;
10 uchar mem[NMEM], *memp, *omemp, *emem, *linep, *elinep, *u, *eu;10 uchar mem[NMEM], *memp, *omemp, *emem, *linep, *elinep, *u, *eu;
11 11
12 if(!rectinrect(r, i->r))12 if(badrect(r) || !rectinrect(r, i->r))
13 return -1;13 return -1;
14 bpl = bytesperline(r, i->depth);14 bpl = bytesperline(r, i->depth);
15 u = data;15 u = data;
libmemdraw/defont.c+1−1
@@ -43,7 +43,7 @@ getmemdefont(void) · 42 unmodified lines
43 md->ref = 1;43 md->ref = 1;
44 md->allocd = 1; /* so freememimage does free md */44 md->allocd = 1; /* so freememimage does free md */
45 45
46 i = allocmemimaged(r, drawld2chan[ld], md, nil);46 i = allocmemimaged(r, drawld2chan[ld], md);
47 if(i == nil){47 if(i == nil){
48 free(md);48 free(md);
49 return nil;49 return nil;
libmemdraw/draw.c+243−188
@@ -4,7 +4,6 @@ · 3 unmodified lines
4#include <memdraw.h>4#include <memdraw.h>
5 5
6int drawdebug;6int drawdebug;
7static int tablesbuilt;
8 7
9/* perfect approximation to NTSC = .299r+.587g+.114b when 0 ≤ r,g,b < 256 */8/* perfect approximation to NTSC = .299r+.587g+.114b when 0 ≤ r,g,b < 256 */
10#define RGB2K(r,g,b) ((156763*(r)+307758*(g)+59769*(b))>>19)9#define RGB2K(r,g,b) ((156763*(r)+307758*(g)+59769*(b))>>19)
@@ -52,15 +51,13 @@ Memimage *memopaque; · 41 unmodified lines
52 51
53int _ifmt(Fmt*);52int _ifmt(Fmt*);
54 53
55void54int
56_memimageinit(void)55memimageinit(void)
57{56{
58 static int didinit = 0;57 static int didinit = 0;
59 58
60 if(didinit)59 if(didinit)
61 return;60 return 0;
62
63 didinit = 1;
64 61
65 mktables();62 mktables();
66 _memmkcmap();63 _memmkcmap();
@@ -69,34 +66,36 @@ _memimageinit(void) · 2 unmodified lines
69 fmtinstall('P', Pfmt);66 fmtinstall('P', Pfmt);
70 67
71 memones = allocmemimage(Rect(0,0,1,1), GREY1);68 memones = allocmemimage(Rect(0,0,1,1), GREY1);
69 memzeros = allocmemimage(Rect(0,0,1,1), GREY1);
70 if(memones == nil || memzeros == nil)
71 return -1;
72
72 memones->flags |= Frepl;73 memones->flags |= Frepl;
73 memones->clipr = Rect(-0x3FFFFFF, -0x3FFFFFF, 0x3FFFFFF, 0x3FFFFFF);74 memones->clipr = Rect(-0x3FFFFFF, -0x3FFFFFF, 0x3FFFFFF, 0x3FFFFFF);
74 *byteaddr(memones, ZP) = ~0;75 *byteaddr(memones, ZP) = ~0;
75 76
76 memzeros = allocmemimage(Rect(0,0,1,1), GREY1);
77 memzeros->flags |= Frepl;77 memzeros->flags |= Frepl;
78 memzeros->clipr = Rect(-0x3FFFFFF, -0x3FFFFFF, 0x3FFFFFF, 0x3FFFFFF);78 memzeros->clipr = Rect(-0x3FFFFFF, -0x3FFFFFF, 0x3FFFFFF, 0x3FFFFFF);
79 *byteaddr(memzeros, ZP) = 0;79 *byteaddr(memzeros, ZP) = 0;
80 80
81 if(memones == nil || memzeros == nil)
82 assert(0 /*cannot initialize memimage library */); /* RSC BUG */
83
84 memwhite = memones;81 memwhite = memones;
85 memblack = memzeros;82 memblack = memzeros;
86 memopaque = memones;83 memopaque = memones;
87 memtransparent = memzeros;84 memtransparent = memzeros;
85
86 didinit = 1;
87 return 0;
88}88}
89 89
90ulong _imgtorgba(Memimage*, ulong);90static ulong imgtorgba(Memimage*, ulong);
91ulong _rgbatoimg(Memimage*, ulong);91static ulong rgbatoimg(Memimage*, ulong);
92ulong _pixelbits(Memimage*, Point);
93 92
94#define DBG if(0)93#define DBG if(0)
95static Memdrawparam par;94void
96 95memimagedraw(Memimage *dst, Rectangle r, Memimage *src, Point p0, Memimage *mask, Point p1, int op)
97Memdrawparam*
98_memimagedrawsetup(Memimage *dst, Rectangle r, Memimage *src, Point p0, Memimage *mask, Point p1, int op)
99{96{
97 static int n = 0;
98 Memdrawparam par;
100 99
101 if(mask == nil)100 if(mask == nil)
102 mask = memopaque;101 mask = memopaque;
@@ -106,13 +105,13 @@ DBG print("memimagedraw %p/%luX %R @ %p %p/%luX %P %p/%luX %P... ", dst, dst->ch · 3 unmodified lines
106 if(drawclip(dst, &r, src, &p0, mask, &p1, &par.sr, &par.mr) == 0){105 if(drawclip(dst, &r, src, &p0, mask, &p1, &par.sr, &par.mr) == 0){
107// if(drawdebug)106// if(drawdebug)
108// iprint("empty clipped rectangle\n");107// iprint("empty clipped rectangle\n");
109 return nil;108 return;
110 }109 }
111 110
112 if(op < Clear || op > SoverD){111 if(op < Clear || op > SoverD){
113// if(drawdebug)112// if(drawdebug)
114// iprint("op out of range: %d\n", op);113// iprint("op out of range: %d\n", op);
115 return nil;114 return;
116 }115 }
117 116
118 par.op = op;117 par.op = op;
@@ -127,13 +126,13 @@ DBG print("memimagedraw %p/%luX %R @ %p %p/%luX %P %p/%luX %P... ", dst, dst->ch · 8 unmodified lines
127 if(src->flags&Frepl){126 if(src->flags&Frepl){
128 par.state |= Replsrc;127 par.state |= Replsrc;
129 if(Dx(src->r)==1 && Dy(src->r)==1){128 if(Dx(src->r)==1 && Dy(src->r)==1){
130 par.sval = _pixelbits(src, src->r.min);129 par.sval = pixelbits(src, src->r.min);
131 par.state |= Simplesrc;130 par.state |= Simplesrc;
132 par.srgba = _imgtorgba(src, par.sval);131 par.srgba = imgtorgba(src, par.sval);
133 par.sdval = _rgbatoimg(dst, par.srgba);132 par.sdval = rgbatoimg(dst, par.srgba);
134 if((par.srgba&0xFF) == 0 && (op&DoutS)){133 if((par.srgba&0xFF) == 0 && (op&DoutS)){
135// if (drawdebug) iprint("fill with transparent source\n");134// if (drawdebug) iprint("fill with transparent source\n");
136 return nil; /* no-op successfully handled */135 return; /* no-op successfully handled */
137 }136 }
138 }137 }
139 }138 }
@@ -141,15 +140,15 @@ DBG print("memimagedraw %p/%luX %R @ %p %p/%luX %P %p/%luX %P... ", dst, dst->ch · 1 unmodified line
141 if(mask->flags & Frepl){140 if(mask->flags & Frepl){
142 par.state |= Replmask;141 par.state |= Replmask;
143 if(Dx(mask->r)==1 && Dy(mask->r)==1){142 if(Dx(mask->r)==1 && Dy(mask->r)==1){
144 par.mval = _pixelbits(mask, mask->r.min);143 par.mval = pixelbits(mask, mask->r.min);
145 if(par.mval == 0 && (op&DoutS)){144 if(par.mval == 0 && (op&DoutS)){
146// if(drawdebug) iprint("fill with zero mask\n");145// if(drawdebug) iprint("fill with zero mask\n");
147 return nil; /* no-op successfully handled */146 return; /* no-op successfully handled */
148 }147 }
149 par.state |= Simplemask;148 par.state |= Simplemask;
150 if(par.mval == ~0)149 if(par.mval == ~0)
151 par.state |= Fullmask;150 par.state |= Fullmask;
152 par.mrgba = _imgtorgba(mask, par.mval);151 par.mrgba = imgtorgba(mask, par.mval);
153 }152 }
154 }153 }
155 154
@@ -157,15 +156,6 @@ DBG print("memimagedraw %p/%luX %R @ %p %p/%luX %P %p/%luX %P... ", dst, dst->ch · 1 unmodified line
157// iprint("dr %R sr %R mr %R...", r, par.sr, par.mr);156// iprint("dr %R sr %R mr %R...", r, par.sr, par.mr);
158DBG print("draw dr %R sr %R mr %R %lux\n", r, par.sr, par.mr, par.state);157DBG print("draw dr %R sr %R mr %R %lux\n", r, par.sr, par.mr, par.state);
159 158
160 return &par;
161}
162
163void
164_memimagedraw(Memdrawparam *par)
165{
166 if (par == nil)
167 return;
168
169 /*159 /*
170 * Now that we've clipped the parameters down to be consistent, we 160 * Now that we've clipped the parameters down to be consistent, we
171 * simply try sub-drawing routines in order until we find one that was able161 * simply try sub-drawing routines in order until we find one that was able
@@ -179,7 +169,7 @@ _memimagedraw(Memdrawparam *par) · 7 unmodified lines
179 * There could be an if around this checking to see if dst is in video memory.169 * There could be an if around this checking to see if dst is in video memory.
180 */170 */
181DBG print("test hwdraw\n");171DBG print("test hwdraw\n");
182 if(hwdraw(par)){172 if(hwdraw(&par)){
183//if(drawdebug) iprint("hw handled\n");173//if(drawdebug) iprint("hw handled\n");
184DBG print("hwdraw handled\n");174DBG print("hwdraw handled\n");
185 return;175 return;
@@ -188,7 +178,7 @@ DBG print("hwdraw handled\n"); · 2 unmodified lines
188 * Optimizations using memmove and memset.178 * Optimizations using memmove and memset.
189 */179 */
190DBG print("test memoptdraw\n");180DBG print("test memoptdraw\n");
191 if(memoptdraw(par)){181 if(memoptdraw(&par)){
192//if(drawdebug) iprint("memopt handled\n");182//if(drawdebug) iprint("memopt handled\n");
193DBG print("memopt handled\n");183DBG print("memopt handled\n");
194 return;184 return;
@@ -199,7 +189,7 @@ DBG print("memopt handled\n"); · 4 unmodified lines
199 * Solid source color being painted through a boolean mask onto a high res image.189 * Solid source color being painted through a boolean mask onto a high res image.
200 */190 */
201DBG print("test chardraw\n");191DBG print("test chardraw\n");
202 if(chardraw(par)){192 if(chardraw(&par)){
203//if(drawdebug) iprint("chardraw handled\n");193//if(drawdebug) iprint("chardraw handled\n");
204DBG print("chardraw handled\n");194DBG print("chardraw handled\n");
205 return;195 return;
@@ -209,29 +199,28 @@ DBG print("chardraw handled\n"); · 3 unmodified lines
209 * General calculation-laden case that does alpha for each pixel.199 * General calculation-laden case that does alpha for each pixel.
210 */200 */
211DBG print("do alphadraw\n");201DBG print("do alphadraw\n");
212 alphadraw(par);202 alphadraw(&par);
213//if(drawdebug) iprint("alphadraw handled\n");203//if(drawdebug) iprint("alphadraw handled\n");
214DBG print("alphadraw handled\n");204DBG print("alphadraw handled\n");
215}205}
216#undef DBG206#undef DBG
217 207
208
218/*209/*
219 * Clip the destination rectangle further based on the properties of the 210 * Clip the destination rectangle further based on the properties of the
220 * source and mask rectangles. Once the destination rectangle is properly211 * source and mask rectangles. Once the destination rectangle is properly
221 * clipped, adjust the source and mask rectangles to be the same size.212 * clipped, adjust the source and mask rectangles to be the same size.
222 * Then if source or mask is replicated, move its clipped rectangle
223 * so that its minimum point falls within the repl rectangle.
224 *213 *
225 * Return zero if the final rectangle is null.214 * Return zero if the final rectangle is null.
226 */215 */
227int216int
228drawclip(Memimage *dst, Rectangle *r, Memimage *src, Point *p0, Memimage *mask, Point *p1, Rectangle *sr, Rectangle *mr)217drawclipnorepl(Memimage *dst, Rectangle *r, Memimage *src, Point *p0, Memimage *mask, Point *p1, Rectangle *sr, Rectangle *mr)
229{218{
230 Point rmin, delta;219 Point rmin, delta;
231 int splitcoords;220 int splitcoords;
232 Rectangle omr;221 Rectangle omr;
233 222
234 if(r->min.x>=r->max.x || r->min.y>=r->max.y)223 if(badrect(*r))
235 return 0;224 return 0;
236 splitcoords = (p0->x!=p1->x) || (p0->y!=p1->y);225 splitcoords = (p0->x!=p1->x) || (p0->y!=p1->y);
237 /* clip to destination */226 /* clip to destination */
@@ -272,15 +261,13 @@ drawclip(Memimage *dst, Rectangle *r, Memimage *src, Point *p0, Memimage *mask, · 34 unmodified lines
272 sr->min.y += mr->min.y-omr.min.y;261 sr->min.y += mr->min.y-omr.min.y;
273 sr->max.x += mr->max.x-omr.max.x;262 sr->max.x += mr->max.x-omr.max.x;
274 sr->max.y += mr->max.y-omr.max.y;263 sr->max.y += mr->max.y-omr.max.y;
275 *p1 = mr->min;
276 }else{264 }else{
277 if(!(mask->flags&Frepl) && !rectclip(sr, mask->r))265 if(!(mask->flags&Frepl) && !rectclip(sr, mask->r))
278 return 0;266 return 0;
279 if(!rectclip(sr, mask->clipr))267 if(!rectclip(sr, mask->clipr))
280 return 0;268 return 0;
281 *p1 = sr->min;269 *mr = *sr;
282 }270 }
283
284 /* move source clipping back to destination */271 /* move source clipping back to destination */
285 delta.x = r->min.x - p0->x;272 delta.x = r->min.x - p0->x;
286 delta.y = r->min.y - p0->y;273 delta.y = r->min.y - p0->y;
@@ -288,6 +275,30 @@ drawclip(Memimage *dst, Rectangle *r, Memimage *src, Point *p0, Memimage *mask, · 1 unmodified line
288 r->min.y = sr->min.y + delta.y;275 r->min.y = sr->min.y + delta.y;
289 r->max.x = sr->max.x + delta.x;276 r->max.x = sr->max.x + delta.x;
290 r->max.y = sr->max.y + delta.y;277 r->max.y = sr->max.y + delta.y;
278 *p0 = sr->min;
279 *p1 = mr->min;
280
281 assert(Dx(*sr) == Dx(*mr) && Dx(*mr) == Dx(*r));
282 assert(Dy(*sr) == Dy(*mr) && Dy(*mr) == Dy(*r));
283 assert(ptinrect(r->min, dst->r));
284
285 return 1;
286}
287
288/*
289 * like drawclipnorepl() above, but if source or mask is replicated,
290 * move its clipped rectangle so that its minimum point falls within
291 * the repl rectangle.
292 *
293 * Return zero if the final rectangle is null.
294 */
295int
296drawclip(Memimage *dst, Rectangle *r, Memimage *src, Point *p0, Memimage *mask, Point *p1, Rectangle *sr, Rectangle *mr)
297{
298 Point delta;
299
300 if(!drawclipnorepl(dst, r, src, p0, mask, p1, sr, mr))
301 return 0;
291 302
292 /* move source rectangle so sr->min is in src->r */303 /* move source rectangle so sr->min is in src->r */
293 if(src->flags&Frepl) {304 if(src->flags&Frepl) {
@@ -297,8 +308,8 @@ drawclip(Memimage *dst, Rectangle *r, Memimage *src, Point *p0, Memimage *mask, · 3 unmodified lines
297 sr->min.y += delta.y;308 sr->min.y += delta.y;
298 sr->max.x += delta.x;309 sr->max.x += delta.x;
299 sr->max.y += delta.y;310 sr->max.y += delta.y;
311 *p0 = sr->min;
300 }312 }
301 *p0 = sr->min;
302 313
303 /* move mask point so it is in mask->r */314 /* move mask point so it is in mask->r */
304 *p1 = drawrepl(mask->r, *p1);315 *p1 = drawrepl(mask->r, *p1);
@@ -306,11 +317,8 @@ drawclip(Memimage *dst, Rectangle *r, Memimage *src, Point *p0, Memimage *mask, · 1 unmodified line
306 mr->max.x = p1->x+Dx(*sr);317 mr->max.x = p1->x+Dx(*sr);
307 mr->max.y = p1->y+Dy(*sr);318 mr->max.y = p1->y+Dy(*sr);
308 319
309 assert(Dx(*sr) == Dx(*mr) && Dx(*mr) == Dx(*r));
310 assert(Dy(*sr) == Dy(*mr) && Dy(*mr) == Dy(*r));
311 assert(ptinrect(*p0, src->r));320 assert(ptinrect(*p0, src->r));
312 assert(ptinrect(*p1, mask->r));321 assert(ptinrect(*p1, mask->r));
313 assert(ptinrect(r->min, dst->r));
314 322
315 return 1;323 return 1;
316}324}
@@ -357,13 +365,6 @@ mktables(void) · 40 unmodified lines
357{365{
358 int i, j, mask, sh, small;366 int i, j, mask, sh, small;
359 367
360 if(tablesbuilt)
361 return;
362
363 fmtinstall('R', Rfmt);
364 fmtinstall('P', Pfmt);
365 tablesbuilt = 1;
366
367 /* bit replication up to 8 bits */368 /* bit replication up to 8 bits */
368 for(i=0; i<256; i++){369 for(i=0; i<256; i++){
369 for(j=0; j<=8; j++){ /* j <= 8 [sic] */370 for(j=0; j<=8; j++){ /* j <= 8 [sic] */
@@ -396,7 +397,7 @@ struct Buffer { · 26 unmodified lines
396 uchar *red;397 uchar *red;
397 uchar *grn;398 uchar *grn;
398 uchar *blu;399 uchar *blu;
399 uchar *alpha;400 uchar *alpha; /* is &ones when unused, never nil */
400 uchar *grey;401 uchar *grey;
401 ulong *rgba;402 ulong *rgba;
402 int delta; /* number of bytes to add to pointer to get next pixel to the right */403 int delta; /* number of bytes to add to pointer to get next pixel to the right */
@@ -456,7 +457,6 @@ struct Param { · 53 unmodified lines
456static uchar *drawbuf;457static uchar *drawbuf;
457static int ndrawbuf;458static int ndrawbuf;
458static int mdrawbuf;459static int mdrawbuf;
459static Param spar, mpar, dpar; /* easier on the stacks */
460static Readfn greymaskread, replread, readptr;460static Readfn greymaskread, replread, readptr;
461static Writefn nullwrite;461static Writefn nullwrite;
462static Calcfn alphacalc0, alphacalc14, alphacalc2810, alphacalc3679, alphacalc5, alphacalc11, alphacalcS;462static Calcfn alphacalc0, alphacalc14, alphacalc2810, alphacalc3679, alphacalc5, alphacalc11, alphacalcS;
@@ -467,7 +467,8 @@ static Readfn* readalphafn(Memimage*); · 4 unmodified lines
467static Writefn* writefn(Memimage*);467static Writefn* writefn(Memimage*);
468 468
469static Calcfn* boolcopyfn(Memimage*, Memimage*);469static Calcfn* boolcopyfn(Memimage*, Memimage*);
470static Readfn* convfn(Memimage*, Param*, Memimage*, Param*);470static Readfn* convfn(Memimage*, Param*, Memimage*, Param*, int*);
471static Readfn* ptrfn(Memimage*);
471 472
472static Calcfn *alphacalc[Ncomp] = 473static Calcfn *alphacalc[Ncomp] =
473{474{
@@ -501,59 +502,66 @@ static Calcfn *boolcalc[Ncomp] = · 27 unmodified lines
501 boolcalc1011, /* SoverD */502 boolcalc1011, /* SoverD */
502};503};
503 504
504static int505/*
505allocdrawbuf(void)506 * Avoid standard Lock, QLock so that can be used in kernel.
507 */
508typedef struct Dbuf Dbuf;
509struct Dbuf
506{510{
507 uchar *p;511 uchar *p;
512 int n;
513 Param spar, mpar, dpar;
514 int inuse;
515};
516static Dbuf dbuf[10];
508 517
509 if(ndrawbuf > mdrawbuf){518static Dbuf*
510 p = realloc(drawbuf, ndrawbuf);519allocdbuf(void)
511 if(p == nil){520{
512 werrstr("memimagedraw out of memory");521 int i;
513 return -1;522
514 }523 for(i=0; i<nelem(dbuf); i++){
515 drawbuf = p;524 if(dbuf[i].inuse)
516 mdrawbuf = ndrawbuf;525 continue;
526 if(!tas(&dbuf[i].inuse))
527 return &dbuf[i];
517 }528 }
518 return 0;529 return nil;
519}530}
520 531
521static Param532static void
522getparam(Memimage *img, Rectangle r, int convgrey, int needbuf)533getparam(Param *p, Memimage *img, Rectangle r, int convgrey, int needbuf, int *ndrawbuf)
523{534{
524 Param p;
525 int nbuf;535 int nbuf;
526 536
527 memset(&p, 0, sizeof p);537 memset(p, 0, sizeof *p);
528 538
529 p.img = img;539 p->img = img;
530 p.r = r;540 p->r = r;
531 p.dx = Dx(r);541 p->dx = Dx(r);
532 p.needbuf = needbuf;542 p->needbuf = needbuf;
533 p.convgrey = convgrey;543 p->convgrey = convgrey;
534 544
535 assert(img->r.min.x <= r.min.x && r.min.x < img->r.max.x);545 assert(img->r.min.x <= r.min.x && r.min.x < img->r.max.x);
536 546
537 p.bytey0s = byteaddr(img, Pt(img->r.min.x, img->r.min.y));547 p->bytey0s = byteaddr(img, Pt(img->r.min.x, img->r.min.y));
538 p.bytermin = byteaddr(img, Pt(r.min.x, img->r.min.y));548 p->bytermin = byteaddr(img, Pt(r.min.x, img->r.min.y));
539 p.bytey0e = byteaddr(img, Pt(img->r.max.x, img->r.min.y));549 p->bytey0e = byteaddr(img, Pt(img->r.max.x, img->r.min.y));
540 p.bwidth = sizeof(ulong)*img->width;550 p->bwidth = sizeof(ulong)*img->width;
541 551
542 assert(p.bytey0s <= p.bytermin && p.bytermin <= p.bytey0e);552 assert(p->bytey0s <= p->bytermin && p->bytermin <= p->bytey0e);
543 553
544 if(p.r.min.x == p.img->r.min.x)554 if(p->r.min.x == p->img->r.min.x)
545 assert(p.bytermin == p.bytey0s);555 assert(p->bytermin == p->bytey0s);
546 556
547 nbuf = 1;557 nbuf = 1;
548 if((img->flags&Frepl) && Dy(img->r) <= MAXBCACHE && Dy(img->r) < Dy(r)){558 if((img->flags&Frepl) && Dy(img->r) <= MAXBCACHE && Dy(img->r) < Dy(r)){
549 p.replcache = 1;559 p->replcache = 1;
550 nbuf = Dy(img->r);560 nbuf = Dy(img->r);
551 }561 }
552 p.bufdelta = 4*p.dx;562 p->bufdelta = 4*p->dx;
553 p.bufoff = ndrawbuf;563 p->bufoff = *ndrawbuf;
554 ndrawbuf += p.bufdelta*nbuf;564 *ndrawbuf += p->bufdelta*nbuf;
555
556 return p;
557}565}
558 566
559static void567static void
@@ -578,19 +586,19 @@ dumpbuf(char *s, Buffer b, int n) · 18 unmodified lines
578 print("%s", s);586 print("%s", s);
579 for(i=0; i<n; i++){587 for(i=0; i<n; i++){
580 print(" ");588 print(" ");
581 if((p=b.grey)){589 if(p=b.grey){
582 print(" k%.2uX", *p);590 print(" k%.2uX", *p);
583 b.grey += b.delta;591 b.grey += b.delta;
584 }else{ 592 }else{
585 if((p=b.red)){593 if(p=b.red){
586 print(" r%.2uX", *p);594 print(" r%.2uX", *p);
587 b.red += b.delta;595 b.red += b.delta;
588 }596 }
589 if((p=b.grn)){597 if(p=b.grn){
590 print(" g%.2uX", *p);598 print(" g%.2uX", *p);
591 b.grn += b.delta;599 b.grn += b.delta;
592 }600 }
593 if((p=b.blu)){601 if(p=b.blu){
594 print(" b%.2uX", *p);602 print(" b%.2uX", *p);
595 b.blu += b.delta;603 b.blu += b.delta;
596 }604 }
@@ -624,19 +632,23 @@ alphadraw(Memdrawparam *par) · 27 unmodified lines
624{632{
625 int isgrey, starty, endy, op;633 int isgrey, starty, endy, op;
626 int needbuf, dsty, srcy, masky;634 int needbuf, dsty, srcy, masky;
627 int y, dir, dx, dy;635 int y, dir, dx, dy, ndrawbuf;
636 uchar *drawbuf;
628 Buffer bsrc, bdst, bmask;637 Buffer bsrc, bdst, bmask;
629 Readfn *rdsrc, *rdmask, *rddst;638 Readfn *rdsrc, *rdmask, *rddst;
630 Calcfn *calc;639 Calcfn *calc;
631 Writefn *wrdst;640 Writefn *wrdst;
632 Memimage *src, *mask, *dst;641 Memimage *src, *mask, *dst;
633 Rectangle r, sr, mr;642 Rectangle r, sr, mr;
643 Dbuf *z;
634 644
635 r = par->r;645 r = par->r;
636 dx = Dx(r);646 dx = Dx(r);
637 dy = Dy(r);647 dy = Dy(r);
638 648
639 ndrawbuf = 0;649 z = allocdbuf();
650 if(z == nil)
651 return 0;
640 652
641 src = par->src;653 src = par->src;
642 mask = par->mask; 654 mask = par->mask;
@@ -655,12 +667,13 @@ alphadraw(Memdrawparam *par) · 12 unmodified lines
655 */667 */
656 needbuf = (src->data == dst->data);668 needbuf = (src->data == dst->data);
657 669
658 spar = getparam(src, sr, isgrey, needbuf);670 ndrawbuf = 0;
659 dpar = getparam(dst, r, isgrey, needbuf);671 getparam(&z->spar, src, sr, isgrey, needbuf, &ndrawbuf);
660 mpar = getparam(mask, mr, 0, needbuf);672 getparam(&z->dpar, dst, r, isgrey, needbuf, &ndrawbuf);
673 getparam(&z->mpar, mask, mr, 0, needbuf, &ndrawbuf);
661 674
662 dir = (needbuf && byteaddr(dst, r.min) > byteaddr(src, sr.min)) ? -1 : 1;675 dir = (needbuf && byteaddr(dst, r.min) > byteaddr(src, sr.min)) ? -1 : 1;
663 spar.dir = mpar.dir = dpar.dir = dir;676 z->spar.dir = z->mpar.dir = z->dpar.dir = dir;
664 677
665 /*678 /*
666 * If the mask is purely boolean, we can convert from src to dst format679 * If the mask is purely boolean, we can convert from src to dst format
@@ -680,7 +693,7 @@ alphadraw(Memdrawparam *par) · 13 unmodified lines
680//if(drawdebug) iprint("flag %lud mchan %lux=?%x dd %d\n", src->flags&Falpha, mask->chan, GREY1, dst->depth);693//if(drawdebug) iprint("flag %lud mchan %lux=?%x dd %d\n", src->flags&Falpha, mask->chan, GREY1, dst->depth);
681 if(!(src->flags&Falpha) && mask->chan == GREY1 && dst->depth >= 8 && op == SoverD){694 if(!(src->flags&Falpha) && mask->chan == GREY1 && dst->depth >= 8 && op == SoverD){
682//if(drawdebug) iprint("boolcopy...");695//if(drawdebug) iprint("boolcopy...");
683 rdsrc = convfn(dst, &dpar, src, &spar);696 rdsrc = convfn(dst, &z->dpar, src, &z->spar, &ndrawbuf);
684 rddst = readptr;697 rddst = readptr;
685 rdmask = readfn(mask);698 rdmask = readfn(mask);
686 calc = boolcopyfn(dst, mask);699 calc = boolcopyfn(dst, mask);
@@ -698,10 +711,10 @@ alphadraw(Memdrawparam *par) · 11 unmodified lines
698 */711 */
699 if(mask->flags&Falpha){712 if(mask->flags&Falpha){
700 rdmask = readalphafn(mask);713 rdmask = readalphafn(mask);
701 mpar.alphaonly = 1;714 z->mpar.alphaonly = 1;
702 }else{715 }else{
703 mpar.greymaskcall = readfn(mask);716 z->mpar.greymaskcall = readfn(mask);
704 mpar.convgrey = 1;717 z->mpar.convgrey = 1;
705 rdmask = greymaskread;718 rdmask = greymaskread;
706 719
707 /*720 /*
@@ -723,27 +736,34 @@ alphadraw(Memdrawparam *par) · 15 unmodified lines
723 * If the image has a small enough repl rectangle,736 * If the image has a small enough repl rectangle,
724 * we can just read each line once and cache them.737 * we can just read each line once and cache them.
725 */738 */
726 if(spar.replcache){739 if(z->spar.replcache){
727 spar.replcall = rdsrc;740 z->spar.replcall = rdsrc;
728 rdsrc = replread;741 rdsrc = replread;
729 }742 }
730 if(mpar.replcache){743 if(z->mpar.replcache){
731 mpar.replcall = rdmask;744 z->mpar.replcall = rdmask;
732 rdmask = replread;745 rdmask = replread;
733 }746 }
734 747
735 if(allocdrawbuf() < 0)748 if(z->n < ndrawbuf){
736 return 0;749 free(z->p);
750 if((z->p = mallocz(ndrawbuf, 0)) == nil){
751 z->inuse = 0;
752 return 0;
753 }
754 z->n = ndrawbuf;
755 }
756 drawbuf = z->p;
737 757
738 /*758 /*
739 * Before we were saving only offsets from drawbuf in the parameter759 * Before we were saving only offsets from drawbuf in the parameter
740 * structures; now that drawbuf has been grown to accomodate us,760 * structures; now that drawbuf has been grown to accomodate us,
741 * we can fill in the pointers.761 * we can fill in the pointers.
742 */762 */
743 spar.bufbase = drawbuf+spar.bufoff;763 z->spar.bufbase = drawbuf+z->spar.bufoff;
744 mpar.bufbase = drawbuf+mpar.bufoff;764 z->mpar.bufbase = drawbuf+z->mpar.bufoff;
745 dpar.bufbase = drawbuf+dpar.bufoff;765 z->dpar.bufbase = drawbuf+z->dpar.bufoff;
746 spar.convbuf = drawbuf+spar.convbufoff;766 z->spar.convbuf = drawbuf+z->spar.convbufoff;
747 767
748 if(dir == 1){768 if(dir == 1){
749 starty = 0;769 starty = 0;
@@ -771,18 +791,19 @@ alphadraw(Memdrawparam *par) · 21 unmodified lines
771 clipy(dst, &dsty);791 clipy(dst, &dsty);
772 clipy(mask, &masky);792 clipy(mask, &masky);
773 793
774 bsrc = rdsrc(&spar, spar.bufbase, srcy);794 bsrc = rdsrc(&z->spar, z->spar.bufbase, srcy);
775DBG print("[");795DBG print("[");
776 bmask = rdmask(&mpar, mpar.bufbase, masky);796 bmask = rdmask(&z->mpar, z->mpar.bufbase, masky);
777DBG print("]\n");797DBG print("]\n");
778 bdst = rddst(&dpar, dpar.bufbase, dsty);798 bdst = rddst(&z->dpar, z->dpar.bufbase, dsty);
779DBG dumpbuf("src", bsrc, dx);799DBG dumpbuf("src", bsrc, dx);
780DBG dumpbuf("mask", bmask, dx);800DBG dumpbuf("mask", bmask, dx);
781DBG dumpbuf("dst", bdst, dx);801DBG dumpbuf("dst", bdst, dx);
782 bdst = calc(bdst, bsrc, bmask, dx, isgrey, op);802 bdst = calc(bdst, bsrc, bmask, dx, isgrey, op);
783 wrdst(&dpar, dpar.bytermin+dsty*dpar.bwidth, bdst);803 wrdst(&z->dpar, z->dpar.bytermin+dsty*z->dpar.bwidth, bdst);
784 }804 }
785 805
806 z->inuse = 0;
786 return 1;807 return 1;
787}808}
788#undef DBG809#undef DBG
@@ -1344,7 +1365,7 @@ readnbit(Param *p, uchar *buf, int y) · 555 unmodified lines
1344DBG print("readnbit dx %d %p=%p+%d*%d, *r=%d fetch %d ", dx, r, p->bytermin, y, p->bwidth, *r, n);1365DBG print("readnbit dx %d %p=%p+%d*%d, *r=%d fetch %d ", dx, r, p->bytermin, y, p->bwidth, *r, n);
1345 bits = *r++;1366 bits = *r++;
1346 nbits = 8;1367 nbits = 8;
1347 if((i=x&(npack-1))){1368 if(i=x&(npack-1)){
1348DBG print("throwaway %d...", i);1369DBG print("throwaway %d...", i);
1349 bits <<= depth*i;1370 bits <<= depth*i;
1350 nbits -= depth*i;1371 nbits -= depth*i;
@@ -1376,7 +1397,7 @@ DBG print("bit %x...", repl[bits>>sh]); · 25 unmodified lines
1376DBG print("x=%d r=%p...", x, r);1397DBG print("x=%d r=%p...", x, r);
1377 bits = *r++;1398 bits = *r++;
1378 nbits = 8;1399 nbits = 8;
1379 if((i=x&(npack-1))){1400 if(i=x&(npack-1)){
1380 bits <<= depth*i;1401 bits <<= depth*i;
1381 nbits -= depth*i;1402 nbits -= depth*i;
1382 }1403 }
@@ -1461,7 +1482,7 @@ readcmap(Param *p, uchar *buf, int y) · 78 unmodified lines
1461 end = p->bytey0e + y*p->bwidth;1482 end = p->bytey0e + y*p->bwidth;
1462 cmap = p->img->cmap->cmap2rgb;1483 cmap = p->img->cmap->cmap2rgb;
1463 convgrey = p->convgrey;1484 convgrey = p->convgrey;
1464 copyalpha = (p->img->flags&Falpha) ? 1 : 0;1485 copyalpha = (p->img->flags&Falpha) != 0;
1465 1486
1466 w = buf;1487 w = buf;
1467 dx = p->dx;1488 dx = p->dx;
@@ -1518,8 +1539,8 @@ readcmap(Param *p, uchar *buf, int y) · 50 unmodified lines
1518static void1539static void
1519writecmap(Param *p, uchar *w, Buffer src)1540writecmap(Param *p, uchar *w, Buffer src)
1520{1541{
1521 uchar *cmap, *red, *grn, *blu;1542 uchar *cmap, *red, *grn, *blu, *alpha;
1522 int i, dx, delta;1543 int i, dx, delta, a, m;
1523 1544
1524 cmap = p->img->cmap->rgb2cmap;1545 cmap = p->img->cmap->rgb2cmap;
1525 1546
@@ -1529,8 +1550,20 @@ writecmap(Param *p, uchar *w, Buffer src) · 3 unmodified lines
1529 blu = src.blu;1550 blu = src.blu;
1530 1551
1531 dx = p->dx;1552 dx = p->dx;
1532 for(i=0; i<dx; i++, red+=delta, grn+=delta, blu+=delta)1553 if(p->img->flags&Falpha){
1533 *w++ = cmap[(*red>>4)*256+(*grn>>4)*16+(*blu>>4)];1554 alpha = src.alpha;
1555 m = p->img->shift[CMap]/8;
1556 a = p->img->shift[CAlpha]/8;
1557 for(i=0; i<dx; i++, red+=delta, grn+=delta, blu+=delta, w+=2){
1558 w[a] = *alpha;
1559 if(alpha != &ones)
1560 alpha+=delta;
1561 w[m] = cmap[(*red>>4)*256+(*grn>>4)*16+(*blu>>4)];
1562 }
1563 } else {
1564 for(i=0; i<dx; i++, red+=delta, grn+=delta, blu+=delta)
1565 *w++ = cmap[(*red>>4)*256+(*grn>>4)*16+(*blu>>4)];
1566 }
1534}1567}
1535 1568
1536#define DBG if(0)1569#define DBG if(0)
@@ -1556,7 +1589,7 @@ readbyte(Param *p, uchar *buf, int y) · 19 unmodified lines
1556 convgrey = p->convgrey; /* convert rgb to grey */1589 convgrey = p->convgrey; /* convert rgb to grey */
1557 isgrey = img->flags&Fgrey;1590 isgrey = img->flags&Fgrey;
1558 alphaonly = p->alphaonly;1591 alphaonly = p->alphaonly;
1559 copyalpha = (img->flags&Falpha) ? 1 : 0;1592 copyalpha = (img->flags&Falpha) != 0;
1560 1593
1561DBG print("copyalpha %d alphaonly %d convgrey %d isgrey %d\n", copyalpha, alphaonly, convgrey, isgrey);1594DBG print("copyalpha %d alphaonly %d convgrey %d isgrey %d\n", copyalpha, alphaonly, convgrey, isgrey);
1562 /* if we can, avoid processing everything */1595 /* if we can, avoid processing everything */
@@ -1608,16 +1641,17 @@ DBG print("g %x %x %x\n", ured, ugrn, ublu); · 45 unmodified lines
1608 *w++ = RGB2K(ured, ugrn, ublu);1641 *w++ = RGB2K(ured, ugrn, ublu);
1609DBG print("%x\n", w[-1]);1642DBG print("%x\n", w[-1]);
1610 }else{1643 }else{
1611 *w++ = brepl[(u >> img->shift[CBlue]) & img->mask[CBlue]];1644 w[0] = ublu;
1612 *w++ = grepl[(u >> img->shift[CGreen]) & img->mask[CGreen]];1645 w[1] = ugrn;
1613 *w++ = rrepl[(u >> img->shift[CRed]) & img->mask[CRed]];1646 w[2] = ured;
1647 w += 3;
1614 }1648 }
1615 }1649 }
1616 r += nb;1650 r += nb;
1617 if(r == end)1651 if(r == end)
1618 r = begin;1652 r = begin;
1619 }1653 }
1620 1654
1621 b.alpha = copyalpha ? buf : &ones;1655 b.alpha = copyalpha ? buf : &ones;
1622 b.rgba = (ulong*)buf;1656 b.rgba = (ulong*)buf;
1623 if(alphaonly){1657 if(alphaonly){
@@ -1629,7 +1663,7 @@ DBG print("%x\n", w[-1]); · 5 unmodified lines
1629 b.grey = buf+copyalpha;1663 b.grey = buf+copyalpha;
1630 b.red = b.grn = b.blu = buf+copyalpha;1664 b.red = b.grn = b.blu = buf+copyalpha;
1631 b.delta = copyalpha+1;1665 b.delta = copyalpha+1;
1632DBG print("alpha %x grey %x\n", b.alpha ? *b.alpha : 0xFF, *b.grey);1666DBG print("alpha %x grey %x\n", *b.alpha, *b.grey);
1633 }else{1667 }else{
1634 b.blu = buf+copyalpha;1668 b.blu = buf+copyalpha;
1635 b.grn = buf+copyalpha+1;1669 b.grn = buf+copyalpha+1;
@@ -1647,7 +1681,7 @@ writebyte(Param *p, uchar *w, Buffer src) · 11 unmodified lines
1647{1681{
1648 Memimage *img;1682 Memimage *img;
1649 int i, isalpha, isgrey, nb, delta, dx, adelta;1683 int i, isalpha, isgrey, nb, delta, dx, adelta;
1650 uchar ff, *red, *grn, *blu, *grey, *alpha;1684 uchar *red, *grn, *blu, *grey, *alpha;
1651 ulong u, mask;1685 ulong u, mask;
1652 1686
1653 img = p->img;1687 img = p->img;
@@ -1661,18 +1695,45 @@ writebyte(Param *p, uchar *w, Buffer src) · 7 unmodified lines
1661 dx = p->dx;1695 dx = p->dx;
1662 1696
1663 nb = img->depth/8;1697 nb = img->depth/8;
1664 mask = (nb==4) ? 0 : ~((1<<img->depth)-1);
1665 1698
1666 isalpha = img->flags&Falpha;1699 isalpha = img->flags&Falpha;
1667 isgrey = img->flags&Fgrey;1700 isgrey = img->flags&Fgrey;
1668 adelta = src.delta;1701 adelta = src.delta;
1669 1702
1670 if(isalpha && (alpha == nil || alpha == &ones)){1703 if(isalpha && alpha == &ones)
1671 ff = 0xFF;
1672 alpha = &ff;
1673 adelta = 0;1704 adelta = 0;
1705
1706 if((img->flags&Fbytes) != 0){
1707 int ogry, ored, ogrn, oblu, oalp;
1708
1709 ogry = img->shift[CGrey]/8;
1710 ored = img->shift[CRed]/8;
1711 ogrn = img->shift[CGreen]/8;
1712 oblu = img->shift[CBlue]/8;
1713 oalp = img->shift[CAlpha]/8;
1714
1715 for(i=0; i<dx; i++){
1716 if(isgrey){
1717 w[ogry] = *grey;
1718 grey += delta;
1719 } else {
1720 w[ored] = *red;
1721 w[ogrn] = *grn;
1722 w[oblu] = *blu;
1723 red += delta;
1724 grn += delta;
1725 blu += delta;
1726 }
1727 if(isalpha){
1728 w[oalp] = *alpha;
1729 alpha += adelta;
1730 }
1731 w += nb;
1732 }
1733 return;
1674 }1734 }
1675 1735
1736 mask = (nb==4) ? 0 : ~((1<<img->depth)-1);
1676 for(i=0; i<dx; i++){1737 for(i=0; i<dx; i++){
1677 u = w[0] | (w[1]<<8) | (w[2]<<16) | (w[3]<<24);1738 u = w[0] | (w[1]<<8) | (w[2]<<16) | (w[3]<<24);
1678DBG print("u %.8lux...", u);1739DBG print("u %.8lux...", u);
@@ -1729,7 +1790,7 @@ writefn(Memimage *img) · 50 unmodified lines
1729{1790{
1730 if(img->depth < 8)1791 if(img->depth < 8)
1731 return writenbit;1792 return writenbit;
1732 if(img->chan == CMAP8)1793 if(img->nbits[CMap] == 8)
1733 return writecmap;1794 return writecmap;
1734 return writebyte;1795 return writebyte;
1735}1796}
@@ -1750,7 +1811,8 @@ readptr(Param *p, uchar *s, int y) · 14 unmodified lines
1750 USED(s);1811 USED(s);
1751 q = p->bytermin + y*p->bwidth;1812 q = p->bytermin + y*p->bwidth;
1752 b.red = q; /* ptr to data */1813 b.red = q; /* ptr to data */
1753 b.grn = b.blu = b.grey = b.alpha = nil;1814 b.grn = b.blu = b.grey = nil;
1815 b.alpha = &ones;
1754 b.rgba = (ulong*)q;1816 b.rgba = (ulong*)q;
1755 b.delta = p->img->depth/8;1817 b.delta = p->img->depth/8;
1756 return b;1818 return b;
@@ -1866,7 +1928,8 @@ genconv(Param *p, uchar *buf, int y) · 109 unmodified lines
1866 }1928 }
1867 1929
1868 b.red = buf;1930 b.red = buf;
1869 b.blu = b.grn = b.grey = b.alpha = nil;1931 b.blu = b.grn = b.grey = nil;
1932 b.alpha = &ones;
1870 b.rgba = (ulong*)buf;1933 b.rgba = (ulong*)buf;
1871 b.delta = 0;1934 b.delta = 0;
1872 1935
@@ -1874,7 +1937,7 @@ genconv(Param *p, uchar *buf, int y) · 1 unmodified line
1874}1937}
1875 1938
1876static Readfn*1939static Readfn*
1877convfn(Memimage *dst, Param *dpar, Memimage *src, Param *spar)1940convfn(Memimage *dst, Param *dpar, Memimage *src, Param *spar, int *ndrawbuf)
1878{1941{
1879 if(dst->chan == src->chan && !(src->flags&Frepl)){1942 if(dst->chan == src->chan && !(src->flags&Frepl)){
1880//if(drawdebug) iprint("readptr...");1943//if(drawdebug) iprint("readptr...");
@@ -1892,8 +1955,8 @@ convfn(Memimage *dst, Param *dpar, Memimage *src, Param *spar) · 11 unmodified lines
1892 spar->convdpar = dpar;1955 spar->convdpar = dpar;
1893 1956
1894 /* allocate a conversion buffer */1957 /* allocate a conversion buffer */
1895 spar->convbufoff = ndrawbuf;1958 spar->convbufoff = *ndrawbuf;
1896 ndrawbuf += spar->dx*4;1959 *ndrawbuf += spar->dx*4;
1897 1960
1898 if(spar->dx > Dx(spar->img->r)){1961 if(spar->dx > Dx(spar->img->r)){
1899 spar->convdx = spar->dx;1962 spar->convdx = spar->dx;
@@ -1905,7 +1968,7 @@ convfn(Memimage *dst, Param *dpar, Memimage *src, Param *spar) · 5 unmodified lines
1905}1968}
1906 1969
1907ulong1970ulong
1908_pixelbits(Memimage *i, Point pt)1971pixelbits(Memimage *i, Point pt)
1909{1972{
1910 uchar *p;1973 uchar *p;
1911 ulong val;1974 ulong val;
@@ -1965,23 +2028,17 @@ boolcopyfn(Memimage *img, Memimage *mask) · 53 unmodified lines
1965 2028
1966/*2029/*
1967 * Optimized draw for filling and scrolling; uses memset and memmove.2030 * Optimized draw for filling and scrolling; uses memset and memmove.
1968 *2031 */
1969static void
1970memsetb(void *vp, uchar val, int n)
1971{
1972 uchar *p, *ep;
1973
1974 p = vp;
1975 ep = p+n;
1976 while(p<ep)
1977 *p++ = val;
1978}
1979*/
1980
1981static void2032static void
1982memsets(void *vp, ushort val, int n)2033memsets(void *vp, ushort val, int n)
1983{2034{
1984 ushort *p, *ep;2035 ushort *p, *ep;
2036 uchar b[2];
2037
2038 /* make little endian */
2039 b[0] = val;
2040 b[1] = val>>8;
2041 val = *(ushort*)b;
1985 2042
1986 p = vp;2043 p = vp;
1987 ep = p+n;2044 ep = p+n;
@@ -1993,6 +2050,14 @@ static void · 5 unmodified lines
1993memsetl(void *vp, ulong val, int n)2050memsetl(void *vp, ulong val, int n)
1994{2051{
1995 ulong *p, *ep;2052 ulong *p, *ep;
2053 uchar b[4];
2054
2055 /* make little endian */
2056 b[0] = val;
2057 b[1] = val>>8;
2058 b[2] = val>>16;
2059 b[3] = val>>24;
2060 val = *(ulong*)b;
1996 2061
1997 p = vp;2062 p = vp;
1998 ep = p+n;2063 ep = p+n;
@@ -2006,20 +2071,22 @@ memset24(void *vp, ulong val, int n) · 7 unmodified lines
2006 uchar *p, *ep;2071 uchar *p, *ep;
2007 uchar a,b,c;2072 uchar a,b,c;
2008 2073
2009 p = vp;
2010 ep = p+3*n;
2011 a = val;2074 a = val;
2012 b = val>>8;2075 b = val>>8;
2013 c = val>>16;2076 c = val>>16;
2077
2078 p = vp;
2079 ep = p+3*n;
2014 while(p<ep){2080 while(p<ep){
2015 *p++ = a;2081 p[0] = a;
2016 *p++ = b;2082 p[1] = b;
2017 *p++ = c;2083 p[2] = c;
2084 p += 3;
2018 }2085 }
2019}2086}
2020 2087
2021ulong2088static ulong
2022_imgtorgba(Memimage *img, ulong val)2089imgtorgba(Memimage *img, ulong val)
2023{2090{
2024 uchar r, g, b, a;2091 uchar r, g, b, a;
2025 int nb, ov, v;2092 int nb, ov, v;
@@ -2057,17 +2124,17 @@ _imgtorgba(Memimage *img, ulong val) · 31 unmodified lines
2057 break;2124 break;
2058 case CMap:2125 case CMap:
2059 p = img->cmap->cmap2rgb+3*ov;2126 p = img->cmap->cmap2rgb+3*ov;
2060 r = *p++;2127 r = p[0];
2061 g = *p++; 2128 g = p[1];
2062 b = *p;2129 b = p[2];
2063 break;2130 break;
2064 }2131 }
2065 }2132 }
2066 return (r<<24)|(g<<16)|(b<<8)|a; 2133 return (r<<24)|(g<<16)|(b<<8)|a;
2067}2134}
2068 2135
2069ulong2136static ulong
2070_rgbatoimg(Memimage *img, ulong rgba)2137rgbatoimg(Memimage *img, ulong rgba)
2071{2138{
2072 ulong chan;2139 ulong chan;
2073 int d, nb;2140 int d, nb;
@@ -2133,9 +2200,8 @@ DBG print("state %lux mval %lux dd %d\n", par->state, par->mval, dst->depth); · 59 unmodified lines
2133 */2200 */
2134 m = Simplesrc|Simplemask|Fullmask;2201 m = Simplesrc|Simplemask|Fullmask;
2135 if((par->state&m)==m && (par->srgba&0xFF) == 0xFF && (op ==S || op == SoverD)){2202 if((par->state&m)==m && (par->srgba&0xFF) == 0xFF && (op ==S || op == SoverD)){
2136 uchar *dp, p[4];
2137 int d, dwid, ppb, np, nb;2203 int d, dwid, ppb, np, nb;
2138 uchar lm, rm;2204 uchar *dp, lm, rm;
2139 2205
2140DBG print("memopt, dst %p, dst->data->bdata %p\n", dst, dst->data->bdata);2206DBG print("memopt, dst %p, dst->data->bdata %p\n", dst, dst->data->bdata);
2141 dwid = dst->width*sizeof(ulong);2207 dwid = dst->width*sizeof(ulong);
@@ -2204,11 +2270,6 @@ DBG print("dp %p v %lux lm %ux (v ^ *dp) & lm %lux\n", dp, v, lm, (v^*dp)&lm); · 62 unmodified lines
2204 memset(dp, v, dx);2270 memset(dp, v, dx);
2205 return 1;2271 return 1;
2206 case 16:2272 case 16:
2207 p[0] = v; /* make little endian */
2208 p[1] = v>>8;
2209 v = *(ushort*)p;
2210DBG print("dp=%p; dx=%d; for(y=0; y<%d; y++, dp+=%d)\nmemsets(dp, v, dx);\n",
2211 dp, dx, dy, dwid);
2212 for(y=0; y<dy; y++, dp+=dwid)2273 for(y=0; y<dy; y++, dp+=dwid)
2213 memsets(dp, v, dx);2274 memsets(dp, v, dx);
2214 return 1;2275 return 1;
@@ -2217,11 +2278,6 @@ DBG print("dp=%p; dx=%d; for(y=0; y<%d; y++, dp+=%d)\nmemsets(dp, v, dx);\n", · 2 unmodified lines
2217 memset24(dp, v, dx);2278 memset24(dp, v, dx);
2218 return 1;2279 return 1;
2219 case 32:2280 case 32:
2220 p[0] = v; /* make little endian */
2221 p[1] = v>>8;
2222 p[2] = v>>16;
2223 p[3] = v>>24;
2224 v = *(ulong*)p;
2225 for(y=0; y<dy; y++, dp+=dwid)2281 for(y=0; y<dy; y++, dp+=dwid)
2226 memsetl(dp, v, dx);2282 memsetl(dp, v, dx);
2227 return 1;2283 return 1;
@@ -2370,9 +2426,8 @@ DBG print("dp=%p; dx=%d; for(y=0; y<%d; y++, dp+=%d)\nmemsets(dp, v, dx);\n", · 142 unmodified lines
2370static int2426static int
2371chardraw(Memdrawparam *par)2427chardraw(Memdrawparam *par)
2372{2428{
2373 ulong bits;
2374 int i, ddepth, dy, dx, x, bx, ex, y, npack, bsh, depth, op;2429 int i, ddepth, dy, dx, x, bx, ex, y, npack, bsh, depth, op;
2375 ulong v, maskwid, dstwid;2430 ulong bits, v, maskwid, dstwid;
2376 uchar *wp, *rp, *q, *wc;2431 uchar *wp, *rp, *q, *wc;
2377 ushort *ws;2432 ushort *ws;
2378 ulong *wl;2433 ulong *wl;
@@ -2513,7 +2568,7 @@ membyteval(Memimage *src) · 134 unmodified lines
2513 bpp = src->depth;2568 bpp = src->depth;
2514 uc <<= (src->r.min.x&(7/src->depth))*src->depth;2569 uc <<= (src->r.min.x&(7/src->depth))*src->depth;
2515 uc &= ~(0xFF>>bpp);2570 uc &= ~(0xFF>>bpp);
2516 // pixel value is now in high part of byte. repeat throughout byte 2571 /* pixel value is now in high part of byte. repeat throughout byte
2517 val = uc;2572 val = uc;
2518 for(i=bpp; i<8; i<<=1)2573 for(i=bpp; i<8; i<<=1)
2519 val |= val>>i;2574 val |= val>>i;
@@ -2523,7 +2578,7 @@ membyteval(Memimage *src) · 3 unmodified lines
2523 */2578 */
2524 2579
2525void2580void
2526_memfillcolor(Memimage *i, ulong val)2581memfillcolor(Memimage *i, ulong val)
2527{2582{
2528 ulong bits;2583 ulong bits;
2529 int d, y;2584 int d, y;
@@ -2531,7 +2586,7 @@ _memfillcolor(Memimage *i, ulong val) · 1 unmodified line
2531 if(val == DNofill)2586 if(val == DNofill)
2532 return;2587 return;
2533 2588
2534 bits = _rgbatoimg(i, val);2589 bits = rgbatoimg(i, val);
2535 switch(i->depth){2590 switch(i->depth){
2536 case 24: /* 24-bit images suck */2591 case 24: /* 24-bit images suck */
2537 for(y=i->r.min.y; y<i->r.max.y; y++)2592 for(y=i->r.min.y; y<i->r.max.y; y++)
libmemdraw/drawtest.c+0−1004
@@ -1,1004 +0,0 @@
1#include <u.h>
2#include <libc.h>
3#include <bio.h>
4#include <draw.h>
5#include <memdraw.h>
6
7#define DBG if(0)
8#define RGB2K(r,g,b) ((299*((ulong)(r))+587*((ulong)(g))+114*((ulong)(b)))/1000)
9
10/*
11 * This program tests the 'memimagedraw' primitive stochastically.
12 * It tests the combination aspects of it thoroughly, but since the
13 * three images it uses are disjoint, it makes no check of the
14 * correct behavior when images overlap. That is, however, much
15 * easier to get right and to test.
16 */
17
18void drawonepixel(Memimage*, Point, Memimage*, Point, Memimage*, Point);
19void verifyone(void);
20void verifyline(void);
21void verifyrect(void);
22void verifyrectrepl(int, int);
23void putpixel(Memimage *img, Point pt, ulong nv);
24ulong rgbatopix(uchar, uchar, uchar, uchar);
25
26char *dchan, *schan, *mchan;
27int dbpp, sbpp, mbpp;
28
29int drawdebug=0;
30int seed;
31int niters = 100;
32int dbpp; /* bits per pixel in destination */
33int sbpp; /* bits per pixel in src */
34int mbpp; /* bits per pixel in mask */
35int dpm; /* pixel mask at high part of byte, in destination */
36int nbytes; /* in destination */
37
38int Xrange = 64;
39int Yrange = 8;
40
41Memimage *dst;
42Memimage *src;
43Memimage *mask;
44Memimage *stmp;
45Memimage *mtmp;
46Memimage *ones;
47uchar *dstbits;
48uchar *srcbits;
49uchar *maskbits;
50ulong *savedstbits;
51
52void
53rdb(void)
54{
55}
56
57int
58iprint(char *fmt, ...)
59{
60 int n;
61 va_list va;
62 char buf[1024];
63
64 va_start(va, fmt);
65 n = doprint(buf, buf+sizeof buf, fmt, va) - buf;
66 va_end(va);
67
68 write(1,buf,n);
69 return 1;
70}
71
72void
73main(int argc, char *argv[])
74{
75 memimageinit();
76 seed = time(0);
77
78 ARGBEGIN{
79 case 'x':
80 Xrange = atoi(ARGF());
81 break;
82 case 'y':
83 Yrange = atoi(ARGF());
84 break;
85 case 'n':
86 niters = atoi(ARGF());
87 break;
88 case 's':
89 seed = atoi(ARGF());
90 break;
91 }ARGEND
92
93 dchan = "r8g8b8";
94 schan = "r8g8b8";
95 mchan = "r8g8b8";
96 switch(argc){
97 case 3: mchan = argv[2];
98 case 2: schan = argv[1];
99 case 1: dchan = argv[0];
100 case 0: break;
101 default: goto Usage;
102 Usage:
103 fprint(2, "usage: dtest [dchan [schan [mchan]]]\n");
104 exits("usage");
105 }
106
107 fmtinstall('b', numbconv); /* binary! */
108
109 fprint(2, "%s -x %d -y %d -s 0x%x %s %s %s\n", argv0, Xrange, Yrange, seed, dchan, schan, mchan);
110 srand(seed);
111
112 dst = allocmemimage(Rect(0, 0, Xrange, Yrange), strtochan(dchan));
113 src = allocmemimage(Rect(0, 0, Xrange, Yrange), strtochan(schan));
114 mask = allocmemimage(Rect(0, 0, Xrange, Yrange), strtochan(mchan));
115 stmp = allocmemimage(Rect(0, 0, Xrange, Yrange), strtochan(schan));
116 mtmp = allocmemimage(Rect(0, 0, Xrange, Yrange), strtochan(mchan));
117 ones = allocmemimage(Rect(0, 0, Xrange, Yrange), strtochan(mchan));
118// print("chan %lux %lux %lux %lux %lux %lux\n", dst->chan, src->chan, mask->chan, stmp->chan, mtmp->chan, ones->chan);
119 if(dst==0 || src==0 || mask==0 || mtmp==0 || ones==0) {
120 Alloc:
121 fprint(2, "dtest: allocation failed: %r\n");
122 exits("alloc");
123 }
124 nbytes = (4*Xrange+4)*Yrange;
125 srcbits = malloc(nbytes);
126 dstbits = malloc(nbytes);
127 maskbits = malloc(nbytes);
128 savedstbits = malloc(nbytes);
129 if(dstbits==0 || srcbits==0 || maskbits==0 || savedstbits==0)
130 goto Alloc;
131 dbpp = dst->depth;
132 sbpp = src->depth;
133 mbpp = mask->depth;
134 dpm = 0xFF ^ (0xFF>>dbpp);
135 memset(ones->data->bdata, 0xFF, ones->width*sizeof(ulong)*Yrange);
136
137
138 fprint(2, "dtest: verify single pixel operation\n");
139 verifyone();
140
141 fprint(2, "dtest: verify full line non-replicated\n");
142 verifyline();
143
144 fprint(2, "dtest: verify full rectangle non-replicated\n");
145 verifyrect();
146
147 fprint(2, "dtest: verify full rectangle source replicated\n");
148 verifyrectrepl(1, 0);
149
150 fprint(2, "dtest: verify full rectangle mask replicated\n");
151 verifyrectrepl(0, 1);
152
153 fprint(2, "dtest: verify full rectangle source and mask replicated\n");
154 verifyrectrepl(1, 1);
155
156 exits(0);
157}
158
159/*
160 * Dump out an ASCII representation of an image. The label specifies
161 * a list of characters to put at various points in the picture.
162 */
163static void
164Bprintr5g6b5(Biobuf *bio, char*, ulong v)
165{
166 int r,g,b;
167 r = (v>>11)&31;
168 g = (v>>5)&63;
169 b = v&31;
170 Bprint(bio, "%.2x%.2x%.2x", r,g,b);
171}
172
173static void
174Bprintr5g5b5a1(Biobuf *bio, char*, ulong v)
175{
176 int r,g,b,a;
177 r = (v>>11)&31;
178 g = (v>>6)&31;
179 b = (v>>1)&31;
180 a = v&1;
181 Bprint(bio, "%.2x%.2x%.2x%.2x", r,g,b,a);
182}
183
184void
185dumpimage(char *name, Memimage *img, void *vdata, Point labelpt)
186{
187 Biobuf b;
188 uchar *data;
189 uchar *p;
190 char *arg;
191 void (*fmt)(Biobuf*, char*, ulong);
192 int npr, x, y, nb, bpp;
193 ulong v, mask;
194 Rectangle r;
195
196 fmt = nil;
197 arg = nil;
198 switch(img->depth){
199 case 1:
200 case 2:
201 case 4:
202 fmt = (void(*)(Biobuf*,char*,ulong))Bprint;
203 arg = "%.1ux";
204 break;
205 case 8:
206 fmt = (void(*)(Biobuf*,char*,ulong))Bprint;
207 arg = "%.2ux";
208 break;
209 case 16:
210 arg = nil;
211 if(img->chan == RGB16)
212 fmt = Bprintr5g6b5;
213 else{
214 fmt = (void(*)(Biobuf*,char*,ulong))Bprint;
215 arg = "%.4ux";
216 }
217 break;
218 case 24:
219 fmt = (void(*)(Biobuf*,char*,ulong))Bprint;
220 arg = "%.6lux";
221 break;
222 case 32:
223 fmt = (void(*)(Biobuf*,char*,ulong))Bprint;
224 arg = "%.8lux";
225 break;
226 }
227 if(fmt == nil){
228 fprint(2, "bad format\n");
229 abort();
230 }
231
232 r = img->r;
233 Binit(&b, 2, OWRITE);
234 data = vdata;
235 bpp = img->depth;
236 Bprint(&b, "%s\t%d\tr %R clipr %R repl %d data %p *%P\n", name, r.min.x, r, img->clipr, (img->flags&Frepl) ? 1 : 0, vdata, labelpt);
237 mask = (1ULL<<bpp)-1;
238// for(y=r.min.y; y<r.max.y; y++){
239 for(y=0; y<Yrange; y++){
240 nb = 0;
241 v = 0;
242 p = data+(byteaddr(img, Pt(0,y))-(uchar*)img->data->bdata);
243 Bprint(&b, "%-4d\t", y);
244// for(x=r.min.x; x<r.max.x; x++){
245 for(x=0; x<Xrange; x++){
246 if(x==0)
247 Bprint(&b, "\t");
248
249 if(x != 0 && (x%8)==0)
250 Bprint(&b, " ");
251
252 npr = 0;
253 if(x==labelpt.x && y==labelpt.y){
254 Bprint(&b, "*");
255 npr++;
256 }
257 if(npr == 0)
258 Bprint(&b, " ");
259
260 while(nb < bpp){
261 v &= (1<<nb)-1;
262 v |= (ulong)(*p++) << nb;
263 nb += 8;
264 }
265 nb -= bpp;
266// print("bpp %d v %.8lux mask %.8lux nb %d\n", bpp, v, mask, nb);
267 fmt(&b, arg, (v>>nb)&mask);
268 }
269 Bprint(&b, "\n");
270 }
271 Bterm(&b);
272}
273
274/*
275 * Verify that the destination pixel has the specified value.
276 * The value is in the high bits of v, suitably masked, but must
277 * be extracted from the destination Memimage.
278 */
279void
280checkone(Point p, Point sp, Point mp)
281{
282 int delta;
283 uchar *dp, *sdp;
284
285 delta = (uchar*)byteaddr(dst, p)-(uchar*)dst->data->bdata;
286 dp = (uchar*)dst->data->bdata+delta;
287 sdp = (uchar*)savedstbits+delta;
288
289 if(memcmp(dp, sdp, (dst->depth+7)/8) != 0) {
290 fprint(2, "dtest: one bad pixel drawing at dst %P from source %P mask %P\n", p, sp, mp);
291 fprint(2, " %.2ux %.2ux %.2ux %.2ux should be %.2ux %.2ux %.2ux %.2ux\n",
292 dp[0], dp[1], dp[2], dp[3], sdp[0], sdp[1], sdp[2], sdp[3]);
293 fprint(2, "addresses dst %p src %p mask %p\n", dp, byteaddr(src, sp), byteaddr(mask, mp));
294 dumpimage("src", src, src->data->bdata, sp);
295 dumpimage("mask", mask, mask->data->bdata, mp);
296 dumpimage("origdst", dst, dstbits, p);
297 dumpimage("dst", dst, dst->data->bdata, p);
298 dumpimage("gooddst", dst, savedstbits, p);
299 abort();
300 }
301}
302
303/*
304 * Verify that the destination line has the same value as the saved line.
305 */
306#define RECTPTS(r) (r).min.x, (r).min.y, (r).max.x, (r).max.y
307void
308checkline(Rectangle r, Point sp, Point mp, int y, Memimage *stmp, Memimage *mtmp)
309{
310 ulong *dp;
311 int nb;
312 ulong *saved;
313
314 dp = wordaddr(dst, Pt(0, y));
315 saved = savedstbits + y*dst->width;
316 if(dst->depth < 8)
317 nb = Xrange/(8/dst->depth);
318 else
319 nb = Xrange*(dst->depth/8);
320 if(memcmp(dp, saved, nb) != 0){
321 fprint(2, "dtest: bad line at y=%d; saved %p dp %p\n", y, saved, dp);
322 fprint(2, "draw dst %R src %P mask %P\n", r, sp, mp);
323 dumpimage("src", src, src->data->bdata, sp);
324 if(stmp) dumpimage("stmp", stmp, stmp->data->bdata, sp);
325 dumpimage("mask", mask, mask->data->bdata, mp);
326 if(mtmp) dumpimage("mtmp", mtmp, mtmp->data->bdata, mp);
327 dumpimage("origdst", dst, dstbits, r.min);
328 dumpimage("dst", dst, dst->data->bdata, r.min);
329 dumpimage("gooddst", dst, savedstbits, r.min);
330 abort();
331 }
332}
333
334/*
335 * Fill the bits of an image with random data.
336 * The Memimage parameter is used only to make sure
337 * the data is well formatted: only ucbits is written.
338 */
339void
340fill(Memimage *img, uchar *ucbits)
341{
342 int i, x, y;
343 ushort *up;
344 uchar alpha, r, g, b;
345 void *data;
346
347 if((img->flags&Falpha) == 0){
348 up = (ushort*)ucbits;
349 for(i=0; i<nbytes/2; i++)
350 *up++ = lrand() >> 7;
351 if(i+i != nbytes)
352 *(uchar*)up = lrand() >> 7;
353 }else{
354 data = img->data->bdata;
355 img->data->bdata = ucbits;
356
357 for(x=img->r.min.x; x<img->r.max.x; x++)
358 for(y=img->r.min.y; y<img->r.max.y; y++){
359 alpha = rand() >> 4;
360 r = rand()%(alpha+1);
361 g = rand()%(alpha+1);
362 b = rand()%(alpha+1);
363 putpixel(img, Pt(x,y), rgbatopix(r,g,b,alpha));
364 }
365 img->data->bdata = data;
366 }
367
368}
369
370/*
371 * Mask is preset; do the rest
372 */
373void
374verifyonemask(void)
375{
376 Point dp, sp, mp;
377
378 fill(dst, dstbits);
379 fill(src, srcbits);
380 memmove(dst->data->bdata, dstbits, dst->width*sizeof(ulong)*Yrange);
381 memmove(src->data->bdata, srcbits, src->width*sizeof(ulong)*Yrange);
382 memmove(mask->data->bdata, maskbits, mask->width*sizeof(ulong)*Yrange);
383
384 dp.x = nrand(Xrange);
385 dp.y = nrand(Yrange);
386
387 sp.x = nrand(Xrange);
388 sp.y = nrand(Yrange);
389
390 mp.x = nrand(Xrange);
391 mp.y = nrand(Yrange);
392
393 drawonepixel(dst, dp, src, sp, mask, mp);
394 memmove(mask->data->bdata, maskbits, mask->width*sizeof(ulong)*Yrange);
395 memmove(savedstbits, dst->data->bdata, dst->width*sizeof(ulong)*Yrange);
396
397 memmove(dst->data->bdata, dstbits, dst->width*sizeof(ulong)*Yrange);
398 memimagedraw(dst, Rect(dp.x, dp.y, dp.x+1, dp.y+1), src, sp, mask, mp, SoverD);
399 memmove(mask->data->bdata, maskbits, mask->width*sizeof(ulong)*Yrange);
400
401 checkone(dp, sp, mp);
402}
403
404void
405verifyone(void)
406{
407 int i;
408
409 /* mask all zeros */
410 memset(maskbits, 0, nbytes);
411 for(i=0; i<niters; i++)
412 verifyonemask();
413
414 /* mask all ones */
415 memset(maskbits, 0xFF, nbytes);
416 for(i=0; i<niters; i++)
417 verifyonemask();
418
419 /* random mask */
420 for(i=0; i<niters; i++){
421 fill(mask, maskbits);
422 verifyonemask();
423 }
424}
425
426/*
427 * Mask is preset; do the rest
428 */
429void
430verifylinemask(void)
431{
432 Point sp, mp, tp, up;
433 Rectangle dr;
434 int x;
435
436 fill(dst, dstbits);
437 fill(src, srcbits);
438 memmove(dst->data->bdata, dstbits, dst->width*sizeof(ulong)*Yrange);
439 memmove(src->data->bdata, srcbits, src->width*sizeof(ulong)*Yrange);
440 memmove(mask->data->bdata, maskbits, mask->width*sizeof(ulong)*Yrange);
441
442 dr.min.x = nrand(Xrange-1);
443 dr.min.y = nrand(Yrange-1);
444 dr.max.x = dr.min.x + 1 + nrand(Xrange-1-dr.min.x);
445 dr.max.y = dr.min.y + 1;
446
447 sp.x = nrand(Xrange);
448 sp.y = nrand(Yrange);
449
450 mp.x = nrand(Xrange);
451 mp.y = nrand(Yrange);
452
453 tp = sp;
454 up = mp;
455 for(x=dr.min.x; x<dr.max.x && tp.x<Xrange && up.x<Xrange; x++,tp.x++,up.x++)
456 memimagedraw(dst, Rect(x, dr.min.y, x+1, dr.min.y+1), src, tp, mask, up, SoverD);
457 memmove(savedstbits, dst->data->bdata, dst->width*sizeof(ulong)*Yrange);
458
459 memmove(dst->data->bdata, dstbits, dst->width*sizeof(ulong)*Yrange);
460
461 memimagedraw(dst, dr, src, sp, mask, mp, SoverD);
462 checkline(dr, drawrepl(src->r, sp), drawrepl(mask->r, mp), dr.min.y, nil, nil);
463}
464
465void
466verifyline(void)
467{
468 int i;
469
470 /* mask all ones */
471 memset(maskbits, 0xFF, nbytes);
472 for(i=0; i<niters; i++)
473 verifylinemask();
474
475 /* mask all zeros */
476 memset(maskbits, 0, nbytes);
477 for(i=0; i<niters; i++)
478 verifylinemask();
479
480 /* random mask */
481 for(i=0; i<niters; i++){
482 fill(mask, maskbits);
483 verifylinemask();
484 }
485}
486
487/*
488 * Mask is preset; do the rest
489 */
490void
491verifyrectmask(void)
492{
493 Point sp, mp, tp, up;
494 Rectangle dr;
495 int x, y;
496
497 fill(dst, dstbits);
498 fill(src, srcbits);
499 memmove(dst->data->bdata, dstbits, dst->width*sizeof(ulong)*Yrange);
500 memmove(src->data->bdata, srcbits, src->width*sizeof(ulong)*Yrange);
501 memmove(mask->data->bdata, maskbits, mask->width*sizeof(ulong)*Yrange);
502
503 dr.min.x = nrand(Xrange-1);
504 dr.min.y = nrand(Yrange-1);
505 dr.max.x = dr.min.x + 1 + nrand(Xrange-1-dr.min.x);
506 dr.max.y = dr.min.y + 1 + nrand(Yrange-1-dr.min.y);
507
508 sp.x = nrand(Xrange);
509 sp.y = nrand(Yrange);
510
511 mp.x = nrand(Xrange);
512 mp.y = nrand(Yrange);
513
514 tp = sp;
515 up = mp;
516 for(y=dr.min.y; y<dr.max.y && tp.y<Yrange && up.y<Yrange; y++,tp.y++,up.y++){
517 for(x=dr.min.x; x<dr.max.x && tp.x<Xrange && up.x<Xrange; x++,tp.x++,up.x++)
518 memimagedraw(dst, Rect(x, y, x+1, y+1), src, tp, mask, up, SoverD);
519 tp.x = sp.x;
520 up.x = mp.x;
521 }
522 memmove(savedstbits, dst->data->bdata, dst->width*sizeof(ulong)*Yrange);
523
524 memmove(dst->data->bdata, dstbits, dst->width*sizeof(ulong)*Yrange);
525
526 memimagedraw(dst, dr, src, sp, mask, mp, SoverD);
527 for(y=0; y<Yrange; y++)
528 checkline(dr, drawrepl(src->r, sp), drawrepl(mask->r, mp), y, nil, nil);
529}
530
531void
532verifyrect(void)
533{
534 int i;
535
536 /* mask all zeros */
537 memset(maskbits, 0, nbytes);
538 for(i=0; i<niters; i++)
539 verifyrectmask();
540
541 /* mask all ones */
542 memset(maskbits, 0xFF, nbytes);
543 for(i=0; i<niters; i++)
544 verifyrectmask();
545
546 /* random mask */
547 for(i=0; i<niters; i++){
548 fill(mask, maskbits);
549 verifyrectmask();
550 }
551}
552
553Rectangle
554randrect(void)
555{
556 Rectangle r;
557
558 r.min.x = nrand(Xrange-1);
559 r.min.y = nrand(Yrange-1);
560 r.max.x = r.min.x + 1 + nrand(Xrange-1-r.min.x);
561 r.max.y = r.min.y + 1 + nrand(Yrange-1-r.min.y);
562 return r;
563}
564
565/*
566 * Return coordinate corresponding to x withing range [minx, maxx)
567 */
568int
569tilexy(int minx, int maxx, int x)
570{
571 int sx;
572
573 sx = (x-minx) % (maxx-minx);
574 if(sx < 0)
575 sx += maxx-minx;
576 return sx+minx;
577}
578
579void
580replicate(Memimage *i, Memimage *tmp)
581{
582 Rectangle r, r1;
583 int x, y, nb;
584
585 /* choose the replication window (i->r) */
586 r.min.x = nrand(Xrange-1);
587 r.min.y = nrand(Yrange-1);
588 /* make it trivial more often than pure chance allows */
589 switch(lrand()&0){
590 case 1:
591 r.max.x = r.min.x + 2;
592 r.max.y = r.min.y + 2;
593 if(r.max.x < Xrange && r.max.y < Yrange)
594 break;
595 /* fall through */
596 case 0:
597 r.max.x = r.min.x + 1;
598 r.max.y = r.min.y + 1;
599 break;
600 default:
601 if(r.min.x+3 >= Xrange)
602 r.max.x = Xrange;
603 else
604 r.max.x = r.min.x+3 + nrand(Xrange-(r.min.x+3));
605
606 if(r.min.y+3 >= Yrange)
607 r.max.y = Yrange;
608 else
609 r.max.y = r.min.y+3 + nrand(Yrange-(r.min.y+3));
610 }
611 assert(r.min.x >= 0);
612 assert(r.max.x <= Xrange);
613 assert(r.min.y >= 0);
614 assert(r.max.y <= Yrange);
615 /* copy from i to tmp so we have just the replicated bits */
616 nb = tmp->width*sizeof(ulong)*Yrange;
617 memset(tmp->data->bdata, 0, nb);
618 memimagedraw(tmp, r, i, r.min, ones, r.min, SoverD);
619 memmove(i->data->bdata, tmp->data->bdata, nb);
620 /* i is now a non-replicated instance of the replication */
621 /* replicate it by hand through tmp */
622 memset(tmp->data->bdata, 0, nb);
623 x = -(tilexy(r.min.x, r.max.x, 0)-r.min.x);
624 for(; x<Xrange; x+=Dx(r)){
625 y = -(tilexy(r.min.y, r.max.y, 0)-r.min.y);
626 for(; y<Yrange; y+=Dy(r)){
627 /* set r1 to instance of tile by translation */
628 r1.min.x = x;
629 r1.min.y = y;
630 r1.max.x = r1.min.x+Dx(r);
631 r1.max.y = r1.min.y+Dy(r);
632 memimagedraw(tmp, r1, i, r.min, ones, r.min, SoverD);
633 }
634 }
635 i->flags |= Frepl;
636 i->r = r;
637 i->clipr = randrect();
638// fprint(2, "replicate [[%d %d] [%d %d]] [[%d %d][%d %d]]\n", r.min.x, r.min.y, r.max.x, r.max.y,
639// i->clipr.min.x, i->clipr.min.y, i->clipr.max.x, i->clipr.max.y);
640 tmp->clipr = i->clipr;
641}
642
643/*
644 * Mask is preset; do the rest
645 */
646void
647verifyrectmaskrepl(int srcrepl, int maskrepl)
648{
649 Point sp, mp, tp, up;
650 Rectangle dr;
651 int x, y;
652 Memimage *s, *m;
653
654// print("verfrect %d %d\n", srcrepl, maskrepl);
655 src->flags &= ~Frepl;
656 src->r = Rect(0, 0, Xrange, Yrange);
657 src->clipr = src->r;
658 stmp->flags &= ~Frepl;
659 stmp->r = Rect(0, 0, Xrange, Yrange);
660 stmp->clipr = src->r;
661 mask->flags &= ~Frepl;
662 mask->r = Rect(0, 0, Xrange, Yrange);
663 mask->clipr = mask->r;
664 mtmp->flags &= ~Frepl;
665 mtmp->r = Rect(0, 0, Xrange, Yrange);
666 mtmp->clipr = mask->r;
667
668 fill(dst, dstbits);
669 fill(src, srcbits);
670
671 memmove(dst->data->bdata, dstbits, dst->width*sizeof(ulong)*Yrange);
672 memmove(src->data->bdata, srcbits, src->width*sizeof(ulong)*Yrange);
673 memmove(mask->data->bdata, maskbits, mask->width*sizeof(ulong)*Yrange);
674
675 if(srcrepl){
676 replicate(src, stmp);
677 s = stmp;
678 }else
679 s = src;
680 if(maskrepl){
681 replicate(mask, mtmp);
682 m = mtmp;
683 }else
684 m = mask;
685
686 dr = randrect();
687
688 sp.x = nrand(Xrange);
689 sp.y = nrand(Yrange);
690
691 mp.x = nrand(Xrange);
692 mp.y = nrand(Yrange);
693
694DBG print("smalldraws\n");
695 for(tp.y=sp.y,up.y=mp.y,y=dr.min.y; y<dr.max.y && tp.y<Yrange && up.y<Yrange; y++,tp.y++,up.y++)
696 for(tp.x=sp.x,up.x=mp.x,x=dr.min.x; x<dr.max.x && tp.x<Xrange && up.x<Xrange; x++,tp.x++,up.x++)
697 memimagedraw(dst, Rect(x, y, x+1, y+1), s, tp, m, up, SoverD);
698 memmove(savedstbits, dst->data->bdata, dst->width*sizeof(ulong)*Yrange);
699
700 memmove(dst->data->bdata, dstbits, dst->width*sizeof(ulong)*Yrange);
701
702DBG print("bigdraw\n");
703 memimagedraw(dst, dr, src, sp, mask, mp, SoverD);
704 for(y=0; y<Yrange; y++)
705 checkline(dr, drawrepl(src->r, sp), drawrepl(mask->r, mp), y, srcrepl?stmp:nil, maskrepl?mtmp:nil);
706}
707
708void
709verifyrectrepl(int srcrepl, int maskrepl)
710{
711 int i;
712
713 /* mask all ones */
714 memset(maskbits, 0xFF, nbytes);
715 for(i=0; i<niters; i++)
716 verifyrectmaskrepl(srcrepl, maskrepl);
717
718 /* mask all zeros */
719 memset(maskbits, 0, nbytes);
720 for(i=0; i<niters; i++)
721 verifyrectmaskrepl(srcrepl, maskrepl);
722
723 /* random mask */
724 for(i=0; i<niters; i++){
725 fill(mask, maskbits);
726 verifyrectmaskrepl(srcrepl, maskrepl);
727 }
728}
729
730/*
731 * Trivial draw implementation.
732 * Color values are passed around as ulongs containing ααRRGGBB
733 */
734
735/*
736 * Convert v, which is nhave bits wide, into its nwant bits wide equivalent.
737 * Replicates to widen the value, truncates to narrow it.
738 */
739ulong
740replbits(ulong v, int nhave, int nwant)
741{
742 v &= (1<<nhave)-1;
743 for(; nhave<nwant; nhave*=2)
744 v |= v<<nhave;
745 v >>= (nhave-nwant);
746 return v & ((1<<nwant)-1);
747}
748
749/*
750 * Decode a pixel into the uchar* values.
751 */
752void
753pixtorgba(ulong v, uchar *r, uchar *g, uchar *b, uchar *a)
754{
755 *a = v>>24;
756 *r = v>>16;
757 *g = v>>8;
758 *b = v;
759}
760
761/*
762 * Convert uchar channels into ulong pixel.
763 */
764ulong
765rgbatopix(uchar r, uchar g, uchar b, uchar a)
766{
767 return (a<<24)|(r<<16)|(g<<8)|b;
768}
769
770/*
771 * Retrieve the pixel value at pt in the image.
772 */
773ulong
774getpixel(Memimage *img, Point pt)
775{
776 uchar r, g, b, a, *p;
777 int nbits, npack, bpp;
778 ulong v, c, rbits, bits;
779
780 r = g = b = 0;
781 a = ~0; /* default alpha is full */
782
783 p = byteaddr(img, pt);
784 v = p[0]|(p[1]<<8)|(p[2]<<16)|(p[3]<<24);
785 bpp = img->depth;
786 if(bpp<8){
787 /*
788 * Sub-byte greyscale pixels.
789 *
790 * We want to throw away the top pt.x%npack pixels and then use the next bpp bits
791 * in the bottom byte of v. This madness is due to having big endian bits
792 * but little endian bytes.
793 */
794 npack = 8/bpp;
795 v >>= 8 - bpp*(pt.x%npack+1);
796 v &= (1<<bpp)-1;
797 r = g = b = replbits(v, bpp, 8);
798 }else{
799 /*
800 * General case. We need to parse the channel descriptor and do what it says.
801 * In all channels but the color map, we replicate to 8 bits because that's the
802 * precision that all calculations are done at.
803 *
804 * In the case of the color map, we leave the bits alone, in case a color map
805 * with less than 8 bits of index is used. This is currently disallowed, so it's
806 * sort of silly.
807 */
808
809 for(c=img->chan; c; c>>=8){
810 nbits = NBITS(c);
811 bits = v & ((1<<nbits)-1);
812 rbits = replbits(bits, nbits, 8);
813 v >>= nbits;
814 switch(TYPE(c)){
815 case CRed:
816 r = rbits;
817 break;
818 case CGreen:
819 g = rbits;
820 break;
821 case CBlue:
822 b = rbits;
823 break;
824 case CGrey:
825 r = g = b = rbits;
826 break;
827 case CAlpha:
828 a = rbits;
829 break;
830 case CMap:
831 p = img->cmap->cmap2rgb + 3*bits;
832 r = p[0];
833 g = p[1];
834 b = p[2];
835 break;
836 case CIgnore:
837 break;
838 default:
839 fprint(2, "unknown channel type %lud\n", TYPE(c));
840 abort();
841 }
842 }
843 }
844 return rgbatopix(r, g, b, a);
845}
846
847/*
848 * Return the greyscale equivalent of a pixel.
849 */
850uchar
851getgrey(Memimage *img, Point pt)
852{
853 uchar r, g, b, a;
854 pixtorgba(getpixel(img, pt), &r, &g, &b, &a);
855 return RGB2K(r, g, b);
856}
857
858/*
859 * Return the value at pt in image, if image is interpreted
860 * as a mask. This means the alpha channel if present, else
861 * the greyscale or its computed equivalent.
862 */
863uchar
864getmask(Memimage *img, Point pt)
865{
866 if(img->flags&Falpha)
867 return getpixel(img, pt)>>24;
868 else
869 return getgrey(img, pt);
870}
871#undef DBG
872
873#define DBG if(0)
874/*
875 * Write a pixel to img at point pt.
876 *
877 * We do this by reading a 32-bit little endian
878 * value from p and then writing it back
879 * after tweaking the appropriate bits. Because
880 * the data is little endian, we don't have to worry
881 * about what the actual depth is, as long as it is
882 * less than 32 bits.
883 */
884void
885putpixel(Memimage *img, Point pt, ulong nv)
886{
887 uchar r, g, b, a, *p, *q;
888 ulong c, mask, bits, v;
889 int bpp, sh, npack, nbits;
890
891 pixtorgba(nv, &r, &g, &b, &a);
892
893 p = byteaddr(img, pt);
894 v = p[0]|(p[1]<<8)|(p[2]<<16)|(p[3]<<24);
895 bpp = img->depth;
896DBG print("v %.8lux...", v);
897 if(bpp < 8){
898 /*
899 * Sub-byte greyscale pixels. We need to skip the leftmost pt.x%npack pixels,
900 * which is equivalent to skipping the rightmost npack - pt.x%npack - 1 pixels.
901 */
902 npack = 8/bpp;
903 sh = bpp*(npack - pt.x%npack - 1);
904 bits = RGB2K(r,g,b);
905DBG print("repl %lux 8 %d = %lux...", bits, bpp, replbits(bits, 8, bpp));
906 bits = replbits(bits, 8, bpp);
907 mask = (1<<bpp)-1;
908DBG print("bits %lux mask %lux sh %d...", bits, mask, sh);
909 mask <<= sh;
910 bits <<= sh;
911DBG print("(%lux & %lux) | (%lux & %lux)", v, ~mask, bits, mask);
912 v = (v & ~mask) | (bits & mask);
913 } else {
914 /*
915 * General case. We need to parse the channel descriptor again.
916 */
917 sh = 0;
918 for(c=img->chan; c; c>>=8){
919 nbits = NBITS(c);
920 switch(TYPE(c)){
921 case CRed:
922 bits = r;
923 break;
924 case CGreen:
925 bits = g;
926 break;
927 case CBlue:
928 bits = b;
929 break;
930 case CGrey:
931 bits = RGB2K(r, g, b);
932 break;
933 case CAlpha:
934 bits = a;
935 break;
936 case CIgnore:
937 bits = 0;
938 break;
939 case CMap:
940 q = img->cmap->rgb2cmap;
941 bits = q[(r>>4)*16*16+(g>>4)*16+(b>>4)];
942 break;
943 default:
944 SET(bits);
945 fprint(2, "unknown channel type %lud\n", TYPE(c));
946 abort();
947 }
948
949DBG print("repl %lux 8 %d = %lux...", bits, nbits, replbits(bits, 8, nbits));
950 if(TYPE(c) != CMap)
951 bits = replbits(bits, 8, nbits);
952 mask = (1<<nbits)-1;
953DBG print("bits %lux mask %lux sh %d...", bits, mask, sh);
954 bits <<= sh;
955 mask <<= sh;
956 v = (v & ~mask) | (bits & mask);
957 sh += nbits;
958 }
959 }
960DBG print("v %.8lux\n", v);
961 p[0] = v;
962 p[1] = v>>8;
963 p[2] = v>>16;
964 p[3] = v>>24;
965}
966#undef DBG
967
968#define DBG if(0)
969void
970drawonepixel(Memimage *dst, Point dp, Memimage *src, Point sp, Memimage *mask, Point mp)
971{
972 uchar m, M, sr, sg, sb, sa, sk, dr, dg, db, da, dk;
973
974 pixtorgba(getpixel(dst, dp), &dr, &dg, &db, &da);
975 pixtorgba(getpixel(src, sp), &sr, &sg, &sb, &sa);
976 m = getmask(mask, mp);
977 M = 255-(sa*m)/255;
978
979DBG print("dst %x %x %x %x src %x %x %x %x m %x = ", dr,dg,db,da, sr,sg,sb,sa, m);
980 if(dst->flags&Fgrey){
981 /*
982 * We need to do the conversion to grey before the alpha calculation
983 * because the draw operator does this, and we need to be operating
984 * at the same precision so we get exactly the same answers.
985 */
986 sk = RGB2K(sr, sg, sb);
987 dk = RGB2K(dr, dg, db);
988 dk = (sk*m + dk*M)/255;
989 dr = dg = db = dk;
990 da = (sa*m + da*M)/255;
991 }else{
992 /*
993 * True color alpha calculation treats all channels (including alpha)
994 * the same. It might have been nice to use an array, but oh well.
995 */
996 dr = (sr*m + dr*M)/255;
997 dg = (sg*m + dg*M)/255;
998 db = (sb*m + db*M)/255;
999 da = (sa*m + da*M)/255;
1000 }
1001
1002DBG print("%x %x %x %x\n", dr,dg,db,da);
1003 putpixel(dst, dp, rgbatopix(dr, dg, db, da));
1004}
libmemdraw/ellipse.c+4−4
@@ -124,7 +124,7 @@ memellipse(Memimage *dst, Point c, int a, int b, int t, Memimage *src, Point sp, · 123 unmodified lines
124 p.op = op;124 p.op = op;
125 125
126 u = (t<<1)*(a-b);126 u = (t<<1)*(a-b);
127 if((b<a && u>b*b) || (a<b && -u>a*a)) {127 if(b<a && u>b*b || a<b && -u>a*a) {
128/* if(b<a&&(t<<1)>b*b/a || a<b&&(t<<1)>a*a/b) # very thick */128/* if(b<a&&(t<<1)>b*b/a || a<b&&(t<<1)>a*a/b) # very thick */
129 bellipse(b, newstate(&in, a, b), &p);129 bellipse(b, newstate(&in, a, b), &p);
130 return;130 return;
@@ -209,7 +209,7 @@ erect(int x0, int y0, int x1, int y1, Param *p) · 78 unmodified lines
209{209{
210 Rectangle r;210 Rectangle r;
211 211
212/* print("R %d,%d %d,%d\n", x0, y0, x1, y1); */212/* print("R %d,%d %d,%d\n", x0, y0, x1, y1); /**/
213 r = Rect(p->c.x+x0, p->c.y+y0, p->c.x+x1+1, p->c.y+y1+1);213 r = Rect(p->c.x+x0, p->c.y+y0, p->c.x+x1+1, p->c.y+y1+1);
214 memdraw(p->dst, r, p->src, addpt(p->sp, r.min), memopaque, p00, p->op);214 memdraw(p->dst, r, p->src, addpt(p->sp, r.min), memopaque, p00, p->op);
215}215}
@@ -224,7 +224,7 @@ epoint(int x, int y, Param *p) · 8 unmodified lines
224 Point p0;224 Point p0;
225 Rectangle r;225 Rectangle r;
226 226
227/* print("P%d %d,%d\n", p->t, x, y); */227/* print("P%d %d,%d\n", p->t, x, y); /**/
228 p0 = Pt(p->c.x+x, p->c.y+y);228 p0 = Pt(p->c.x+x, p->c.y+y);
229 r = Rpt(addpt(p0, p->disc->r.min), addpt(p0, p->disc->r.max));229 r = Rpt(addpt(p0, p->disc->r.min), addpt(p0, p->disc->r.max));
230 memdraw(p->dst, r, p->src, addpt(p->sp, r.min), p->disc, p->disc->r.min, p->op);230 memdraw(p->dst, r, p->src, addpt(p->sp, r.min), p->disc, p->disc->r.min, p->op);
@@ -237,7 +237,7 @@ static · 6 unmodified lines
237void237void
238eline(int x0, int y0, int x1, int y1, Param *p)238eline(int x0, int y0, int x1, int y1, Param *p)
239{239{
240/* print("L%d %d,%d %d,%d\n", p->t, x0, y0, x1, y1); */240/* print("L%d %d,%d %d,%d\n", p->t, x0, y0, x1, y1); /**/
241 if(x1 > x0+1)241 if(x1 > x0+1)
242 erect(x0+1, y0-p->t, x1-1, y1+p->t, p);242 erect(x0+1, y0-p->t, x1-1, y1+p->t, p);
243 else if(y1 > y0+1)243 else if(y1 > y0+1)
libmemdraw/fillpoly.c+1−3
@@ -26,7 +26,6 @@ static int zcompare(const void*, const void*); · 25 unmodified lines
26static void xscan(Memimage *dst, Seg **seg, Seg *segtab, int nseg, int wind, Memimage *src, Point sp, int, int, int, int);26static void xscan(Memimage *dst, Seg **seg, Seg *segtab, int nseg, int wind, Memimage *src, Point sp, int, int, int, int);
27static void yscan(Memimage *dst, Seg **seg, Seg *segtab, int nseg, int wind, Memimage *src, Point sp, int, int);27static void yscan(Memimage *dst, Seg **seg, Seg *segtab, int nseg, int wind, Memimage *src, Point sp, int, int);
28 28
29#ifdef NOT
30static void29static void
31fillcolor(Memimage *dst, int left, int right, int y, Memimage *src, Point p)30fillcolor(Memimage *dst, int left, int right, int y, Memimage *src, Point p)
32{31{
@@ -38,7 +37,6 @@ fillcolor(Memimage *dst, int left, int right, int y, Memimage *src, Point p) · 5 unmodified lines
38 p.y = y;37 p.y = y;
39 memset(byteaddr(dst, p), srcval, right-left);38 memset(byteaddr(dst, p), srcval, right-left);
40}39}
41#endif
42 40
43static void41static void
44fillline(Memimage *dst, int left, int right, int y, Memimage *src, Point p, int op)42fillline(Memimage *dst, int left, int right, int y, Memimage *src, Point p, int op)
@@ -81,7 +79,7 @@ _memfillpolysc(Memimage *dst, Point *vert, int nvert, int w, Memimage *src, Poin · 36 unmodified lines
81 Point p0;79 Point p0;
82 int i;80 int i;
83 81
84 if(nvert == 0)82 if(nvert <= 0)
85 return;83 return;
86 84
87 seg = malloc((nvert+2)*sizeof(Seg*));85 seg = malloc((nvert+2)*sizeof(Seg*));
libmemdraw/line.c+2−3
@@ -11,7 +11,6 @@ enum · 10 unmodified lines
11 Arrow3 = 3,11 Arrow3 = 3,
12};12};
13 13
14#ifdef NOT
15static14static
16int15int
17lmin(int a, int b)16lmin(int a, int b)
@@ -20,7 +19,6 @@ lmin(int a, int b) · 2 unmodified lines
20 return a;19 return a;
21 return b;20 return b;
22}21}
23#endif
24 22
25static23static
26int24int
@@ -370,6 +368,7 @@ _memimageline(Memimage *dst, Point p0, Point p1, int end0, int end1, int radius, · 343 unmodified lines
370 r.max.y += radius+1;368 r.max.y += radius+1;
371 }369 }
372 oclipr = dst->clipr;370 oclipr = dst->clipr;
371 sp = addpt(r.min, d);
373 dst->clipr = clipr;372 dst->clipr = clipr;
374 memimagedraw(dst, r, src, sp, memopaque, sp, op);373 memimagedraw(dst, r, src, sp, memopaque, sp, op);
375 dst->clipr = oclipr;374 dst->clipr = oclipr;
@@ -422,7 +421,7 @@ _memimageline(Memimage *dst, Point p0, Point p1, int end0, int end1, int radius, · 46 unmodified lines
422 break;421 break;
423 case Endarrow:422 case Endarrow:
424 arrowend(q, pp, end1, sin, cos, radius);423 arrowend(q, pp, end1, sin, cos, radius);
425 _memfillpolysc(dst, pp, 5, ~0, src, addpt(pts[0], mulpt(d, ICOSSCALE)), 1, 10, 1, op);424 _memfillpolysc(dst, pp, 5, ~0, src, addpt(pp[0], mulpt(d, ICOSSCALE)), 1, 10, 1, op);
426 pp[1] = pp[4];425 pp[1] = pp[4];
427 pp += 2;426 pp += 2;
428 }427 }
libmemdraw/load.c+9−2
@@ -4,13 +4,20 @@ · 3 unmodified lines
4#include <memdraw.h>4#include <memdraw.h>
5 5
6int6int
7_loadmemimage(Memimage *i, Rectangle r, uchar *data, int ndata)7loadmemimage(Memimage *i, Rectangle r, uchar *data, int ndata)
8{8{
9 int y, l, lpart, rpart, mx, m, mr;9 int y, l, lpart, rpart, mx, m, mr;
10 Memdrawparam par;
10 uchar *q;11 uchar *q;
11 12
12 if(!rectinrect(r, i->r))13 if(badrect(r) || !rectinrect(r, i->r))
13 return -1;14 return -1;
15
16 memset(&par, 0, sizeof par);
17 par.dst = i;
18 par.r = r;
19 hwdraw(&par);
20
14 l = bytesperline(r, i->depth);21 l = bytesperline(r, i->depth);
15 if(ndata < l*Dy(r))22 if(ndata < l*Dy(r))
16 return -1;23 return -1;
libmemdraw/openmemsubfont.c+9−6
@@ -20,15 +20,19 @@ openmemsubfont(char *name) · 19 unmodified lines
20 i = readmemimage(fd);20 i = readmemimage(fd);
21 if(i == nil)21 if(i == nil)
22 goto Err;22 goto Err;
23 if(read(fd, hdr, 3*12) != 3*12){23 if(readn(fd, hdr, 3*12) != 3*12){
24 werrstr("openmemsubfont: header read error: %r");24 werrstr("openmemsubfont: header read error: %r");
25 goto Err;25 goto Err;
26 }26 }
27 n = atoi(hdr);27 n = atoi(hdr);
28 if(n <= 0 || n > 0x7fff){
29 werrstr("openmemsubfont: bad fontchar count %d", n);
30 goto Err;
31 }
28 p = malloc(6*(n+1));32 p = malloc(6*(n+1));
29 if(p == nil)33 if(p == nil)
30 goto Err;34 goto Err;
31 if(read(fd, p, 6*(n+1)) != 6*(n+1)){35 if(readn(fd, p, 6*(n+1)) != 6*(n+1)){
32 werrstr("openmemsubfont: fontchar read error: %r");36 werrstr("openmemsubfont: fontchar read error: %r");
33 goto Err;37 goto Err;
34 }38 }
@@ -41,13 +45,12 @@ openmemsubfont(char *name) · 6 unmodified lines
41 free(fc);45 free(fc);
42 goto Err;46 goto Err;
43 }47 }
48 close(fd);
44 free(p);49 free(p);
45 return sf;50 return sf;
46Err:51Err:
47 close(fd);52 close(fd);
48 if (i != nil)53 free(p);
49 freememimage(i);54 freememimage(i);
50 if (p != nil)
51 free(p);
52 return nil;55 return nil;
53}56}
libmemdraw/read.c+0−4
@@ -85,10 +85,6 @@ readmemimage(int fd) · 84 unmodified lines
85 dy = maxy - miny;85 dy = maxy - miny;
86 if(dy*l > chunk)86 if(dy*l > chunk)
87 dy = chunk/l;87 dy = chunk/l;
88 if(dy <= 0){
89 werrstr("readmemimage: image too wide for buffer");
90 goto Err;
91 }
92 n = dy*l;88 n = dy*l;
93 m = readn(fd, tmp, n);89 m = readn(fd, tmp, n);
94 if(m != n){90 if(m != n){
libmemdraw/string.c+3−4
@@ -13,7 +13,7 @@ memimagestring(Memimage *b, Point p, Memimage *color, Point cp, Memsubfont *f, c · 12 unmodified lines
13 Fontchar *i;13 Fontchar *i;
14 14
15 s = (uchar*)cs;15 s = (uchar*)cs;
16 for(; (c=*s); p.x+=width, cp.x+=width){16 for(; c=*s; p.x+=width, cp.x+=width){
17 width = 0;17 width = 0;
18 if(c < Runeself)18 if(c < Runeself)
19 s++;19 s++;
@@ -27,8 +27,7 @@ memimagestring(Memimage *b, Point p, Memimage *color, Point cp, Memsubfont *f, c · 7 unmodified lines
27 }27 }
28 if(c >= f->n)28 if(c >= f->n)
29 continue;29 continue;
30// i = f->info+c;30 i = f->info+c;
31 i = &(f->info[c]);
32 width = i->width;31 width = i->width;
33 memdraw(b, Rect(p.x+i->left, p.y+i->top, p.x+i->left+(i[1].x-i[0].x), p.y+i->bottom),32 memdraw(b, Rect(p.x+i->left, p.y+i->top, p.x+i->left+(i[1].x-i[0].x), p.y+i->bottom),
34 color, cp, f->bits, Pt(i->x, i->top), SoverD);33 color, cp, f->bits, Pt(i->x, i->top), SoverD);
@@ -47,7 +46,7 @@ memsubfontwidth(Memsubfont *f, char *cs) · 12 unmodified lines
47 46
48 p = Pt(0, f->height);47 p = Pt(0, f->height);
49 s = (uchar*)cs;48 s = (uchar*)cs;
50 for(; (c=*s); p.x+=width){49 for(; c=*s; p.x+=width){
51 width = 0;50 width = 0;
52 if(c < Runeself)51 if(c < Runeself)
53 s++;52 s++;
libmemdraw/subfont.c+1−0
@@ -30,5 +30,6 @@ freememsubfont(Memsubfont *f) · 29 unmodified lines
30 return;30 return;
31 free(f->info); /* note: f->info must have been malloc'ed! */31 free(f->info); /* note: f->info must have been malloc'ed! */
32 freememimage(f->bits);32 freememimage(f->bits);
33 free(f->name);
33 free(f);34 free(f);
34}35}
libmemdraw/unload.c+1−1
@@ -9,7 +9,7 @@ unloadmemimage(Memimage *i, Rectangle r, uchar *data, int ndata) · 8 unmodified lines
9 int y, l;9 int y, l;
10 uchar *q;10 uchar *q;
11 11
12 if(!rectinrect(r, i->r))12 if(badrect(r) || !rectinrect(r, i->r))
13 return -1;13 return -1;
14 l = bytesperline(r, i->depth);14 l = bytesperline(r, i->depth);
15 if(ndata < l*Dy(r))15 if(ndata < l*Dy(r))
libmemdraw/write.c+21−15
@@ -27,12 +27,10 @@ writememimage(int fd, Memimage *i) · 26 unmodified lines
27 uchar *line, *eline; /* input line, end pointer */27 uchar *line, *eline; /* input line, end pointer */
28 uchar *data, *edata; /* input buffer, end pointer */28 uchar *data, *edata; /* input buffer, end pointer */
29 ulong n; /* length of input buffer */29 ulong n; /* length of input buffer */
30 ulong nb; /* # of bytes returned by unloadimage */
31 int bpl; /* input line length */30 int bpl; /* input line length */
32 int offs, runlen; /* offset, length of consumed data */31 int offs, runlen; /* offset, length of consumed data */
33 uchar dumpbuf[NDUMP]; /* dump accumulator */32 uchar dumpbuf[NDUMP]; /* dump accumulator */
34 int ndump; /* length of dump accumulator */33 int ndump; /* length of dump accumulator */
35 int miny, dy; /* y values while unloading input */
36 int ncblock; /* size of compressed blocks */34 int ncblock; /* size of compressed blocks */
37 Rectangle r;35 Rectangle r;
38 uchar *p, *q, *s, *es, *t;36 uchar *p, *q, *s, *es, *t;
@@ -41,28 +39,36 @@ writememimage(int fd, Memimage *i) · 2 unmodified lines
41 39
42 r = i->r;40 r = i->r;
43 bpl = bytesperline(r, i->depth);41 bpl = bytesperline(r, i->depth);
42 ncblock = _compblocksize(r, i->depth);
43 if(ncblock > CHUNK){
44 sprint(hdr, "%11s %11d %11d %11d %11d ",
45 chantostr(cbuf, i->chan), r.min.x, r.min.y, r.max.x, r.max.y);
46 if(write(fd, hdr, 5*12) != 5*12)
47 return -1;
48 for(; r.min.y < r.max.y; r.min.y++)
49 if(write(fd, byteaddr(i, r.min), bpl) != bpl)
50 return -1;
51 return 0;
52 }
53
44 n = Dy(r)*bpl;54 n = Dy(r)*bpl;
45 data = malloc(n);55 data = malloc(n);
46 ncblock = _compblocksize(r, i->depth);56 if(data == 0){
57 ErrOut0:
58 free(data);
59 return -1;
60 }
61 if(unloadmemimage(i, r, data, n) != n)
62 goto ErrOut0;
47 outbuf = malloc(ncblock);63 outbuf = malloc(ncblock);
48 hash = malloc(NHASH*sizeof(Hlist));64 hash = malloc(NHASH*sizeof(Hlist));
49 chain = malloc(NMEM*sizeof(Hlist));65 chain = malloc(NMEM*sizeof(Hlist));
50 if(data == 0 || outbuf == 0 || hash == 0 || chain == 0){66 if(outbuf == 0 || hash == 0 || chain == 0){
51 ErrOut:67 ErrOut:
52 free(data);
53 free(outbuf);68 free(outbuf);
54 free(hash);69 free(hash);
55 free(chain);70 free(chain);
56 return -1;71 goto ErrOut0;
57 }
58 for(miny = r.min.y; miny != r.max.y; miny += dy){
59 dy = r.max.y-miny;
60 if(dy*bpl > CHUNK)
61 dy = CHUNK/bpl;
62 nb = unloadmemimage(i, Rect(r.min.x, miny, r.max.x, miny+dy),
63 data+(miny-r.min.y)*bpl, dy*bpl);
64 if(nb != dy*bpl)
65 goto ErrOut;
66 }72 }
67 sprint(hdr, "compressed\n%11s %11d %11d %11d %11d ",73 sprint(hdr, "compressed\n%11s %11d %11d %11d %11d ",
68 chantostr(cbuf, i->chan), r.min.x, r.min.y, r.max.x, r.max.y);74 chantostr(cbuf, i->chan), r.min.x, r.min.y, r.max.x, r.max.y);
libmemlayer/draw.c+2−2
@@ -42,7 +42,7 @@ ldrawop(Memimage *dst, Rectangle screenr, Rectangle clipr, void *etc, int insave · 41 unmodified lines
42 if(!rectinrect(r, clipr)){42 if(!rectinrect(r, clipr)){
43 oclipr = dst->clipr;43 oclipr = dst->clipr;
44 dst->clipr = clipr;44 dst->clipr = clipr;
45 ok = drawclip(dst, &r, d->src, &p0, d->mask, &p1, &srcr, &mr);45 ok = drawclipnorepl(dst, &r, d->src, &p0, d->mask, &p1, &srcr, &mr);
46 dst->clipr = oclipr;46 dst->clipr = oclipr;
47 if(!ok)47 if(!ok)
48 return;48 return;
@@ -74,7 +74,7 @@ if(drawdebug) iprint("mask->layer != nil\n"); · 25 unmodified lines
74 return;74 return;
75 }75 }
76 76
77 if(drawclip(dst, &r, src, &p0, mask, &p1, &srcr, &mr) == 0){77 if(drawclipnorepl(dst, &r, src, &p0, mask, &p1, &srcr, &mr) == 0){
78if(drawdebug) iprint("drawclip dstcr %R srccr %R maskcr %R\n", dst->clipr, src->clipr, mask->clipr);78if(drawdebug) iprint("drawclip dstcr %R srccr %R maskcr %R\n", dst->clipr, src->clipr, mask->clipr);
79 return;79 return;
80 }80 }
libmemlayer/lalloc.c+1−1
@@ -19,7 +19,7 @@ memlalloc(Memscreen *s, Rectangle screenr, Refreshfn refreshfn, void *refreshptr · 18 unmodified lines
19 paint->clipr = Rect(-0x3FFFFFF, -0x3FFFFFF, 0x3FFFFFF, 0x3FFFFFF);19 paint->clipr = Rect(-0x3FFFFFF, -0x3FFFFFF, 0x3FFFFFF, 0x3FFFFFF);
20 }20 }
21 21
22 n = allocmemimaged(screenr, s->image->chan, s->image->data, s->image->X);22 n = allocmemimaged(screenr, s->image->chan, s->image->data);
23 if(n == nil)23 if(n == nil)
24 return nil;24 return nil;
25 l = malloc(sizeof(Memlayer));25 l = malloc(sizeof(Memlayer));
libmemlayer/lsetrefresh.c+3−3
@@ -10,13 +10,13 @@ memlsetrefresh(Memimage *i, Refreshfn fn, void *ptr) · 9 unmodified lines
10 Memlayer *l;10 Memlayer *l;
11 11
12 l = i->layer;12 l = i->layer;
13 if(l->refreshfn!=0 && fn!=0){ /* just change functions */13 if(l->refreshfn!=nil && fn!=nil){ /* just change functions */
14 l->refreshfn = fn;14 l->refreshfn = fn;
15 l->refreshptr = ptr;15 l->refreshptr = ptr;
16 return 1;16 return 1;
17 }17 }
18 18
19 if(l->refreshfn == 0){ /* is using backup image; just free it */19 if(l->refreshfn == nil){ /* is using backup image; just free it */
20 freememimage(l->save);20 freememimage(l->save);
21 l->save = nil;21 l->save = nil;
22 l->refreshfn = fn;22 l->refreshfn = fn;
@@ -29,7 +29,7 @@ memlsetrefresh(Memimage *i, Refreshfn fn, void *ptr) · 6 unmodified lines
29 return 0;29 return 0;
30 /* easiest way is just to update the entire save area */30 /* easiest way is just to update the entire save area */
31 l->refreshfn(i, i->r, l->refreshptr);31 l->refreshfn(i, i->r, l->refreshptr);
32 l->refreshfn = 0;32 l->refreshfn = nil;
33 l->refreshptr = nil;33 l->refreshptr = nil;
34 return 1;34 return 1;
35}35}
libmemlayer/unload.c+1−1
@@ -35,7 +35,7 @@ memunload(Memimage *src, Rectangle r, uchar *data, int n) · 34 unmodified lines
35 * src is an obscured layer or data is unaligned35 * src is an obscured layer or data is unaligned
36 */36 */
37 if(dl->save && dx==0){37 if(dl->save && dx==0){
38 if(dl->refreshfn != 0)38 if(dl->refreshfn != nil)
39 return -1; /* can't unload window if it's not Refbackup */39 return -1; /* can't unload window if it's not Refbackup */
40 if(n > 0)40 if(n > 0)
41 memlhide(src, r);41 memlhide(src, r);

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