From 28b49df3542a635cca788f3de213385f3fcb6334 Mon Sep 17 00:00:00 2001 From: rsc Date: Tue, 18 Jul 2006 15:26:33 +0000 Subject: assorted changes from Plan 9 --- src/cmd/venti/srv/graph.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'src/cmd/venti/srv/graph.c') diff --git a/src/cmd/venti/srv/graph.c b/src/cmd/venti/srv/graph.c index 647c74b2..9c906ad7 100644 --- a/src/cmd/venti/srv/graph.c +++ b/src/cmd/venti/srv/graph.c @@ -55,7 +55,11 @@ ginit(void) first = 0; memimageinit(); +#ifdef PLAN9PORT smallfont = openmemsubfont(unsharp("#9/font/lucsans/lstr.10")); +#else + smallfont = openmemsubfont("/lib/font/bit/lucidasans/lstr.10"); +#endif black = memblack; blue = allocrepl(DBlue); red = allocrepl(DRed); @@ -121,7 +125,7 @@ statgraph(Graph *g) if(g->wid > nelem(bin)) g->wid = nelem(bin); if(g->fill < 0) - g->fill = ((uint)(uintptr)g->arg>>8)%nelem(lofill); + g->fill = ((uint)g->arg>>8)%nelem(lofill); if(g->fill > nelem(lofill)) g->fill %= nelem(lofill); @@ -151,7 +155,7 @@ statgraph(Graph *g) qlock(&memdrawlock); ginit(); if(smallfont==nil || black==nil || blue==nil || red==nil || hifill==nil || lofill==nil){ - werrstr("graphics initialization failed"); + werrstr("graphics initialization failed: %r"); qunlock(&memdrawlock); return nil; } @@ -186,12 +190,12 @@ statgraph(Graph *g) if(0) if(lastlo != -1){ if(lastlo < lo) - memimagedraw(m, Rect(x-1, lastlo, x, lo), hifill[g->fill], ZP, memopaque, ZP, S); + memimagedraw(m, Rect(x-1, lastlo, x, lo), hifill[g->fill%nelem(hifill)], ZP, memopaque, ZP, S); else if(lastlo > lo) - memimagedraw(m, Rect(x-1, lo, x, lastlo), hifill[g->fill], ZP, memopaque, ZP, S); + memimagedraw(m, Rect(x-1, lo, x, lastlo), hifill[g->fill%nelem(hifill)], ZP, memopaque, ZP, S); } - memimagedraw(m, Rect(x, hi, x+1,lo), hifill[g->fill], ZP, memopaque, ZP, S); - memimagedraw(m, Rect(x, lo, x+1, r.max.y), lofill[g->fill], ZP, memopaque, ZP, S); + memimagedraw(m, Rect(x, hi, x+1,lo), hifill[g->fill%nelem(hifill)], ZP, memopaque, ZP, S); + memimagedraw(m, Rect(x, lo, x+1, r.max.y), lofill[g->fill%nelem(lofill)], ZP, memopaque, ZP, S); lastlo = lo; } -- cgit v1.2.3