void p_lines(p_win *w) { p_scr *s = w->s; Display *dpy = s->xdpy->dpy; GC gc = x_getgc(s, w, FillSolid); int nmx = XMaxRequestSize(dpy)-3; int n = x_pt_count; x_pt_count = 0; while (n>1) { if (n<nmx) nmx = n; XDrawLines(dpy, w->d, gc, x_pt_list, nmx, CoordModeOrigin); n -= nmx; } if (p_signalling) p_abort(); }
void p_segments(p_win *w) { p_scr *s = w->s; Display *dpy = s->xdpy->dpy; GC gc = x_getgc(s, w, FillSolid); int nmx = (XMaxRequestSize(dpy)-3)/2; int n = x_pt_count / 2; x_pt_count = 0; while (n>0) { if (n<nmx) nmx = n; /* note: assume here that XPoint[2] identical to XSegment */ XDrawSegments(dpy, w->d, gc, (XSegment *)x_pt_list, nmx); n -= nmx; } if (p_signalling) p_abort(); }
void p_rect(p_win *w, int x0, int y0, int x1, int y1, int border) { p_scr *s = w->s; Display *dpy = s->xdpy->dpy; GC gc = x_getgc(s, w, FillSolid); int tmp; if (x1 > x0) x1 -= x0; else tmp = x0-x1, x0 = x1, x1 = tmp; if (y1 > y0) y1 -= y0; else tmp = y0-y1, y0 = y1, y1 = tmp; if (border) XDrawRectangle(dpy, w->d, gc, x0, y0, x1, y1); else XFillRectangle(dpy, w->d, gc, x0, y0, x1, y1); if (p_signalling) p_abort(); }
void p_ellipse(p_win *w, int x0, int y0, int x1, int y1, int border) { p_scr *s = w->s; Display *dpy = s->xdpy->dpy; GC gc = x_getgc(s, w, FillSolid); int tmp; if (x1 > x0) x1 -= x0; else tmp = x0-x1, x0 = x1, x1 = tmp; if (y1 > y0) y1 -= y0; else tmp = y0-y1, y0 = y1, y1 = tmp; if (border) XDrawArc(dpy, w->d, gc, x0, y0, x1, y1, 0, 360*64); else XFillArc(dpy, w->d, gc, x0-1, y0-1, x1+2, y1+2, 0, 360*64); if (p_signalling) p_abort(); }