| plan 9 kernel history: overview | file list | diff list |
1990/05313/port/devbit.c (diff list | history)
| 1990/05151/sys/src/9/port/devbit.c:9,15 – 1990/05313/sys/src/9/port/devbit.c:9,15 (short | long | prev | next) | ||
| 1990/0324 | #include "gnot.h" | |
| 1990/0329 |
| |
| 1990/05313 | extern Font *defont; | |
| 1990/0329 | ||
| 1990/0327 | /* | |
| 1990/0329 | * Device (#b/bitblt) is exclusive use on open, so no locks are necessary | |
| 1990/05151/sys/src/9/port/devbit.c:24,30 – 1990/05313/sys/src/9/port/devbit.c:24,31 | ||
| 1990/0327 | * followed by N blocks. The bitmap pointer is zero if block is free. */ | |
| 1990/0324 |
| |
| 1990/05313 | struct { | |
| 1990/0324 | Ref; | |
| 1990/0327 | Bitmap *map; /* arena */ Bitmap *free; /* free list */ | |
| 1990/05151/sys/src/9/port/devbit.c:53,77 – 1990/05313/sys/src/9/port/devbit.c:54,80 | ||
| 1990/0504 | Rendez r; }mouse; | |
| 1990/05313 | Cursor arrow = { {0, 0}, {0xFF, 0xE0, 0xFF, 0xE0, 0xFF, 0xC0, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x80, 0xFF, 0xC0, 0xFF, 0xE0, 0xE7, 0xF0, 0xE3, 0xF8, 0xC1, 0xFC, 0x00, 0xFE, 0x00, 0x7F, 0x00, 0x3E, 0x00, 0x1C, 0x00, 0x08, }, {0x00, 0x00, 0x7F, 0xC0, 0x7F, 0x00, 0x7C, 0x00, 0x7E, 0x00, 0x7F, 0x00, 0x6F, 0x80, 0x67, 0xC0, 0x43, 0xE0, 0x41, 0xF0, 0x00, 0xF8, 0x00, 0x7C, 0x00, 0x3E, 0x00, 0x1C, 0x00, 0x08, 0x00, 0x00, } }; | |
| 1990/0504 | struct{ Cursor; Lock; int visible; /* on screen */ Rectangle r; /* location */ | |
| 1990/05313 | }cursor; | |
| 1990/0504 | ulong setbits[16]; Bitmap set = | |
| 1990/05151/sys/src/9/port/devbit.c:103,109 – 1990/05313/sys/src/9/port/devbit.c:106,112 | ||
| 1990/0504 | {0, 0, 16, 16} }; | |
| 1990/05313 | void Cursortocursor(Cursor*); | |
| 1990/0504 | void cursoron(int); void cursoroff(int); | |
| 1990/0505 | int mousechanged(void*); | |
| 1990/05151/sys/src/9/port/devbit.c:140,146 – 1990/05313/sys/src/9/port/devbit.c:143,149 | ||
| 1990/0327 | bit.words = ialloc(conf.nbitbyte, 0); bit.nwords = conf.nbitbyte/sizeof(ulong); bit.wfree = bit.words; | |
| 1990/0504 |
| |
| 1990/05313 | Cursortocursor(&arrow); | |
| 1990/0324 | } void | |
| 1990/05151/sys/src/9/port/devbit.c:148,153 – 1990/05313/sys/src/9/port/devbit.c:151,159 | ||
| 1990/0324 | { lock(&bit); unlock(&bit); | |
| 1990/05313 | if(screen.ldepth > 1) panic("bitinit ldepth>1"); cursorback.ldepth = screen.ldepth; | |
| 1990/0504 | cursoron(1); | |
| 1990/0324 | } | |
| 1990/05151/sys/src/9/port/devbit.c:192,197 – 1990/05313/sys/src/9/port/devbit.c:198,204 | ||
| 1990/0327 | bit.lastid = -1; | |
| 1990/0329 | bit.init = 1; | |
| 1990/05151 | bit.ref = 1; | |
| 1990/05313 | Cursortocursor(&arrow); | |
| 1990/0324 | unlock(&bit); | |
| 1990/05151 | }else | |
| 1990/0324 | incref(&bit); | |
| 1990/05151/sys/src/9/port/devbit.c:341,346 – 1990/05313/sys/src/9/port/devbit.c:348,354 | ||
| 1990/0504 | int off; | |
| 1990/0324 | Point pt; Rectangle rect; | |
| 1990/05313 | Cursor curs; | |
| 1990/0327 | Bitmap *bp, *src, *dst; | |
| 1990/0324 | if(c->qid == CHDIR) | |
| 1990/05151/sys/src/9/port/devbit.c:368,374 – 1990/05313/sys/src/9/port/devbit.c:376,382 | ||
| 1990/0327 | if(m < 18) | |
| 1990/0324 | error(0, Ebadblt); | |
| 1990/0327 | v = *(p+1); | |
| 1990/05313 | if(v!=0 && v!=1) /* BUG */ | |
| 1990/0327 | error(0, Ebadblt); ws = 1<<(5-v); /* pixels per word */ if(bit.free == 0) | |
| 1990/05151/sys/src/9/port/devbit.c:385,393 – 1990/05313/sys/src/9/port/devbit.c:393,401 | ||
| 1990/0327 | l = (t+rect.max.x+ws-1)/ws; | |
| 1990/0324 | } | |
| 1990/0327 | nw = l*Dy(rect); | |
| 1990/05313 | if(bit.wfree+2+nw > bit.words+bit.nwords){ | |
| 1990/0327 | bitcompact(); | |
| 1990/05313 | if(bit.wfree+2+nw > bit.words+bit.nwords) | |
| 1990/0327 | error(0, Enobitstore); } bp = bit.free; | |
| 1990/05151/sys/src/9/port/devbit.c:453,458 – 1990/05313/sys/src/9/port/devbit.c:461,496 | ||
| 1990/0327 | p += 31; break; | |
| 1990/05313 | case 'c': /* * cursorswitch * 'c' 1 * nothing more: return to arrow; else * Point 8 * clr 32 * set 32 */ if(m == 1){ cursoroff(1); Cursortocursor(&arrow); cursoron(1); m -= 1; p += 1; break; } if(m < 73) error(0, Ebadblt); curs.offset.x = GLONG(p+1); curs.offset.y = GLONG(p+5); memcpy(curs.clr, p+9, 2*16); memcpy(curs.set, p+41, 2*16); cursoroff(1); Cursortocursor(&curs); cursoron(1); m -= 73; p += 73; break; | |
| 1990/0327 | case 'f': /* * free | |
| 1990/05151/sys/src/9/port/devbit.c:502,508 – 1990/05313/sys/src/9/port/devbit.c:540,546 | ||
| 1990/0329 | error(0, Ebadblt); | |
| 1990/0504 | if(off) cursoroff(1); | |
| 1990/0329 |
| |
| 1990/05313 | string(dst, pt, defont/*BUG*/, (char*)p, v); | |
| 1990/0504 | if(off) cursoron(1); | |
| 1990/0329 | q++; | |
| 1990/05151/sys/src/9/port/devbit.c:622,628 – 1990/05313/sys/src/9/port/devbit.c:660,666 | ||
| 1990/0327 | void bitfree(Bitmap *bp) { | |
| 1990/05313 | bp->base[-1] = 0; | |
| 1990/0327 | bp->ldepth = -1; bp->base = (ulong*)bit.free; bit.free = bp; | |
| 1990/05151/sys/src/9/port/devbit.c:633,639 – 1990/05313/sys/src/9/port/devbit.c:671,676 | ||
| 1990/0327 | { ulong *p1, *p2; | |
| 1990/05151/sys/src/9/port/devbit.c:648,665 – 1990/05313/sys/src/9/port/devbit.c:685,702 | ||
| 1990/0327 | p1 += 2 + p1[0]; } bit.wfree = p1; | |
| 1990/0329 | } void | |
| 1990/0504 |
| |
| 1990/05313 | Cursortocursor(Cursor *c) | |
| 1990/0329 | { | |
| 1990/0504 | int i; lock(&cursor); | |
| 1990/05313 | memcpy(&cursor, c, sizeof(Cursor)); | |
| 1990/0504 | for(i=0; i<16; i++){ | |
| 1990/05313 | setbits[i] = (c->set[2*i]<<24) + (c->set[2*i+1]<<16); clrbits[i] = (c->clr[2*i]<<24) + (c->clr[2*i+1]<<16); | |
| 1990/0504 | } unlock(&cursor); } | |
| 1990/05151/sys/src/9/port/devbit.c:711,717 – 1990/05313/sys/src/9/port/devbit.c:748,753 | ||
| 1990/0505 | mouseclock(void) /* called spl6 */ | |
| 1990/0504 | { int x, y; | |