void paintCellFb(struct application *ap, unsigned char *pixpaint, unsigned char *pixexpendable) { int gx, gy; int gyfin, gxfin; int gxorg, gyorg; int x, y; int cnt; #if DEBUG_CELLFB brst_log("paintCellFb: expendable {%d, %d, %d}\n", pixexpendable[RED], pixexpendable[GRN], pixexpendable[BLU]); #endif gridToFb(ap->a_x, ap->a_y, &gx, &gy); gxorg = gx+1; gyorg = gy+1; gxfin = zoom == 1 ? gx+zoom+1 : gx+zoom; gyfin = zoom == 1 ? gy+zoom+1 : gy+zoom; cnt = gxfin - gxorg; for (y = gyorg; y < gyfin; y++) { if (zoom != 1 && (y - gy) % zoom == 0) continue; bu_semaphore_acquire(RT_SEM_STATS); (void) fb_read(fbiop, gxorg, y, (unsigned char *)pixbuf, cnt); bu_semaphore_release(RT_SEM_STATS); for (x = gxorg; x < gxfin; x++) { if (SAMERGB(&pixbuf[x-gxorg][0], pixexpendable) ) { #if DEBUG_CELLFB brst_log("Clobbering:<%d, %d>{%d, %d, %d}\n", x, y, pixbuf[x-gxorg][RED], pixbuf[x-gxorg][GRN], pixbuf[x-gxorg][BLU]); #endif COPYRGB(&pixbuf[x-gxorg][0], pixpaint); } #if DEBUG_CELLFB else brst_log("Preserving:<%d, %d>{%d, %d, %d}\n", x, y, pixbuf[x-gxorg][RED], pixbuf[x-gxorg][GRN], pixbuf[x-gxorg][BLU]); #endif } bu_semaphore_acquire(RT_SEM_STATS); (void) fb_write(fbiop, gxorg, y, (unsigned char *)pixbuf, cnt); bu_semaphore_release(RT_SEM_STATS); #if DEBUG_CELLFB brst_log("paintCellFb: fb_write(%d, %d)\n", x, y); #endif } return; }
void paintSpallFb(struct application *ap) { unsigned char pixel[3]; int x, y; int err; fastf_t celldist; #if DEBUG_SPALLFB brst_log("paintSpallFb: a_x=%d a_y=%d a_cumlen=%g cellsz=%g zoom=%d\n", ap->a_x, ap->a_y, ap->a_cumlen, cellsz, zoom); #endif pixel[RED] = ap->a_color[RED] * 255; pixel[GRN] = ap->a_color[GRN] * 255; pixel[BLU] = ap->a_color[BLU] * 255; gridToFb(ap->a_x, ap->a_y, &x, &y); CenterCell(x); /* center of cell */ CenterCell(y); celldist = ap->a_cumlen/cellsz * zoom; x = roundToInt(x + VDOT(ap->a_ray.r_dir, gridhor) * celldist); y = roundToInt(y + VDOT(ap->a_ray.r_dir, gridver) * celldist); bu_semaphore_acquire(RT_SEM_STATS); err = fb_write(fbiop, x, y, pixel, 1); bu_semaphore_release(RT_SEM_STATS); #if DEBUG_SPALLFB brst_log("paintSpallFb:gridhor=<%g, %g, %g> gridver=<%g, %g, %g>\n", gridhor[X], gridhor[Y], gridhor[Z], gridver[X], gridver[Y], gridver[Z]); brst_log("paintSpallFb:fb_write(x=%d, y=%d, pixel={%d, %d, %d})\n", x, y, (int) pixel[RED], (int) pixel[GRN], (int) pixel[BLU] ); #endif if (err == -1) brst_log("Write failed to pixel <%d, %d> from cell <%d, %d>.\n", x, y, ap->a_x, ap->a_y); return; }
void prntTrie(Trie *triep, int level) { Trie *tp = triep; static char name_buf[MAX_TRIE_LEVEL+1], *namep; if (tp == TRIE_NULL) return; if (tp->n.t_altr != TRIE_NULL) prntTrie(tp->n.t_altr, level); if (level == 0) namep = name_buf; *namep = tp->n.t_char; if (tp->n.t_next == TRIE_NULL) { /* At end of name, so print it out. */ *namep = NUL; brst_log("%s\n", name_buf); } else { namep++; prntTrie(tp->n.t_next, level+1); namep--; } return; }