]> git.cworth.org Git - apitrace/blob - dispatch/xproc.hpp
stash: Trace and replay of glx-tfp works
[apitrace] / dispatch / xproc.hpp
1 #ifndef _XPROC_HPP_
2 #define _XPROC_HPP_
3
4 #include <X/X11.h>
5
6 #include "os.hpp"
7
8 #if defined(HAVE_X11)
9
10 typedef Pixmap (* PFN_XCREATEPIXMAP)(Display * dpy, Drawable d, unsigned int width, unsigned int height, unsigned int depth);
11 static PFN_XCREATEPIXMAP _XCreatePixmap_ptr = NULL;
12
13 static inline Pixmap _XCreatePixmap(Display * dpy, Drawable d, unsigned int width, unsigned int height, unsigned int depth) {
14     const char *_name = "XCreatePixmap";
15     if (!_XCreatePixmap_ptr) {
16         _XCreatePixmap_ptr = (PFN_XCREATEPIXMAP)_getPublicProcAddress(_name);
17         if (!_XCreatePixmap_ptr) {
18             os::log("error: unavailable function %s\n", _name);
19             os::abort();
20         }
21     }
22     return _XCreatePixmap_ptr(dpy, d, width, height, depth);
23 }
24
25 typedef int (* PFN_XFREEPIXMAP)(Display * dpy, Drawable pixmap);
26 static PFN_XFREEPIXMAP _XFreePixmap_ptr = NULL;
27
28 static inline int _XFreePixmap(Display * dpy, Drawable pixmap) {
29     const char *_name = "XFreePixmap";
30     if (!_XFreePixmap_ptr) {
31         _XFreePixmap_ptr = (PFN_XFREEPIXMAP)_getPrivateProcAddress(_name);
32         if (!_XFreePixmap_ptr) {
33             os::log("error: unavailable function %s\n", _name);
34             os::abort();
35         }
36     }
37     return _XFreePixmap_ptr(dpy, pixmap);
38 }
39
40 #ifdef RETRACE
41 #define XCreatePixmap _XCreatePixmap
42 #define XFreePixmap _XFreePixmap
43 #endif /* RETRACE */
44
45
46 #endif