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#ifdef HAVE_CONFIG_H
29#include <config.h>
30#endif
31#include <X11/Xlibint.h>
32#include <X11/Xutil.h>
33#include <X11/extensions/renderproto.h>
34#include "Xrender.h"
35
36#ifndef _X_UNUSED
37#define _X_UNUSED /* nothing */
38#endif
39
40typedef struct {
41    Visual		*visual;
42    XRenderPictFormat	*format;
43} XRenderVisual;
44
45typedef struct {
46    int			depth;
47    int			nvisuals;
48    XRenderVisual	*visuals;
49} XRenderDepth;
50
51typedef struct {
52    XRenderDepth	*depths;
53    int			ndepths;
54    XRenderPictFormat	*fallback;
55    int			subpixel;
56} XRenderScreen;
57
58typedef struct _XRenderInfo {
59    int			major_version;
60    int			minor_version;
61    XRenderPictFormat	*format;
62    int			nformat;
63    XRenderScreen	*screen;
64    int			nscreen;
65    XRenderDepth	*depth;
66    int			ndepth;
67    XRenderVisual	*visual;
68    int			nvisual;
69    int			*subpixel;
70    int			nsubpixel;
71    char		**filter;
72    int			nfilter;
73    short    		*filter_alias;
74    int			nfilter_alias;
75} XRenderInfo;
76
77/* replaces XRenderExtDisplayInfo */
78typedef struct _XRenderExtDisplayInfo {
79    struct _XRenderExtDisplayInfo *next;    /* keep a linked list */
80    Display                       *display; /* which display this is */
81    XExtCodes                     *codes;   /* the extension protocol codes */
82    XRenderInfo                   *info;    /* extra data for the extension to use */
83} XRenderExtDisplayInfo;
84
85/* replaces XExtensionInfo */
86typedef struct _XRenderExtInfo {
87    XRenderExtDisplayInfo  *head;           /* start of the list */
88    XRenderExtDisplayInfo  *cur;            /* most recently used */
89    int                     ndisplays;      /* number of displays */
90} XRenderExtInfo;
91
92extern XRenderExtInfo XRenderExtensionInfo;
93extern char XRenderExtensionName[];
94
95XRenderExtDisplayInfo *
96XRenderFindDisplay (Display *dpy);
97
98#define RenderHasExtension(i) ((i) && ((i)->codes))
99
100#define RenderCheckExtension(dpy,i,val) \
101  if (!RenderHasExtension(i)) { return val; }
102
103#define RenderSimpleCheckExtension(dpy,i) \
104  if (!RenderHasExtension(i)) { return; }
105
106/*
107 * Xlib uses long for 32-bit values.  Xrender uses int.  This
108 * matters on alpha.  Note that this macro assumes that int is 32 bits
109 * except on WORD64 machines where it is 64 bits.
110 */
111
112#ifdef WORD64
113#define DataInt32(dpy,d,len)	Data32(dpy,(_Xconst long *) (d),len)
114#else
115#define DataInt32(dpy,d,len)	Data(dpy,(_Xconst char *) (d),len)
116#endif
117
118#endif /* _XRENDERINT_H_ */
119