1 /*
2  *
3  * Copyright © 2000 SuSE, Inc.
4  *
5  * Permission to use, copy, modify, distribute, and sell this software and its
6  * documentation for any purpose is hereby granted without fee, provided that
7  * the above copyright notice appear in all copies and that both that
8  * copyright notice and this permission notice appear in supporting
9  * documentation, and that the name of SuSE not be used in advertising or
10  * publicity pertaining to distribution of the software without specific,
11  * written prior permission.  SuSE makes no representations about the
12  * suitability of this software for any purpose.  It is provided "as is"
13  * without express or implied warranty.
14  *
15  * SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
16  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE
17  * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
18  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
19  * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
20  * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
21  *
22  * Author:  Keith Packard, SuSE, Inc.
23  */
24 
25 #ifndef _XRENDERINT_H_
26 #define _XRENDERINT_H_
27 
28 #include "config.h"
29 #include <X11/Xlibint.h>
30 #include <X11/Xutil.h>
31 #include <X11/extensions/renderproto.h>
32 #include "Xrender.h"
33 
34 typedef struct {
35     Visual		*visual;
36     XRenderPictFormat	*format;
37 } XRenderVisual;
38 
39 typedef struct {
40     int			depth;
41     int			nvisuals;
42     XRenderVisual	*visuals;
43 } XRenderDepth;
44 
45 typedef struct {
46     XRenderDepth	*depths;
47     int			ndepths;
48     XRenderPictFormat	*fallback;
49     int			subpixel;
50 } XRenderScreen;
51 
52 typedef struct _XRenderInfo {
53     int			major_version;
54     int			minor_version;
55     XRenderPictFormat	*format;
56     int			nformat;
57     XRenderScreen	*screen;
58     int			nscreen;
59     XRenderDepth	*depth;
60     int			ndepth;
61     XRenderVisual	*visual;
62     int			nvisual;
63     int			*subpixel;
64     int			nsubpixel;
65     char		**filter;
66     int			nfilter;
67     short    		*filter_alias;
68     int			nfilter_alias;
69 } XRenderInfo;
70 
71 /* replaces XRenderExtDisplayInfo */
72 typedef struct _XRenderExtDisplayInfo {
73     struct _XRenderExtDisplayInfo *next;    /* keep a linked list */
74     Display                       *display; /* which display this is */
75     XExtCodes                     *codes;   /* the extension protocol codes */
76     XRenderInfo                   *info;    /* extra data for the extension to use */
77 } XRenderExtDisplayInfo;
78 
79 /* replaces XExtensionInfo */
80 typedef struct _XRenderExtInfo {
81     XRenderExtDisplayInfo  *head;           /* start of the list */
82     XRenderExtDisplayInfo  *cur;            /* most recently used */
83     int                     ndisplays;      /* number of displays */
84 } XRenderExtInfo;
85 
86 extern XRenderExtInfo XRenderExtensionInfo;
87 extern char XRenderExtensionName[];
88 
89 XRenderExtDisplayInfo *
90 XRenderFindDisplay (Display *dpy);
91 
92 #define RenderHasExtension(i) ((i) && ((i)->codes))
93 
94 #define RenderCheckExtension(dpy,i,val) \
95   if (!RenderHasExtension(i)) { return val; }
96 
97 #define RenderSimpleCheckExtension(dpy,i) \
98   if (!RenderHasExtension(i)) { return; }
99 
100 /*
101  * Xlib uses long for 32-bit values.  Xrender uses int.  This
102  * matters on alpha.  Note that this macro assumes that int is 32 bits
103  * except on WORD64 machines where it is 64 bits.
104  */
105 
106 #ifdef WORD64
107 #define DataInt32(dpy,d,len)	Data32(dpy,(long *) (d),len)
108 #else
109 #define DataInt32(dpy,d,len)	Data(dpy,(char *) (d),len)
110 #endif
111 
112 #endif /* _XRENDERINT_H_ */
113