Ecore_X(cb): Remove extra calls to ecore_x_flush. Move main loop
[framework/uifw/ecore.git] / src / lib / ecore_x / xcb / ecore_xcb_pixmap.c
1 #include "ecore_xcb_private.h"
2
3 /**
4  * @defgroup Ecore_X_Pixmap_Group X Pixmap Functions
5  *
6  * Functions that operate on pixmaps.
7  */
8
9 /**
10  * Creates a new pixmap.
11  * @param   win Window used to determine which screen of the display the
12  *              pixmap should be created on.  If 0, the default root window
13  *              is used.
14  * @param   w   Width of the new pixmap.
15  * @param   h   Height of the new pixmap.
16  * @param   dep Depth of the pixmap.  If 0, the default depth of the default
17  *              screen is used.
18  * @return  New pixmap.
19  * @ingroup Ecore_X_Pixmap_Group
20  */
21 EAPI Ecore_X_Pixmap 
22 ecore_x_pixmap_new(Ecore_X_Window win, int w, int h, int dep) 
23 {
24    Ecore_X_Pixmap pmap;
25
26    LOGFN(__FILE__, __LINE__, __FUNCTION__);
27
28    if (win == 0) win = ((xcb_screen_t *)_ecore_xcb_screen)->root;
29    if (dep == 0) dep = ((xcb_screen_t *)_ecore_xcb_screen)->root_depth;
30
31    pmap = xcb_generate_id(_ecore_xcb_conn);
32    xcb_create_pixmap(_ecore_xcb_conn, dep, pmap, win, w, h);
33
34 //   ecore_x_flush();
35    return pmap;
36 }
37
38 /**
39  * Deletes the reference to the given pixmap.
40  *
41  * If no other clients have a reference to the given pixmap, the server
42  * will destroy it.
43  *
44  * @param   pmap The given pixmap.
45  * @ingroup Ecore_X_Pixmap_Group
46  */
47 EAPI void 
48 ecore_x_pixmap_free(Ecore_X_Pixmap pmap) 
49 {
50    LOGFN(__FILE__, __LINE__, __FUNCTION__);
51
52    xcb_free_pixmap(_ecore_xcb_conn, pmap);
53 //   ecore_x_flush();
54 }
55
56 /**
57  * Pastes a rectangular area of the given pixmap onto the given drawable.
58  * @param   pmap The given pixmap.
59  * @param   dest The given drawable.
60  * @param   gc   The graphics context which governs which operation will
61  *               be used to paste the area onto the drawable.
62  * @param   sx   The X position of the area on the pixmap.
63  * @param   sy   The Y position of the area on the pixmap.
64  * @param   w    The width of the area.
65  * @param   h    The height of the area.
66  * @param   dx   The X position at which to paste the area on @p dest.
67  * @param   dy   The Y position at which to paste the area on @p dest.
68  * @ingroup Ecore_X_Pixmap_Group
69  */
70 EAPI void 
71 ecore_x_pixmap_paste(Ecore_X_Pixmap pmap, Ecore_X_Drawable dest, Ecore_X_GC gc, int sx, int sy, int w, int h, int dx, int dy) 
72 {
73    LOGFN(__FILE__, __LINE__, __FUNCTION__);
74
75    xcb_copy_area(_ecore_xcb_conn, pmap, dest, gc, sx, sy, dx, dy, w, h);
76 //   ecore_x_flush();
77 }
78
79 /**
80  * Retrieves the size of the given pixmap.
81  * @param   pmap The given pixmap.
82  * @param   x    Pointer to an integer in which to store the X position.
83  * @param   y    Pointer to an integer in which to store the Y position.
84  * @param   w    Pointer to an integer in which to store the width.
85  * @param   h    Pointer to an integer in which to store the height.
86  * @ingroup Ecore_X_Pixmap_Group
87  */
88 EAPI void 
89 ecore_x_pixmap_geometry_get(Ecore_X_Pixmap pmap, int *x, int *y, int *w, int *h) 
90 {
91    LOGFN(__FILE__, __LINE__, __FUNCTION__);
92
93    if (pmap)
94      ecore_x_drawable_geometry_get(pmap, x, y, w, h);
95 }
96
97 /**
98  * Retrieves the depth of the given pixmap.
99  * @param   pmap The given pixmap.
100  * @return  The depth of the pixmap.
101  * @ingroup Ecore_X_Pixmap_Group
102  */
103 EAPI int 
104 ecore_x_pixmap_depth_get(Ecore_X_Pixmap pmap) 
105 {
106    LOGFN(__FILE__, __LINE__, __FUNCTION__);
107
108    return ecore_x_drawable_depth_get(pmap);
109 }