#include #include #include #include #include #include void lx_shape_Rectangles(LX_CONN *xc, LX_XID dst, LX_SHAPE_KIND kind, LX_SHAPE_OP op, int xoff, int yoff, LX_RECTORDER order, int nr, const LX_RECTANGLE *rects) { LX_SHAPE_PRIV *p; int proto_kind; int proto_op; int proto_order; unsigned char *req; int reqlen; int i; int o; const LX_RECTANGLE *r; p = lx_get_private(xc,lx_shape__px); if (! p) { lxxi_bad_call(xc,"lx_shape_Rectangles"); return; } proto_kind = lx_shape__kind_to_proto(kind); proto_op = lx_shape__op_to_proto(op); proto_order = lxxi_rectorder_to_proto(order); if ( (proto_kind < 0) || (proto_op < 0) || (proto_order < 0) || (nr < 0) || (nr > (65535-4)/2) || (xoff < -32768) || (xoff > 32767) || (yoff < -32768) || (yoff > 32767) ) { lxxi_bad_call(xc,"lx_shape_Rectangles"); return; } reqlen = 4 + (2 * nr); if (reqlen > 65535) { lxxi_bad_call(xc,"lx_shape_Rectangles"); return; } for (i=0;ix < -32768) || (r->x > 32767) || (r->y < -32768) || (r->y > 32767) || (r->w > 65535) || (r->h > 65535) ) { lxxi_bad_call(xc,"lx_shape_Rectangles"); return; } } lxxi_nochain(xc); req = malloc(reqlen<<2); if (! req) { lxxi_nomem_fail(xc); return; } req[0] = p->major; req[1] = SHAPE_Rectangles; lxxi_w_card16(&req[2],reqlen); req[4] = proto_op; req[5] = proto_kind; req[6] = proto_order; req[7] = 0; lxxi_w_card32(&req[8],dst); lxxi_w_int16(&req[12],xoff); lxxi_w_int16(&req[14],yoff); o = 16; for (i=0;ix); lxxi_w_int16(&req[o+2],r->y); lxxi_w_card16(&req[o+4],r->w); lxxi_w_card16(&req[o+6],r->h); o += 8; } lxxi_send_req_free(xc,req,reqlen<<2); }