summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2004-08-07 00:40:40 +0000
committerKeith Packard <keithp@keithp.com>2004-08-07 00:40:40 +0000
commit87e1ae59ec19eeeee70978c922c43e1b219699d5 (patch)
tree68f2e6a56720ff0b13ef5100e50fba4973e00e59
parenta8302c03f1810fe30aea90f3d42a77663e5cd8a0 (diff)
-rw-r--r--include/X11/extensions/Xrender.h17
-rw-r--r--src/AddTrap.c67
2 files changed, 84 insertions, 0 deletions
diff --git a/include/X11/extensions/Xrender.h b/include/X11/extensions/Xrender.h
index 6af21b1..d2cf6e5 100644
--- a/include/X11/extensions/Xrender.h
+++ b/include/X11/extensions/Xrender.h
@@ -169,6 +169,14 @@ typedef struct _XAnimCursor {
unsigned long delay;
} XAnimCursor;
+typedef struct _XSpanFix {
+ XFixed left, right, y;
+} XSpanFix;
+
+typedef struct _XTrap {
+ XSpanFix top, bottom;
+} XTrap;
+
_XFUNCPROTOBEGIN
Bool XRenderQueryExtension (Display *dpy, int *event_basep, int *error_basep);
@@ -464,6 +472,15 @@ XRenderCreateAnimCursor (Display *dpy,
int ncursor,
XAnimCursor *cursors);
+
+void
+XRenderAddTraps (Display *dpy,
+ Picture picture,
+ int xOff,
+ int yOff,
+ _Xconst XTrap *traps,
+ int ntrap);
+
_XFUNCPROTOEND
#endif /* _XRENDER_H_ */
diff --git a/src/AddTrap.c b/src/AddTrap.c
new file mode 100644
index 0000000..0449257
--- /dev/null
+++ b/src/AddTrap.c
@@ -0,0 +1,67 @@
+/*
+ * $Id$
+ *
+ * Copyright © 2004 Keith Packard
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Keith Packard not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Keith Packard makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include "Xrenderint.h"
+
+#define NLOCAL 256
+
+void
+XRenderAddTraps (Display *dpy,
+ Picture picture,
+ int xOff,
+ int yOff,
+ _Xconst XTrap *traps,
+ int ntrap)
+{
+ XRenderExtDisplayInfo *info = XRenderFindDisplay (dpy);
+ xRenderAddTrapsReq *req;
+ int n;
+ long len;
+ unsigned long max_req = dpy->bigreq_size ? dpy->bigreq_size : dpy->max_request_size;
+
+ RenderSimpleCheckExtension (dpy, info);
+ LockDisplay(dpy);
+ while (ntrap)
+ {
+ GetReq(RenderAddTraps, req);
+ req->reqType = info->codes->major_opcode;
+ req->renderReqType = X_RenderAddTraps;
+ req->picture = picture;
+ req->xOff = xOff;
+ req->yOff = yOff;
+ n = ntrap;
+ len = ((long) n) * (SIZEOF (xTrap) >> 2);
+ if (len > (max_req - req->length)) {
+ n = (max_req - req->length) / (SIZEOF (xTrap) >> 2);
+ len = ((long)n) * (SIZEOF (xTrap) >> 2);
+ }
+ SetReqLen (req, len, len);
+ len <<= 2;
+ DataInt32 (dpy, (int *) traps, len);
+ ntrap -= n;
+ traps += n;
+ }
+ UnlockDisplay(dpy);
+ SyncHandle();
+}