Go to most recent revision | Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1892 | serge | 1 | /* Cairo - a vector graphics library with display and print output |
2 | * |
||
3 | * Copyright © 2005 Red Hat, Inc. |
||
4 | * |
||
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. |
||
12 | * |
||
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., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA |
||
16 | * You should have received a copy of the MPL along with this library |
||
17 | * in the file COPYING-MPL-1.1 |
||
18 | * |
||
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/ |
||
23 | * |
||
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. |
||
27 | * |
||
28 | * The Original Code is the cairo graphics library. |
||
29 | * |
||
30 | * The Initial Developer of the Original Code is Red Hat, Inc. |
||
31 | * |
||
32 | * Contributors(s): |
||
33 | * Chris Wilson |
||
34 | * Karl Tomlinson |
||
35 | */ |
||
36 | |||
37 | #ifndef CAIRO_XLIB_PRIVATE_H |
||
38 | #define CAIRO_XLIB_PRIVATE_H |
||
39 | |||
40 | #include "cairo-xlib.h" |
||
41 | #include "cairo-xlib-xrender-private.h" |
||
42 | |||
43 | #include "cairo-compiler-private.h" |
||
44 | #include "cairo-device-private.h" |
||
45 | #include "cairo-freelist-type-private.h" |
||
46 | #include "cairo-list-private.h" |
||
47 | #include "cairo-reference-count-private.h" |
||
48 | #include "cairo-types-private.h" |
||
49 | |||
50 | typedef struct _cairo_xlib_display cairo_xlib_display_t; |
||
51 | typedef struct _cairo_xlib_screen cairo_xlib_screen_t; |
||
52 | |||
53 | typedef struct _cairo_xlib_hook cairo_xlib_hook_t; |
||
54 | typedef struct _cairo_xlib_job cairo_xlib_job_t; |
||
55 | typedef void (*cairo_xlib_notify_func) (Display *, void *); |
||
56 | typedef void (*cairo_xlib_notify_resource_func) (Display *, XID); |
||
57 | |||
58 | struct _cairo_xlib_hook { |
||
59 | cairo_xlib_hook_t *prev, *next; /* private */ |
||
60 | void (*func) (cairo_xlib_display_t *display, void *data); |
||
61 | }; |
||
62 | |||
63 | /* size of color cube */ |
||
64 | #define CUBE_SIZE 6 |
||
65 | /* size of gray ramp */ |
||
66 | #define RAMP_SIZE 16 |
||
67 | |||
68 | struct _cairo_xlib_display { |
||
69 | cairo_device_t base; |
||
70 | |||
71 | cairo_xlib_display_t *next; |
||
72 | |||
73 | Display *display; |
||
74 | cairo_list_t screens; |
||
75 | |||
76 | int render_major; |
||
77 | int render_minor; |
||
78 | XRenderPictFormat *cached_xrender_formats[CAIRO_FORMAT_RGB16_565 + 1]; |
||
79 | |||
80 | cairo_xlib_job_t *workqueue; |
||
81 | cairo_freelist_t wq_freelist; |
||
82 | |||
83 | cairo_xlib_hook_t *close_display_hooks; |
||
84 | unsigned int buggy_gradients :1; |
||
85 | unsigned int buggy_pad_reflect :1; |
||
86 | unsigned int buggy_repeat :1; |
||
87 | unsigned int closed :1; |
||
88 | }; |
||
89 | |||
90 | typedef struct _cairo_xlib_visual_info { |
||
91 | cairo_list_t link; |
||
92 | VisualID visualid; |
||
93 | struct { uint8_t a, r, g, b; } colors[256]; |
||
94 | uint8_t cube_to_pseudocolor[CUBE_SIZE][CUBE_SIZE][CUBE_SIZE]; |
||
95 | uint8_t field8_to_cube[256]; |
||
96 | int8_t dither8_to_cube[256]; |
||
97 | uint8_t gray8_to_pseudocolor[256]; |
||
98 | } cairo_xlib_visual_info_t; |
||
99 | |||
100 | struct _cairo_xlib_screen { |
||
101 | cairo_list_t link; |
||
102 | |||
103 | cairo_device_t *device; |
||
104 | Screen *screen; |
||
105 | |||
106 | cairo_bool_t has_font_options; |
||
107 | cairo_font_options_t font_options; |
||
108 | |||
109 | GC gc[4]; |
||
110 | cairo_atomic_int_t gc_depths; /* 4 x uint8_t */ |
||
111 | |||
112 | cairo_list_t visuals; |
||
113 | }; |
||
114 | |||
115 | cairo_private cairo_device_t * |
||
116 | _cairo_xlib_device_create (Display *display); |
||
117 | |||
118 | cairo_private cairo_xlib_screen_t * |
||
119 | _cairo_xlib_display_get_screen (cairo_xlib_display_t *display, |
||
120 | Screen *screen); |
||
121 | |||
122 | cairo_private void |
||
123 | _cairo_xlib_add_close_display_hook (cairo_xlib_display_t *display, cairo_xlib_hook_t *hook); |
||
124 | |||
125 | cairo_private void |
||
126 | _cairo_xlib_remove_close_display_hook (cairo_xlib_display_t *display, cairo_xlib_hook_t *hook); |
||
127 | |||
128 | cairo_private cairo_status_t |
||
129 | _cairo_xlib_display_queue_work (cairo_xlib_display_t *display, |
||
130 | cairo_xlib_notify_func notify, |
||
131 | void *data, |
||
132 | void (*destroy)(void *)); |
||
133 | cairo_private cairo_status_t |
||
134 | _cairo_xlib_display_queue_resource (cairo_xlib_display_t *display, |
||
135 | cairo_xlib_notify_resource_func notify, |
||
136 | XID resource); |
||
137 | cairo_private cairo_status_t |
||
138 | _cairo_xlib_display_acquire (cairo_device_t *device, |
||
139 | cairo_xlib_display_t **display); |
||
140 | |||
141 | cairo_private void |
||
142 | _cairo_xlib_display_get_xrender_version (cairo_xlib_display_t *display, |
||
143 | int *major, int *minor); |
||
144 | |||
145 | cairo_private cairo_bool_t |
||
146 | _cairo_xlib_display_has_repeat (cairo_device_t *device); |
||
147 | |||
148 | cairo_private cairo_bool_t |
||
149 | _cairo_xlib_display_has_reflect (cairo_device_t *device); |
||
150 | |||
151 | cairo_private cairo_bool_t |
||
152 | _cairo_xlib_display_has_gradients (cairo_device_t *device); |
||
153 | |||
154 | cairo_private XRenderPictFormat * |
||
155 | _cairo_xlib_display_get_xrender_format (cairo_xlib_display_t *display, |
||
156 | cairo_format_t format); |
||
157 | |||
158 | cairo_private cairo_status_t |
||
159 | _cairo_xlib_screen_get (Display *dpy, |
||
160 | Screen *screen, |
||
161 | cairo_xlib_screen_t **out); |
||
162 | |||
163 | cairo_private void |
||
164 | _cairo_xlib_screen_destroy (cairo_xlib_screen_t *info); |
||
165 | |||
166 | cairo_private void |
||
167 | _cairo_xlib_screen_close_display (cairo_xlib_display_t *display, |
||
168 | cairo_xlib_screen_t *info); |
||
169 | |||
170 | cairo_private GC |
||
171 | _cairo_xlib_screen_get_gc (cairo_xlib_display_t *display, |
||
172 | cairo_xlib_screen_t *info, |
||
173 | int depth, |
||
174 | Drawable drawable); |
||
175 | |||
176 | cairo_private void |
||
177 | _cairo_xlib_screen_put_gc (cairo_xlib_display_t *display, |
||
178 | cairo_xlib_screen_t *info, |
||
179 | int depth, |
||
180 | GC gc); |
||
181 | |||
182 | cairo_private cairo_font_options_t * |
||
183 | _cairo_xlib_screen_get_font_options (cairo_xlib_screen_t *info); |
||
184 | |||
185 | cairo_private cairo_status_t |
||
186 | _cairo_xlib_screen_get_visual_info (cairo_xlib_display_t *display, |
||
187 | cairo_xlib_screen_t *info, |
||
188 | Visual *visual, |
||
189 | cairo_xlib_visual_info_t **out); |
||
190 | |||
191 | cairo_private cairo_status_t |
||
192 | _cairo_xlib_visual_info_create (Display *dpy, |
||
193 | int screen, |
||
194 | VisualID visualid, |
||
195 | cairo_xlib_visual_info_t **out); |
||
196 | |||
197 | cairo_private void |
||
198 | _cairo_xlib_visual_info_destroy (cairo_xlib_visual_info_t *info); |
||
199 | |||
200 | #endif /* CAIRO_XLIB_PRIVATE_H */ |