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
;
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 */
82 /* size of gray ramp */
85 typedef struct _cairo_xlib_visual_info
{
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
;
99 cairo_xlib_display_t
*display
;
101 cairo_bool_t has_render
;
103 cairo_bool_t has_font_options
;
104 cairo_font_options_t font_options
;
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
);
118 _cairo_xlib_display_destroy (cairo_xlib_display_t
*info
);
121 _cairo_xlib_add_close_display_hook (cairo_xlib_display_t
*display
, cairo_xlib_hook_t
*hook
);
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
,
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
,
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
,
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
);
150 _cairo_xlib_screen_info_destroy (cairo_xlib_screen_info_t
*info
);
153 _cairo_xlib_screen_info_close_display (cairo_xlib_screen_info_t
*info
);
156 _cairo_xlib_screen_get_gc (cairo_xlib_screen_info_t
*info
,
159 unsigned int *need_reset
);
162 _cairo_xlib_screen_put_gc (cairo_xlib_screen_info_t
*info
,
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
,
173 cairo_xlib_visual_info_t
**out
);
175 cairo_private cairo_status_t
176 _cairo_xlib_visual_info_create (Display
*dpy
,
179 cairo_xlib_visual_info_t
**out
);
182 _cairo_xlib_visual_info_destroy (Display
*dpy
, cairo_xlib_visual_info_t
*info
);
184 #endif /* CAIRO_XLIB_PRIVATE_H */