// Copyright status: this file is in the public domain. #include #include "lx.h" #include "proto.h" #include "internal.h" static void common_PolySegment(LX_CONN *xc, LX_XID drawable, LX_XID gc, int nseg, const LX_SEGMENT *segs) { unsigned char *req; int i; int o; const LX_SEGMENT *s; if ( (xc->flags & XCF_FAIL) || (nseg > ((65535-3)/2)) ) { lx__bad_call(xc,"lx_PolySegment"); return; } req = malloc(12+(8*nseg)); if (! req) { lx__nomem_fail(xc); return; } req[0] = XP_REQ_PolySegment; req[1] = 0; w_card16(&req[2],3+(2*nseg)); w_card32(&req[4],drawable); w_card32(&req[8],gc); o = 12; for (i=0;ix1 < -32768) || (s->x1 > 32767) || (s->y1 < -32768) || (s->y1 > 32767) || (s->x2 < -32768) || (s->x2 > 32767) || (s->y2 < -32768) || (s->y2 > 32767) ) { free(req); lx__bad_call(xc,"lx_PolySegment"); return; } w_int16(&req[o],s->x1); w_int16(&req[o+2],s->y1); w_int16(&req[o+4],s->x2); w_int16(&req[o+6],s->y2); o += 8; } lx__send_req_free(xc,req,12+(8*nseg)); } void lx_PolySegment(LX_CONN *xc, LX_XID drawable, LX_XID gc, int nseg, const LX_SEGMENT *segs) { lx__nochain(xc); common_PolySegment(xc,drawable,gc,nseg,segs); } void lx__PolySegment_inbatch(LX_CONN *xc, LX_XID drawable, LX_XID gc, int nseg, const LX_SEGMENT *segs) { common_PolySegment(xc,drawable,gc,nseg,segs); }