2 /* Copyright (C) 2002 Olivier Chapuis */
3 /* This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2 of the License, or
6 * (at your option) any later version.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 /* ---------------------------- included header files ---------------------- */
27 #include "PictureBase.h"
28 #include "FRenderInit.h"
30 /* ---------------------------- local definitions -------------------------- */
32 /* ---------------------------- local macros ------------------------------- */
34 /* ---------------------------- imports ------------------------------------ */
36 /* ---------------------------- included code files ------------------------ */
38 /* ---------------------------- local types -------------------------------- */
40 /* ---------------------------- forward declarations ----------------------- */
42 /* ---------------------------- local variables ---------------------------- */
44 Bool FRenderExtensionSupported
= False
;
45 int FRenderErrorBase
= -10000;
46 int FRenderMajorOpCode
= -10000;
47 int FRenderAlphaDepth
= 0;
49 /* ---------------------------- exported variables (globals) --------------- */
51 /* ---------------------------- local functions ---------------------------- */
53 void FRenderInit(Display
*dpy
)
57 FRenderAlphaDepth
= 8;
58 if (!XRenderSupport
|| !(FRenderExtensionSupported
= XQueryExtension(
59 dpy
, "RENDER", &FRenderMajorOpCode
, &event_basep
,
66 FRenderErrorBase
= -10000;
67 FRenderMajorOpCode
= -10000;
68 FRenderExtensionSupported
= 0;
69 pmf
= XListDepths(dpy
, DefaultScreen(dpy
), &n
);
80 else if (pmf
[i
] >= 8 &&
81 (pmf
[i
] < alpha_depth
||
90 FRenderAlphaDepth
= alpha_depth
;
95 int FRenderGetErrorCodeBase(void)
97 return FRenderErrorBase
;
100 int FRenderGetMajorOpCode(void)
102 return FRenderMajorOpCode
;
105 Bool
FRenderGetExtensionSupported(void)
107 return FRenderExtensionSupported
;
110 int FRenderGetAlphaDepth(void)
112 return FRenderAlphaDepth
;
115 Bool
FRenderGetErrorText(int code
, char *msg
)
120 static char *error_names
[] = {
128 if (code
>= FRenderErrorBase
&&
129 code
<= FRenderErrorBase
+
130 (sizeof(error_names
) / sizeof(char *)) -1)
132 sprintf(msg
, error_names
[code
- FRenderErrorBase
]);