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.
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
;
65 cairo_xlib_screen_info_t
*screens
;
67 XRenderPictFormat
*cached_xrender_formats
[CAIRO_FORMAT_A1
+ 1];
69 cairo_xlib_job_t
*workqueue
;
70 cairo_freelist_t wq_freelist
;
72 cairo_xlib_hook_t
*close_display_hooks
;
73 unsigned int buggy_repeat
:1;
74 unsigned int closed
:1;
77 /* size of color cube */
79 /* size of gray ramp */
82 typedef struct _cairo_xlib_visual_info
{
84 struct { uint8_t a
, r
, g
, b
; } colors
[256];
85 uint8_t cube_to_pseudocolor
[CUBE_SIZE
][CUBE_SIZE
][CUBE_SIZE
];
86 uint8_t field8_to_cube
[256];
87 int8_t dither8_to_cube
[256];
88 uint8_t gray8_to_pseudocolor
[256];
89 } cairo_xlib_visual_info_t
;
91 struct _cairo_xlib_screen_info
{
92 cairo_xlib_screen_info_t
*next
;
93 cairo_reference_count_t ref_count
;
96 cairo_xlib_display_t
*display
;
98 cairo_bool_t has_render
;
100 cairo_font_options_t font_options
;
103 unsigned int gc_needs_clip_reset
;
105 cairo_array_t visuals
;
108 cairo_private cairo_xlib_display_t
*
109 _cairo_xlib_display_get (Display
*display
);
111 cairo_private cairo_xlib_display_t
*
112 _cairo_xlib_display_reference (cairo_xlib_display_t
*info
);
114 _cairo_xlib_display_destroy (cairo_xlib_display_t
*info
);
117 _cairo_xlib_add_close_display_hook (cairo_xlib_display_t
*display
, cairo_xlib_hook_t
*hook
);
120 _cairo_xlib_remove_close_display_hook (cairo_xlib_display_t
*display
, cairo_xlib_hook_t
*hook
);
122 cairo_private cairo_status_t
123 _cairo_xlib_display_queue_work (cairo_xlib_display_t
*display
,
124 cairo_xlib_notify_func notify
,
126 void (*destroy
)(void *));
127 cairo_private cairo_status_t
128 _cairo_xlib_display_queue_resource (cairo_xlib_display_t
*display
,
129 cairo_xlib_notify_resource_func notify
,
132 _cairo_xlib_display_notify (cairo_xlib_display_t
*display
);
134 cairo_private XRenderPictFormat
*
135 _cairo_xlib_display_get_xrender_format (cairo_xlib_display_t
*display
,
136 cairo_format_t format
);
138 cairo_private cairo_xlib_screen_info_t
*
139 _cairo_xlib_screen_info_get (cairo_xlib_display_t
*display
, Screen
*screen
);
141 cairo_private cairo_xlib_screen_info_t
*
142 _cairo_xlib_screen_info_reference (cairo_xlib_screen_info_t
*info
);
144 _cairo_xlib_screen_info_destroy (cairo_xlib_screen_info_t
*info
);
147 _cairo_xlib_screen_info_close_display (cairo_xlib_screen_info_t
*info
);
150 _cairo_xlib_screen_get_gc (cairo_xlib_screen_info_t
*info
, int depth
);
151 cairo_private cairo_status_t
152 _cairo_xlib_screen_put_gc (cairo_xlib_screen_info_t
*info
, int depth
, GC gc
, cairo_bool_t reset_clip
);
154 cairo_private cairo_status_t
155 _cairo_xlib_screen_get_visual_info (cairo_xlib_screen_info_t
*info
,
157 cairo_xlib_visual_info_t
**out
);
159 cairo_private cairo_status_t
160 _cairo_xlib_visual_info_create (Display
*dpy
,
163 cairo_xlib_visual_info_t
**out
);
166 _cairo_xlib_visual_info_destroy (Display
*dpy
, cairo_xlib_visual_info_t
*info
);
168 #endif /* CAIRO_XLIB_PRIVATE_H */