// Copyright status: this file is in the public domain. #include #include "lx.h" #include "proto.h" #include "internal.h" void lx_FillPoly(LX_CONN *xc, LX_XID drawable, LX_XID gc, LX_SHAPECLASS sclass, LX_COORDMODE cmode, int npts, const LX_POINT *pts) { unsigned char *req; int reqlen; int psc; int pcm; int i; int o; const LX_POINT *p; if ( (xc->flags & XCF_FAIL) || (npts < 0) || (npts > (65535-4)) ) { lx__bad_call(xc,"lx_FillPoly"); return; } lx__nochain(xc); psc = lx__shapeclass_to_proto(sclass); pcm = lx__coordmode_to_proto(cmode); if ((psc < 0) || (pcm < 0)) { lx__bad_call(xc,"lx_FillPoly"); return; } reqlen = 4 + npts; req = malloc(reqlen<<2); if (! req) { lx__nomem_fail(xc); return; } req[0] = XP_REQ_FillPoly; req[1] = 0; w_card16(&req[2],reqlen); w_card32(&req[4],drawable); w_card32(&req[8],gc); req[12] = psc; req[13] = pcm; o = 16; for (i=0;ix < -32768) || (p->x > 32767) || (p->y < -32768) || (p->y > 32767) ) { free(req); lx__bad_call(xc,"lx_FillPoly"); return; } w_int16(&req[o],p->x); w_int16(&req[o+2],p->y); o += 4; } lx__send_req_free(xc,req,reqlen<<2); }