Add stubs for Direct3D9 backend.
[cairo/gpu.git] / src / cairo-xlib-private.h
blobc79617bf531bd832f670fe20678c0079e3a34eef
1 /* Cairo - a vector graphics library with display and print output
3 * Copyright © 2005 Red Hat, Inc.
5 * This library is free software; you can redistribute it and/or
6 * modify it either under the terms of the GNU Lesser General Public
7 * License version 2.1 as published by the Free Software Foundation
8 * (the "LGPL") or, at your option, under the terms of the Mozilla
9 * Public License Version 1.1 (the "MPL"). If you do not alter this
10 * notice, a recipient may use your version of this file under either
11 * the MPL or the LGPL.
13 * You should have received a copy of the LGPL along with this library
14 * in the file COPYING-LGPL-2.1; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 * You should have received a copy of the MPL along with this library
17 * in the file COPYING-MPL-1.1
19 * The contents of this file are subject to the Mozilla Public License
20 * Version 1.1 (the "License"); you may not use this file except in
21 * compliance with the License. You may obtain a copy of the License at
22 * http://www.mozilla.org/MPL/
24 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
25 * OF ANY KIND, either express or implied. See the LGPL or the MPL for
26 * the specific language governing rights and limitations.
28 * The Original Code is the cairo graphics library.
30 * The Initial Developer of the Original Code is Red Hat, Inc.
32 * Contributors(s):
33 * Chris Wilson <chris@chris-wilson.co.uk>
34 * Karl Tomlinson <karlt+@karlt.net>, Mozilla Corporation
37 #ifndef CAIRO_XLIB_PRIVATE_H
38 #define CAIRO_XLIB_PRIVATE_H
40 #include "cairo-xlib.h"
41 #include "cairo-xlib-xrender-private.h"
43 #include "cairo-compiler-private.h"
44 #include "cairo-freelist-private.h"
45 #include "cairo-mutex-private.h"
46 #include "cairo-reference-count-private.h"
48 typedef struct _cairo_xlib_display cairo_xlib_display_t;
49 typedef struct _cairo_xlib_hook cairo_xlib_hook_t;
50 typedef struct _cairo_xlib_job cairo_xlib_job_t;
51 typedef void (*cairo_xlib_notify_func) (Display *, void *);
52 typedef void (*cairo_xlib_notify_resource_func) (Display *, XID);
54 struct _cairo_xlib_hook {
55 cairo_xlib_hook_t *prev, *next; /* private */
56 void (*func) (cairo_xlib_display_t *display, void *data);
59 struct _cairo_xlib_display {
60 cairo_xlib_display_t *next;
61 cairo_reference_count_t ref_count;
62 cairo_mutex_t mutex;
64 Display *display;
65 cairo_xlib_screen_info_t *screens;
67 int render_major;
68 int render_minor;
69 XRenderPictFormat *cached_xrender_formats[CAIRO_FORMAT_A1 + 1];
71 cairo_xlib_job_t *workqueue;
72 cairo_freelist_t wq_freelist;
74 cairo_xlib_hook_t *close_display_hooks;
75 unsigned int buggy_repeat :1;
76 unsigned int buggy_pad_reflect :1;
77 unsigned int closed :1;
80 /* size of color cube */
81 #define CUBE_SIZE 6
82 /* size of gray ramp */
83 #define RAMP_SIZE 16
85 typedef struct _cairo_xlib_visual_info {
86 VisualID visualid;
87 struct { uint8_t a, r, g, b; } colors[256];
88 uint8_t cube_to_pseudocolor[CUBE_SIZE][CUBE_SIZE][CUBE_SIZE];
89 uint8_t field8_to_cube[256];
90 int8_t dither8_to_cube[256];
91 uint8_t gray8_to_pseudocolor[256];
92 } cairo_xlib_visual_info_t;
94 struct _cairo_xlib_screen_info {
95 cairo_xlib_screen_info_t *next;
96 cairo_reference_count_t ref_count;
97 cairo_mutex_t mutex;
99 cairo_xlib_display_t *display;
100 Screen *screen;
101 cairo_bool_t has_render;
103 cairo_bool_t has_font_options;
104 cairo_font_options_t font_options;
106 GC gc[4];
107 int gc_depths; /* 4 x uint8_t, high bit == needs reset */
109 cairo_array_t visuals;
112 cairo_private cairo_status_t
113 _cairo_xlib_display_get (Display *display, cairo_xlib_display_t **out);
115 cairo_private cairo_xlib_display_t *
116 _cairo_xlib_display_reference (cairo_xlib_display_t *info);
117 cairo_private void
118 _cairo_xlib_display_destroy (cairo_xlib_display_t *info);
120 cairo_private void
121 _cairo_xlib_add_close_display_hook (cairo_xlib_display_t *display, cairo_xlib_hook_t *hook);
123 cairo_private void
124 _cairo_xlib_remove_close_display_hook (cairo_xlib_display_t *display, cairo_xlib_hook_t *hook);
126 cairo_private cairo_status_t
127 _cairo_xlib_display_queue_work (cairo_xlib_display_t *display,
128 cairo_xlib_notify_func notify,
129 void *data,
130 void (*destroy)(void *));
131 cairo_private cairo_status_t
132 _cairo_xlib_display_queue_resource (cairo_xlib_display_t *display,
133 cairo_xlib_notify_resource_func notify,
134 XID resource);
135 cairo_private void
136 _cairo_xlib_display_notify (cairo_xlib_display_t *display);
138 cairo_private XRenderPictFormat *
139 _cairo_xlib_display_get_xrender_format (cairo_xlib_display_t *display,
140 cairo_format_t format);
142 cairo_private cairo_status_t
143 _cairo_xlib_screen_info_get (cairo_xlib_display_t *display,
144 Screen *screen,
145 cairo_xlib_screen_info_t **out);
147 cairo_private cairo_xlib_screen_info_t *
148 _cairo_xlib_screen_info_reference (cairo_xlib_screen_info_t *info);
149 cairo_private void
150 _cairo_xlib_screen_info_destroy (cairo_xlib_screen_info_t *info);
152 cairo_private void
153 _cairo_xlib_screen_info_close_display (cairo_xlib_screen_info_t *info);
155 cairo_private GC
156 _cairo_xlib_screen_get_gc (cairo_xlib_screen_info_t *info,
157 unsigned int depth,
158 Drawable drawable,
159 unsigned int *need_reset);
161 cairo_private void
162 _cairo_xlib_screen_put_gc (cairo_xlib_screen_info_t *info,
163 unsigned int depth,
164 GC gc,
165 cairo_bool_t reset_clip);
167 cairo_private cairo_font_options_t *
168 _cairo_xlib_screen_get_font_options (cairo_xlib_screen_info_t *info);
170 cairo_private cairo_status_t
171 _cairo_xlib_screen_get_visual_info (cairo_xlib_screen_info_t *info,
172 Visual *visual,
173 cairo_xlib_visual_info_t **out);
175 cairo_private cairo_status_t
176 _cairo_xlib_visual_info_create (Display *dpy,
177 int screen,
178 VisualID visualid,
179 cairo_xlib_visual_info_t **out);
181 cairo_private void
182 _cairo_xlib_visual_info_destroy (Display *dpy, cairo_xlib_visual_info_t *info);
184 #endif /* CAIRO_XLIB_PRIVATE_H */