void paintrect( /* paint picture rectangle */ PNODE *p, RECT *r ) { int mx, my; if (p->xmax - p->xmin <= 0 || p->ymax - p->ymin <= 0) return; if (p->kid == NULL) { (*dev->paintr)(greyscale?greyof(p->v):p->v, p->xmin, p->ymin, p->xmax, p->ymax); /* do this */ return; } mx = (p->xmin + p->xmax) >> 1; /* do kids */ my = (p->ymin + p->ymax) >> 1; if (mx > r->l) { if (my > r->d) paintrect(p->kid+DL, r); if (my < r->u) paintrect(p->kid+UL, r); } if (mx < r->r) { if (my > r->d) paintrect(p->kid+DR, r); if (my < r->u) paintrect(p->kid+UR, r); } }
void getrepaint( /* get area and repaint */ char *s ) { RECT box; if (getrect(s, &box) < 0) return; paintrect(&ptrunk, &box); }
void repaint( /* repaint a region */ int xmin, int ymin, int xmax, int ymax ) { RECT reg; reg.l = xmin; reg.r = xmax; reg.d = ymin; reg.u = ymax; paintrect(&ptrunk, ®); }