|
Packit |
5bd3a9 |
/*
|
|
Packit |
5bd3a9 |
|
|
Packit |
5bd3a9 |
Copyright 1986, 1998 The Open Group
|
|
Packit |
5bd3a9 |
|
|
Packit |
5bd3a9 |
Permission to use, copy, modify, distribute, and sell this software and its
|
|
Packit |
5bd3a9 |
documentation for any purpose is hereby granted without fee, provided that
|
|
Packit |
5bd3a9 |
the above copyright notice appear in all copies and that both that
|
|
Packit |
5bd3a9 |
copyright notice and this permission notice appear in supporting
|
|
Packit |
5bd3a9 |
documentation.
|
|
Packit |
5bd3a9 |
|
|
Packit |
5bd3a9 |
The above copyright notice and this permission notice shall be included in
|
|
Packit |
5bd3a9 |
all copies or substantial portions of the Software.
|
|
Packit |
5bd3a9 |
|
|
Packit |
5bd3a9 |
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
Packit |
5bd3a9 |
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
Packit |
5bd3a9 |
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
Packit |
5bd3a9 |
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
|
Packit |
5bd3a9 |
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
Packit |
5bd3a9 |
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
Packit |
5bd3a9 |
|
|
Packit |
5bd3a9 |
Except as contained in this notice, the name of The Open Group shall not be
|
|
Packit |
5bd3a9 |
used in advertising or otherwise to promote the sale, use or other dealings
|
|
Packit |
5bd3a9 |
in this Software without prior written authorization from The Open Group.
|
|
Packit |
5bd3a9 |
|
|
Packit |
5bd3a9 |
*/
|
|
Packit |
5bd3a9 |
|
|
Packit |
5bd3a9 |
#ifdef HAVE_CONFIG_H
|
|
Packit |
5bd3a9 |
#include <config.h>
|
|
Packit |
5bd3a9 |
#endif
|
|
Packit |
5bd3a9 |
#include "Xlibint.h"
|
|
Packit |
5bd3a9 |
|
|
Packit |
5bd3a9 |
/* precompute the maximum size of batching request allowed */
|
|
Packit |
5bd3a9 |
|
|
Packit |
5bd3a9 |
#define wsize (SIZEOF(xPolySegmentReq) + WLNSPERBATCH * SIZEOF(xSegment))
|
|
Packit |
5bd3a9 |
#define zsize (SIZEOF(xPolySegmentReq) + ZLNSPERBATCH * SIZEOF(xSegment))
|
|
Packit |
5bd3a9 |
|
|
Packit |
5bd3a9 |
int
|
|
Packit |
5bd3a9 |
XDrawLine (
|
|
Packit |
5bd3a9 |
register Display *dpy,
|
|
Packit |
5bd3a9 |
Drawable d,
|
|
Packit |
5bd3a9 |
GC gc,
|
|
Packit |
5bd3a9 |
int x1,
|
|
Packit |
5bd3a9 |
int y1,
|
|
Packit |
5bd3a9 |
int x2,
|
|
Packit |
5bd3a9 |
int y2)
|
|
Packit |
5bd3a9 |
{
|
|
Packit |
5bd3a9 |
register xSegment *segment;
|
|
Packit |
5bd3a9 |
|
|
Packit |
5bd3a9 |
LockDisplay(dpy);
|
|
Packit |
5bd3a9 |
FlushGC(dpy, gc);
|
|
Packit |
5bd3a9 |
|
|
Packit |
5bd3a9 |
{
|
|
Packit |
5bd3a9 |
register xPolySegmentReq *req = (xPolySegmentReq *) dpy->last_req;
|
|
Packit |
5bd3a9 |
|
|
Packit |
5bd3a9 |
/* if same as previous request, with same drawable, batch requests */
|
|
Packit |
5bd3a9 |
if (
|
|
Packit |
5bd3a9 |
(req->reqType == X_PolySegment)
|
|
Packit |
5bd3a9 |
&& (req->drawable == d)
|
|
Packit |
5bd3a9 |
&& (req->gc == gc->gid)
|
|
Packit |
5bd3a9 |
&& ((dpy->bufptr + SIZEOF(xSegment)) <= dpy->bufmax)
|
|
Packit |
5bd3a9 |
&& (((char *)dpy->bufptr - (char *)req) < (gc->values.line_width ?
|
|
Packit |
5bd3a9 |
wsize : zsize)) ) {
|
|
Packit |
5bd3a9 |
req->length += SIZEOF(xSegment) >> 2;
|
|
Packit |
5bd3a9 |
segment = (xSegment *) dpy->bufptr;
|
|
Packit |
5bd3a9 |
dpy->bufptr += SIZEOF(xSegment);
|
|
Packit |
5bd3a9 |
}
|
|
Packit |
5bd3a9 |
|
|
Packit |
5bd3a9 |
else {
|
|
Packit |
5bd3a9 |
GetReqExtra (PolySegment, SIZEOF(xSegment), req);
|
|
Packit |
5bd3a9 |
req->drawable = d;
|
|
Packit |
5bd3a9 |
req->gc = gc->gid;
|
|
Packit |
5bd3a9 |
segment = (xSegment *) NEXTPTR(req,xPolySegmentReq);
|
|
Packit |
5bd3a9 |
}
|
|
Packit |
5bd3a9 |
|
|
Packit |
5bd3a9 |
segment->x1 = x1;
|
|
Packit |
5bd3a9 |
segment->y1 = y1;
|
|
Packit |
5bd3a9 |
segment->x2 = x2;
|
|
Packit |
5bd3a9 |
segment->y2 = y2;
|
|
Packit |
5bd3a9 |
|
|
Packit |
5bd3a9 |
UnlockDisplay(dpy);
|
|
Packit |
5bd3a9 |
SyncHandle();
|
|
Packit |
5bd3a9 |
}
|
|
Packit |
5bd3a9 |
return 1;
|
|
Packit |
5bd3a9 |
}
|
|
Packit |
5bd3a9 |
|