1df5a113fe98596851237d11b7e34bdff6291052
[framework/graphics/cairo.git] / src / cairo-xcb-private.h
1 /* Cairo - a vector graphics library with display and print output
2  *
3  * Copyright © 2005 Red Hat, Inc.
4  * Copyright © 2009 Intel Corporation
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it either under the terms of the GNU Lesser General Public
8  * License version 2.1 as published by the Free Software Foundation
9  * (the "LGPL") or, at your option, under the terms of the Mozilla
10  * Public License Version 1.1 (the "MPL"). If you do not alter this
11  * notice, a recipient may use your version of this file under either
12  * the MPL or the LGPL.
13  *
14  * You should have received a copy of the LGPL along with this library
15  * in the file COPYING-LGPL-2.1; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA
17  * You should have received a copy of the MPL along with this library
18  * in the file COPYING-MPL-1.1
19  *
20  * The contents of this file are subject to the Mozilla Public License
21  * Version 1.1 (the "License"); you may not use this file except in
22  * compliance with the License. You may obtain a copy of the License at
23  * http://www.mozilla.org/MPL/
24  *
25  * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
26  * OF ANY KIND, either express or implied. See the LGPL or the MPL for
27  * the specific language governing rights and limitations.
28  *
29  * The Original Code is the cairo graphics library.
30  *
31  * The Initial Developer of the Original Code is Red Hat, Inc.
32  *
33  * Contributors(s):
34  *      Chris Wilson <chris@chris-wilson.co.uk>
35  */
36
37 #ifndef CAIRO_XCB_PRIVATE_H
38 #define CAIRO_XCB_PRIVATE_H
39
40 #include "cairo-xcb.h"
41
42 #include "cairo-cache-private.h"
43 #include "cairo-compiler-private.h"
44 #include "cairo-device-private.h"
45 #include "cairo-error-private.h"
46 #include "cairo-freelist-private.h"
47 #include "cairo-list-private.h"
48 #include "cairo-mutex-private.h"
49 #include "cairo-pattern-private.h"
50 #include "cairo-reference-count-private.h"
51 #include "cairo-scaled-font-private.h"
52 #include "cairo-spans-private.h"
53 #include "cairo-surface-private.h"
54
55 #include <xcb/xcb.h>
56 #include <xcb/render.h>
57 #include <xcb/xcbext.h>
58 #include <pixman.h>
59
60 #define XLIB_COORD_MAX 32767
61
62 /* maximum number of cached GC's */
63 #define GC_CACHE_SIZE 4
64
65 #define CAIRO_XCB_RENDER_AT_LEAST(major, minor) \
66         ((XCB_RENDER_MAJOR_VERSION > major) ||  \
67         ((XCB_RENDER_MAJOR_VERSION == major) && (XCB_RENDER_MINOR_VERSION >= minor)))
68
69 typedef struct _cairo_xcb_connection cairo_xcb_connection_t;
70 typedef struct _cairo_xcb_font cairo_xcb_font_t;
71 typedef struct _cairo_xcb_screen cairo_xcb_screen_t;
72 typedef struct _cairo_xcb_surface cairo_xcb_surface_t;
73 typedef struct _cairo_xcb_picture cairo_xcb_picture_t;
74 typedef struct _cairo_xcb_shm_mem_pool cairo_xcb_shm_mem_pool_t;
75 typedef struct _cairo_xcb_shm_info cairo_xcb_shm_info_t;
76
77 struct _cairo_xcb_shm_info {
78     cairo_xcb_connection_t *connection;
79     uint32_t shm;
80     uint32_t offset;
81     size_t size;
82     void *mem;
83     cairo_xcb_shm_mem_pool_t *pool;
84     xcb_get_input_focus_cookie_t sync;
85     cairo_list_t pending;
86 };
87
88 struct _cairo_xcb_surface {
89     cairo_surface_t base;
90     cairo_image_surface_t *fallback;
91     cairo_boxes_t fallback_damage;
92
93     cairo_xcb_connection_t *connection;
94     cairo_xcb_screen_t *screen;
95
96     xcb_drawable_t drawable;
97     cairo_bool_t owns_pixmap;
98
99     cairo_bool_t deferred_clear;
100     cairo_color_t deferred_clear_color;
101
102     int width;
103     int height;
104     int depth;
105
106     xcb_render_picture_t picture;
107     xcb_render_pictformat_t xrender_format;
108     pixman_format_code_t pixman_format;
109     uint32_t precision;
110
111     cairo_list_t link;
112 };
113
114 struct _cairo_xcb_picture {
115     cairo_surface_t base;
116
117     cairo_xcb_screen_t *screen;
118     xcb_render_picture_t picture;
119     xcb_render_pictformat_t xrender_format;
120     pixman_format_code_t pixman_format;
121
122     int width, height;
123
124     cairo_extend_t extend;
125     cairo_filter_t filter;
126     cairo_bool_t has_component_alpha;
127     xcb_render_transform_t transform;
128
129     int x0, y0;
130     int x, y;
131
132     cairo_list_t link;
133 };
134
135 #if CAIRO_HAS_XLIB_XCB_FUNCTIONS
136 typedef struct _cairo_xlib_xcb_surface {
137     cairo_surface_t base;
138
139     cairo_xcb_surface_t *xcb;
140
141     /* original settings for query */
142     void *display;
143     void *screen;
144     void *visual;
145     void *format;
146 } cairo_xlib_xcb_surface_t;
147 #endif
148
149
150 enum {
151     GLYPHSET_INDEX_ARGB32,
152     GLYPHSET_INDEX_A8,
153     GLYPHSET_INDEX_A1,
154     NUM_GLYPHSETS
155 };
156
157 typedef struct _cairo_xcb_font_glyphset_free_glyphs {
158     xcb_render_glyphset_t   glyphset;
159     int                     glyph_count;
160     xcb_render_glyph_t      glyph_indices[128];
161 } cairo_xcb_font_glyphset_free_glyphs_t;
162
163 typedef struct _cairo_xcb_font_glyphset_info {
164     xcb_render_glyphset_t   glyphset;
165     cairo_format_t          format;
166     xcb_render_pictformat_t xrender_format;
167     cairo_xcb_font_glyphset_free_glyphs_t *pending_free_glyphs;
168 } cairo_xcb_font_glyphset_info_t;
169
170 struct _cairo_xcb_font {
171     cairo_scaled_font_private_t      base;
172     cairo_scaled_font_t             *scaled_font;
173     cairo_xcb_connection_t          *connection;
174     cairo_xcb_font_glyphset_info_t  glyphset_info[NUM_GLYPHSETS];
175     cairo_list_t link;
176 };
177
178 struct _cairo_xcb_screen {
179     cairo_xcb_connection_t *connection;
180
181     xcb_screen_t            *xcb_screen;
182
183     xcb_gcontext_t gc[GC_CACHE_SIZE];
184     uint8_t gc_depths[GC_CACHE_SIZE];
185
186     cairo_surface_t *stock_colors[CAIRO_STOCK_NUM_COLORS];
187     struct {
188         cairo_surface_t *picture;
189         cairo_color_t color;
190     } solid_cache[16];
191     int solid_cache_size;
192
193     cairo_cache_t linear_pattern_cache;
194     cairo_cache_t radial_pattern_cache;
195     cairo_freelist_t pattern_cache_entry_freelist;
196
197     cairo_list_t link;
198     cairo_list_t surfaces;
199     cairo_list_t pictures;
200 };
201
202 struct _cairo_xcb_connection {
203     cairo_device_t device;
204
205     xcb_connection_t *xcb_connection;
206
207     xcb_render_pictformat_t standard_formats[5];
208     cairo_hash_table_t *xrender_formats;
209     cairo_hash_table_t *visual_to_xrender_format;
210
211     unsigned int maximum_request_length;
212     unsigned int flags;
213     unsigned int original_flags;
214
215     int force_precision;
216
217     const xcb_setup_t *root;
218     const xcb_query_extension_reply_t *render;
219     const xcb_query_extension_reply_t *shm;
220
221     cairo_list_t free_xids;
222     cairo_freepool_t xid_pool;
223
224     cairo_mutex_t shm_mutex;
225     cairo_list_t shm_pools;
226     cairo_list_t shm_pending;
227     cairo_freepool_t shm_info_freelist;
228
229     cairo_mutex_t screens_mutex;
230     cairo_list_t screens;
231
232     cairo_list_t fonts;
233
234     cairo_list_t link;
235 };
236
237 enum {
238     CAIRO_XCB_HAS_RENDER                        = 0x0001,
239     CAIRO_XCB_RENDER_HAS_FILL_RECTANGLES        = 0x0002,
240     CAIRO_XCB_RENDER_HAS_COMPOSITE              = 0x0004,
241     CAIRO_XCB_RENDER_HAS_COMPOSITE_TRAPEZOIDS   = 0x0008,
242     CAIRO_XCB_RENDER_HAS_COMPOSITE_GLYPHS       = 0x0010,
243     CAIRO_XCB_RENDER_HAS_PICTURE_TRANSFORM      = 0x0020,
244     CAIRO_XCB_RENDER_HAS_FILTERS                = 0x0040,
245     CAIRO_XCB_RENDER_HAS_PDF_OPERATORS          = 0x0080,
246     CAIRO_XCB_RENDER_HAS_EXTENDED_REPEAT        = 0x0100,
247     CAIRO_XCB_RENDER_HAS_GRADIENTS              = 0x0200,
248
249     CAIRO_XCB_HAS_SHM                           = 0x80000000,
250
251     CAIRO_XCB_RENDER_MASK = CAIRO_XCB_HAS_RENDER |
252                             CAIRO_XCB_RENDER_HAS_FILL_RECTANGLES |
253                             CAIRO_XCB_RENDER_HAS_COMPOSITE |
254                             CAIRO_XCB_RENDER_HAS_COMPOSITE_TRAPEZOIDS |
255                             CAIRO_XCB_RENDER_HAS_COMPOSITE_GLYPHS |
256                             CAIRO_XCB_RENDER_HAS_PICTURE_TRANSFORM |
257                             CAIRO_XCB_RENDER_HAS_FILTERS |
258                             CAIRO_XCB_RENDER_HAS_PDF_OPERATORS |
259                             CAIRO_XCB_RENDER_HAS_EXTENDED_REPEAT |
260                             CAIRO_XCB_RENDER_HAS_GRADIENTS,
261     CAIRO_XCB_SHM_MASK    = CAIRO_XCB_HAS_SHM
262 };
263
264 #define CAIRO_XCB_SHM_SMALL_IMAGE 8192
265
266 cairo_private extern const cairo_surface_backend_t _cairo_xcb_surface_backend;
267
268 cairo_private cairo_xcb_connection_t *
269 _cairo_xcb_connection_get (xcb_connection_t *connection);
270
271 static inline cairo_xcb_connection_t *
272 _cairo_xcb_connection_reference (cairo_xcb_connection_t *connection)
273 {
274     return (cairo_xcb_connection_t *) cairo_device_reference (&connection->device);
275 }
276
277 cairo_private xcb_render_pictformat_t
278 _cairo_xcb_connection_get_xrender_format (cairo_xcb_connection_t *connection,
279                                           pixman_format_code_t pixman_format);
280
281 cairo_private xcb_render_pictformat_t
282 _cairo_xcb_connection_get_xrender_format_for_visual (cairo_xcb_connection_t *connection,
283                                                      const xcb_visualid_t visual);
284
285 static inline cairo_status_t cairo_warn
286 _cairo_xcb_connection_acquire (cairo_xcb_connection_t *connection)
287 {
288     return cairo_device_acquire (&connection->device);
289 }
290
291 cairo_private uint32_t
292 _cairo_xcb_connection_get_xid (cairo_xcb_connection_t *connection);
293
294 cairo_private void
295 _cairo_xcb_connection_put_xid (cairo_xcb_connection_t *connection,
296                                uint32_t xid);
297
298 static inline void
299 _cairo_xcb_connection_release (cairo_xcb_connection_t *connection)
300 {
301     cairo_device_release (&connection->device);
302 }
303
304 static inline void
305 _cairo_xcb_connection_destroy (cairo_xcb_connection_t *connection)
306 {
307     cairo_device_destroy (&connection->device);
308 }
309
310 cairo_private cairo_int_status_t
311 _cairo_xcb_connection_allocate_shm_info (cairo_xcb_connection_t *display,
312                                          size_t size,
313                                          cairo_bool_t might_reuse,
314                                          cairo_xcb_shm_info_t **shm_info_out);
315
316 cairo_private void
317 _cairo_xcb_shm_info_destroy (cairo_xcb_shm_info_t *shm_info);
318
319 cairo_private void
320 _cairo_xcb_connection_shm_mem_pools_flush (cairo_xcb_connection_t *connection);
321
322 cairo_private void
323 _cairo_xcb_connection_shm_mem_pools_fini (cairo_xcb_connection_t *connection);
324
325 cairo_private void
326 _cairo_xcb_font_close (cairo_xcb_font_t *font);
327
328 cairo_private cairo_xcb_screen_t *
329 _cairo_xcb_screen_get (xcb_connection_t *connection,
330                        xcb_screen_t *screen);
331
332 cairo_private void
333 _cairo_xcb_screen_finish (cairo_xcb_screen_t *screen);
334
335 cairo_private xcb_gcontext_t
336 _cairo_xcb_screen_get_gc (cairo_xcb_screen_t *screen,
337                           xcb_drawable_t drawable,
338                           int depth);
339
340 cairo_private void
341 _cairo_xcb_screen_put_gc (cairo_xcb_screen_t *screen, int depth, xcb_gcontext_t gc);
342
343 cairo_private cairo_status_t
344 _cairo_xcb_screen_store_linear_picture (cairo_xcb_screen_t *screen,
345                                         const cairo_linear_pattern_t *linear,
346                                         cairo_surface_t *picture);
347
348 cairo_private cairo_surface_t *
349 _cairo_xcb_screen_lookup_linear_picture (cairo_xcb_screen_t *screen,
350                                          const cairo_linear_pattern_t *linear);
351
352 cairo_private cairo_status_t
353 _cairo_xcb_screen_store_radial_picture (cairo_xcb_screen_t *screen,
354                                         const cairo_radial_pattern_t *radial,
355                                         cairo_surface_t *picture);
356
357 cairo_private cairo_surface_t *
358 _cairo_xcb_screen_lookup_radial_picture (cairo_xcb_screen_t *screen,
359                                          const cairo_radial_pattern_t *radial);
360
361 cairo_private cairo_surface_t *
362 _cairo_xcb_surface_create_similar_image (void *abstrct_other,
363                                          cairo_format_t format,
364                                          int width,
365                                          int height);
366
367 cairo_private cairo_surface_t *
368 _cairo_xcb_surface_create_similar (void                 *abstract_other,
369                                    cairo_content_t       content,
370                                    int                   width,
371                                    int                   height);
372
373 cairo_private cairo_surface_t *
374 _cairo_xcb_surface_create_internal (cairo_xcb_screen_t          *screen,
375                                     xcb_drawable_t               drawable,
376                                     cairo_bool_t                 owns_pixmap,
377                                     pixman_format_code_t         pixman_format,
378                                     xcb_render_pictformat_t      xrender_format,
379                                     int                          width,
380                                     int                          height);
381
382 cairo_private_no_warn cairo_bool_t
383 _cairo_xcb_surface_get_extents (void *abstract_surface,
384                                 cairo_rectangle_int_t *extents);
385
386 cairo_private cairo_int_status_t
387 _cairo_xcb_surface_cairo_paint (cairo_xcb_surface_t     *surface,
388                                 cairo_operator_t         op,
389                                 const cairo_pattern_t   *source,
390                                 const cairo_clip_t              *clip);
391
392 cairo_private cairo_int_status_t
393 _cairo_xcb_surface_cairo_mask (cairo_xcb_surface_t      *surface,
394                                cairo_operator_t          op,
395                                const cairo_pattern_t    *source,
396                                const cairo_pattern_t    *mask,
397                                const cairo_clip_t               *clip);
398
399 cairo_private cairo_int_status_t
400 _cairo_xcb_surface_cairo_stroke (cairo_xcb_surface_t    *surface,
401                                  cairo_operator_t        op,
402                                  const cairo_pattern_t  *source,
403                                  const cairo_path_fixed_t       *path,
404                                  const cairo_stroke_style_t     *style,
405                                  const cairo_matrix_t           *ctm,
406                                  const cairo_matrix_t           *ctm_inverse,
407                                  double                  tolerance,
408                                  cairo_antialias_t       antialias,
409                                  const cairo_clip_t             *clip);
410
411 cairo_private cairo_int_status_t
412 _cairo_xcb_surface_cairo_fill (cairo_xcb_surface_t      *surface,
413                                cairo_operator_t          op,
414                                const cairo_pattern_t    *source,
415                                const cairo_path_fixed_t *path,
416                                cairo_fill_rule_t         fill_rule,
417                                double                    tolerance,
418                                cairo_antialias_t         antialias,
419                                const cairo_clip_t               *clip);
420
421 cairo_private cairo_int_status_t
422 _cairo_xcb_surface_cairo_glyphs (cairo_xcb_surface_t    *surface,
423                                  cairo_operator_t                op,
424                                  const cairo_pattern_t  *source,
425                                  cairo_scaled_font_t    *scaled_font,
426                                  cairo_glyph_t          *glyphs,
427                                  int                     num_glyphs,
428                                  const cairo_clip_t             *clip);
429
430 cairo_private cairo_int_status_t
431 _cairo_xcb_surface_render_paint (cairo_xcb_surface_t    *surface,
432                                  cairo_operator_t        op,
433                                  const cairo_pattern_t  *source,
434                                  cairo_composite_rectangles_t *composite);
435
436 cairo_private cairo_int_status_t
437 _cairo_xcb_surface_render_mask (cairo_xcb_surface_t     *surface,
438                                 cairo_operator_t                 op,
439                                 const cairo_pattern_t   *source,
440                                 const cairo_pattern_t   *mask,
441                                 cairo_composite_rectangles_t *composite);
442
443 cairo_private cairo_int_status_t
444 _cairo_xcb_surface_render_stroke (cairo_xcb_surface_t           *surface,
445                                   cairo_operator_t               op,
446                                   const cairo_pattern_t         *source,
447                                   const cairo_path_fixed_t      *path,
448                                   const cairo_stroke_style_t    *style,
449                                   const cairo_matrix_t          *ctm,
450                                   const cairo_matrix_t          *ctm_inverse,
451                                   double                         tolerance,
452                                   cairo_antialias_t              antialias,
453                                   cairo_composite_rectangles_t *composite);
454
455 cairo_private cairo_int_status_t
456 _cairo_xcb_surface_render_fill (cairo_xcb_surface_t     *surface,
457                                 cairo_operator_t         op,
458                                 const cairo_pattern_t   *source,
459                                 const cairo_path_fixed_t*path,
460                                 cairo_fill_rule_t        fill_rule,
461                                 double                   tolerance,
462                                 cairo_antialias_t        antialias,
463                                 cairo_composite_rectangles_t *composite);
464
465 cairo_private cairo_int_status_t
466 _cairo_xcb_surface_render_glyphs (cairo_xcb_surface_t   *surface,
467                                   cairo_operator_t               op,
468                                   const cairo_pattern_t *source,
469                                   cairo_scaled_font_t   *scaled_font,
470                                   cairo_glyph_t         *glyphs,
471                                   int                    num_glyphs,
472                                   cairo_composite_rectangles_t *composite,
473                                   cairo_bool_t overlap);
474 cairo_private void
475 _cairo_xcb_surface_scaled_font_fini (cairo_scaled_font_t *scaled_font);
476
477 cairo_private void
478 _cairo_xcb_surface_scaled_glyph_fini (cairo_scaled_glyph_t *scaled_glyph,
479                                       cairo_scaled_font_t  *scaled_font);
480
481 cairo_private cairo_status_t
482 _cairo_xcb_surface_clear (cairo_xcb_surface_t *dst);
483
484 cairo_private cairo_status_t
485 _cairo_xcb_surface_core_copy_boxes (cairo_xcb_surface_t         *dst,
486                                    const cairo_pattern_t        *src_pattern,
487                                    const cairo_rectangle_int_t  *extents,
488                                    const cairo_boxes_t          *boxes);
489
490 cairo_private cairo_status_t
491 _cairo_xcb_surface_core_fill_boxes (cairo_xcb_surface_t *dst,
492                                     const cairo_color_t *color,
493                                     cairo_boxes_t *boxes);
494
495 cairo_private xcb_pixmap_t
496 _cairo_xcb_connection_create_pixmap (cairo_xcb_connection_t *connection,
497                                      uint8_t depth,
498                                      xcb_drawable_t drawable,
499                                      uint16_t width,
500                                      uint16_t height);
501
502 cairo_private void
503 _cairo_xcb_connection_free_pixmap (cairo_xcb_connection_t *connection,
504                                    xcb_pixmap_t pixmap);
505
506 cairo_private xcb_gcontext_t
507 _cairo_xcb_connection_create_gc (cairo_xcb_connection_t *connection,
508                                  xcb_drawable_t drawable,
509                                  uint32_t value_mask,
510                                  uint32_t *values);
511
512 cairo_private void
513 _cairo_xcb_connection_free_gc (cairo_xcb_connection_t *connection,
514                                xcb_gcontext_t gc);
515
516 cairo_private void
517 _cairo_xcb_connection_change_gc (cairo_xcb_connection_t *connection,
518                                  xcb_gcontext_t gc,
519                                  uint32_t value_mask,
520                                  uint32_t *values);
521
522 cairo_private void
523 _cairo_xcb_connection_copy_area (cairo_xcb_connection_t *connection,
524                                  xcb_drawable_t src,
525                                  xcb_drawable_t dst,
526                                  xcb_gcontext_t gc,
527                                  int16_t src_x,
528                                  int16_t src_y,
529                                  int16_t dst_x,
530                                  int16_t dst_y,
531                                  uint16_t width,
532                                  uint16_t height);
533
534 cairo_private void
535 _cairo_xcb_connection_put_image (cairo_xcb_connection_t *connection,
536                                  xcb_drawable_t dst,
537                                  xcb_gcontext_t gc,
538                                  uint16_t width,
539                                  uint16_t height,
540                                  int16_t dst_x,
541                                  int16_t dst_y,
542                                  uint8_t depth,
543                                  uint32_t length,
544                                  void *data);
545
546 cairo_private void
547 _cairo_xcb_connection_put_subimage (cairo_xcb_connection_t *connection,
548                                     xcb_drawable_t dst,
549                                     xcb_gcontext_t gc,
550                                     int16_t src_x,
551                                     int16_t src_y,
552                                     uint16_t width,
553                                     uint16_t height,
554                                     uint16_t cpp,
555                                     int stride,
556                                     int16_t dst_x,
557                                     int16_t dst_y,
558                                     uint8_t depth,
559                                     void *data);
560
561 cairo_private cairo_status_t
562 _cairo_xcb_connection_get_image (cairo_xcb_connection_t *connection,
563                                  xcb_drawable_t src,
564                                  int16_t src_x,
565                                  int16_t src_y,
566                                  uint16_t width,
567                                  uint16_t height,
568                                  xcb_get_image_reply_t **reply);
569
570 cairo_private void
571 _cairo_xcb_connection_poly_fill_rectangle (cairo_xcb_connection_t *connection,
572                                            xcb_drawable_t dst,
573                                            xcb_gcontext_t gc,
574                                            uint32_t num_rectangles,
575                                            xcb_rectangle_t *rectangles);
576
577 cairo_private cairo_status_t
578 _cairo_xcb_shm_image_create (cairo_xcb_connection_t *connection,
579                              pixman_format_code_t pixman_format,
580                              int width, int height,
581                              cairo_image_surface_t **image_out,
582                              cairo_xcb_shm_info_t **shm_info_out);
583
584 #if CAIRO_HAS_XCB_SHM_FUNCTIONS
585 cairo_private uint32_t
586 _cairo_xcb_connection_shm_attach (cairo_xcb_connection_t *connection,
587                                   uint32_t id,
588                                   cairo_bool_t readonly);
589
590 cairo_private void
591 _cairo_xcb_connection_shm_put_image (cairo_xcb_connection_t *connection,
592                                      xcb_drawable_t dst,
593                                      xcb_gcontext_t gc,
594                                      uint16_t total_width,
595                                      uint16_t total_height,
596                                      int16_t src_x,
597                                      int16_t src_y,
598                                      uint16_t width,
599                                      uint16_t height,
600                                      int16_t dst_x,
601                                      int16_t dst_y,
602                                      uint8_t depth,
603                                      uint32_t shm,
604                                      uint32_t offset);
605
606 cairo_private cairo_status_t
607 _cairo_xcb_connection_shm_get_image (cairo_xcb_connection_t *connection,
608                                      xcb_drawable_t src,
609                                      int16_t src_x,
610                                      int16_t src_y,
611                                      uint16_t width,
612                                      uint16_t height,
613                                      uint32_t shmseg,
614                                      uint32_t offset);
615
616 cairo_private void
617 _cairo_xcb_connection_shm_detach (cairo_xcb_connection_t *connection,
618                                   uint32_t segment);
619 #else
620 static inline void
621 _cairo_xcb_connection_shm_put_image (cairo_xcb_connection_t *connection,
622                                      xcb_drawable_t dst,
623                                      xcb_gcontext_t gc,
624                                      uint16_t total_width,
625                                      uint16_t total_height,
626                                      int16_t src_x,
627                                      int16_t src_y,
628                                      uint16_t width,
629                                      uint16_t height,
630                                      int16_t dst_x,
631                                      int16_t dst_y,
632                                      uint8_t depth,
633                                      uint32_t shm,
634                                      uint32_t offset)
635 {
636     ASSERT_NOT_REACHED;
637 }
638 #endif
639
640 cairo_private void
641 _cairo_xcb_connection_render_create_picture (cairo_xcb_connection_t  *connection,
642                                              xcb_render_picture_t     picture,
643                                              xcb_drawable_t           drawable,
644                                              xcb_render_pictformat_t  format,
645                                              uint32_t                 value_mask,
646                                              uint32_t                *value_list);
647
648 cairo_private void
649 _cairo_xcb_connection_render_change_picture (cairo_xcb_connection_t     *connection,
650                                              xcb_render_picture_t  picture,
651                                              uint32_t              value_mask,
652                                              uint32_t             *value_list);
653
654 cairo_private void
655 _cairo_xcb_connection_render_set_picture_clip_rectangles (cairo_xcb_connection_t      *connection,
656                                                           xcb_render_picture_t   picture,
657                                                           int16_t                clip_x_origin,
658                                                           int16_t                clip_y_origin,
659                                                           uint32_t               rectangles_len,
660                                                           xcb_rectangle_t       *rectangles);
661
662 cairo_private void
663 _cairo_xcb_connection_render_free_picture (cairo_xcb_connection_t *connection,
664                                            xcb_render_picture_t  picture);
665
666 cairo_private void
667 _cairo_xcb_connection_render_composite (cairo_xcb_connection_t     *connection,
668                                         uint8_t               op,
669                                         xcb_render_picture_t  src,
670                                         xcb_render_picture_t  mask,
671                                         xcb_render_picture_t  dst,
672                                         int16_t               src_x,
673                                         int16_t               src_y,
674                                         int16_t               mask_x,
675                                         int16_t               mask_y,
676                                         int16_t               dst_x,
677                                         int16_t               dst_y,
678                                         uint16_t              width,
679                                         uint16_t              height);
680
681 cairo_private void
682 _cairo_xcb_connection_render_trapezoids (cairo_xcb_connection_t *connection,
683                                          uint8_t                       op,
684                                          xcb_render_picture_t          src,
685                                          xcb_render_picture_t          dst,
686                                          xcb_render_pictformat_t       mask_format,
687                                          int16_t                       src_x,
688                                          int16_t                       src_y,
689                                          uint32_t                      traps_len,
690                                          xcb_render_trapezoid_t       *traps);
691
692 cairo_private void
693 _cairo_xcb_connection_render_create_glyph_set (cairo_xcb_connection_t   *connection,
694                                                xcb_render_glyphset_t     id,
695                                                xcb_render_pictformat_t  format);
696
697 cairo_private void
698 _cairo_xcb_connection_render_free_glyph_set (cairo_xcb_connection_t      *connection,
699                                              xcb_render_glyphset_t  glyphset);
700
701 cairo_private void
702 _cairo_xcb_connection_render_add_glyphs (cairo_xcb_connection_t             *connection,
703                                          xcb_render_glyphset_t         glyphset,
704                                          uint32_t                      num_glyphs,
705                                          uint32_t                     *glyphs_id,
706                                          xcb_render_glyphinfo_t       *glyphs,
707                                          uint32_t                      data_len,
708                                          uint8_t                      *data);
709
710 cairo_private void
711 _cairo_xcb_connection_render_free_glyphs (cairo_xcb_connection_t         *connection,
712                                           xcb_render_glyphset_t     glyphset,
713                                           uint32_t                  num_glyphs,
714                                           xcb_render_glyph_t       *glyphs);
715
716 cairo_private void
717 _cairo_xcb_connection_render_composite_glyphs_8 (cairo_xcb_connection_t        *connection,
718                                                  uint8_t                  op,
719                                                  xcb_render_picture_t     src,
720                                                  xcb_render_picture_t     dst,
721                                                  xcb_render_pictformat_t  mask_format,
722                                                  xcb_render_glyphset_t    glyphset,
723                                                  int16_t                  src_x,
724                                                  int16_t                  src_y,
725                                                  uint32_t                 glyphcmds_len,
726                                                  uint8_t                 *glyphcmds);
727
728 cairo_private void
729 _cairo_xcb_connection_render_composite_glyphs_16 (cairo_xcb_connection_t        *connection,
730                                                   uint8_t                  op,
731                                                   xcb_render_picture_t     src,
732                                                   xcb_render_picture_t     dst,
733                                                   xcb_render_pictformat_t  mask_format,
734                                                   xcb_render_glyphset_t    glyphset,
735                                                   int16_t                  src_x,
736                                                   int16_t                  src_y,
737                                                   uint32_t                 glyphcmds_len,
738                                                   uint8_t                 *glyphcmds);
739
740 cairo_private void
741 _cairo_xcb_connection_render_composite_glyphs_32 (cairo_xcb_connection_t        *connection,
742                                                   uint8_t                  op,
743                                                   xcb_render_picture_t     src,
744                                                   xcb_render_picture_t     dst,
745                                                   xcb_render_pictformat_t  mask_format,
746                                                   xcb_render_glyphset_t    glyphset,
747                                                   int16_t                  src_x,
748                                                   int16_t                  src_y,
749                                                   uint32_t                 glyphcmds_len,
750                                                   uint8_t                 *glyphcmds);
751
752 cairo_private void
753 _cairo_xcb_connection_render_fill_rectangles (cairo_xcb_connection_t      *connection,
754                                               uint8_t                op,
755                                               xcb_render_picture_t   dst,
756                                               xcb_render_color_t     color,
757                                               uint32_t               num_rects,
758                                               xcb_rectangle_t       *rects);
759
760 cairo_private void
761 _cairo_xcb_connection_render_set_picture_transform (cairo_xcb_connection_t       *connection,
762                                                     xcb_render_picture_t    picture,
763                                                     xcb_render_transform_t  *transform);
764
765 cairo_private void
766 _cairo_xcb_connection_render_set_picture_filter (cairo_xcb_connection_t         *connection,
767                                                  xcb_render_picture_t      picture,
768                                                  uint16_t                  filter_len,
769                                                  char                     *filter);
770
771 cairo_private void
772 _cairo_xcb_connection_render_create_solid_fill (cairo_xcb_connection_t     *connection,
773                                                 xcb_render_picture_t  picture,
774                                                 xcb_render_color_t    color);
775
776 cairo_private void
777 _cairo_xcb_connection_render_create_linear_gradient (cairo_xcb_connection_t         *connection,
778                                                      xcb_render_picture_t      picture,
779                                                      xcb_render_pointfix_t     p1,
780                                                      xcb_render_pointfix_t     p2,
781                                                      uint32_t                  num_stops,
782                                                      xcb_render_fixed_t *stops,
783                                                      xcb_render_color_t *colors);
784
785 cairo_private void
786 _cairo_xcb_connection_render_create_radial_gradient (cairo_xcb_connection_t         *connection,
787                                                      xcb_render_picture_t      picture,
788                                                      xcb_render_pointfix_t     inner,
789                                                      xcb_render_pointfix_t     outer,
790                                                      xcb_render_fixed_t        inner_radius,
791                                                      xcb_render_fixed_t        outer_radius,
792                                                      uint32_t                  num_stops,
793                                                      xcb_render_fixed_t *stops,
794                                                      xcb_render_color_t *colors);
795
796 cairo_private void
797 _cairo_xcb_connection_render_create_conical_gradient (cairo_xcb_connection_t         *c,
798                                                       xcb_render_picture_t      picture,
799                                                       xcb_render_pointfix_t     center,
800                                                       xcb_render_fixed_t        angle,
801                                                       uint32_t                  num_stops,
802                                                       xcb_render_fixed_t *stops,
803                                                       xcb_render_color_t *colors);
804 #if CAIRO_HAS_XLIB_XCB_FUNCTIONS
805 slim_hidden_proto (cairo_xcb_surface_create);
806 slim_hidden_proto (cairo_xcb_surface_create_for_bitmap);
807 slim_hidden_proto (cairo_xcb_surface_create_with_xrender_format);
808 slim_hidden_proto (cairo_xcb_surface_set_size);
809 slim_hidden_proto (cairo_xcb_surface_set_drawable);
810 slim_hidden_proto (cairo_xcb_device_debug_get_precision);
811 slim_hidden_proto_no_warn (cairo_xcb_device_debug_set_precision);
812 slim_hidden_proto_no_warn (cairo_xcb_device_debug_cap_xrender_version);
813 #endif
814
815 #endif /* CAIRO_XCB_PRIVATE_H */