Debian Codegraph @

clutter/x11/clutter-glx-texture-pixmap.c

raw
1 /*
2 * Clutter.
3 *
4 * An OpenGL based 'interactive canvas' library.
5 *
6 * Authored By Johan Bilien <[email protected]>
7 * Matthew Allum <[email protected]>
8 * Robert Bragg <[email protected]>
9 * Neil Roberts <[email protected]>
10 *
11 * Copyright (C) 2007 OpenedHand
12 * Copyright (C) 2010 Intel Corporation.
13 *
14 * This library is free software; you can redistribute it and/or
15 * modify it under the terms of the GNU Lesser General Public
16 * License as published by the Free Software Foundation; either
17 * version 2 of the License, or (at your option) any later version.
18 *
19 * This library is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22 * Lesser General Public License for more details.
23 *
24 * You should have received a copy of the GNU Lesser General Public
25 * License along with this library. If not, see <http://www.gnu.org/licenses/>.
26 *
27 *
28 */
29
30 /**
31 * SECTION:clutter-glx-texture-pixmap
32 * @Title: ClutterGLXTexturePixmap
33 * @short_description: A texture which displays the content of an X Pixmap
34 * @Deprecated: 1.4: Use #ClutterX11TexturePixmap instead.
35 *
36 * #ClutterGLXTexturePixmap is a class for displaying the content of an
37 * X Pixmap as a ClutterActor. Used together with the X Composite extension,
38 * it allows to display the content of X Windows inside Clutter.
39 *
40 * This class used to be necessary to use the
41 * GLX_EXT_texture_from_pixmap extension to get fast texture
42 * updates. However since Clutter 1.4 the handling of this extension
43 * has moved down to Cogl. ClutterX11TexturePixmap and
44 * ClutterGLXTexturePixmap are now equivalent and either one of them
45 * may use the extension if it is possible.
46 */
47
48 #include "config.h"
49
50 #include <string.h>
51
52 #define CLUTTER_DISABLE_DEPRECATION_WARNINGS
53 #include "x11/clutter-x11-texture-pixmap.h"
54
55 #include <cogl/cogl-texture-pixmap-x11.h>
56
57 #include "clutter-glx-texture-pixmap.h"
58
59 G_DEFINE_TYPE (ClutterGLXTexturePixmap, \
60 clutter_glx_texture_pixmap, \
61 CLUTTER_X11_TYPE_TEXTURE_PIXMAP);
62
63 static void
64 clutter_glx_texture_pixmap_init (ClutterGLXTexturePixmap *self)
65 {
66 }
67
68 static void
69 clutter_glx_texture_pixmap_class_init (ClutterGLXTexturePixmapClass *klass)
70 {
71 }
72
73 /**
74 * clutter_glx_texture_pixmap_using_extension:
75 * @texture: A #ClutterGLXTexturePixmap
76 *
77 * Checks whether @texture is using the GLX_EXT_texture_from_pixmap
78 * extension; this extension can be optionally (though it is strongly
79 * encouraged) implemented as a zero-copy between a GLX pixmap and
80 * a GL texture.
81 *
82 * Return value: %TRUE if the texture is using the
83 * GLX_EXT_texture_from_pixmap OpenGL extension or falling back to the
84 * slower software mechanism.
85 *
86 * Deprecated: 1.6: Use cogl_texture_pixmap_x11_is_using_tfp_extension()
87 * on the texture handle instead.
88 *
89 * Since: 0.8
90 */
91 gboolean
92 clutter_glx_texture_pixmap_using_extension (ClutterGLXTexturePixmap *texture)
93 {
94 CoglHandle cogl_texture;
95
96 g_return_val_if_fail (CLUTTER_GLX_IS_TEXTURE_PIXMAP (texture), FALSE);
97
98 cogl_texture = clutter_texture_get_cogl_texture (CLUTTER_TEXTURE (texture));
99
100 return (cogl_is_texture_pixmap_x11 (cogl_texture) &&
101 cogl_texture_pixmap_x11_is_using_tfp_extension (cogl_texture));
102 }
103
104 /**
105 * clutter_glx_texture_pixmap_new_with_pixmap:
106 * @pixmap: the X Pixmap to which this texture should be bound
107 *
108 * Creates a new #ClutterGLXTexturePixmap for @pixmap
109 *
110 * Return value: A new #ClutterGLXTexturePixmap bound to the given X Pixmap
111 *
112 * Since: 0.8
113 *
114 * Deprecated: 1.6: Use clutter_x11_texture_pixmap_new_with_pixmap() instead
115 */
116 ClutterActor *
117 clutter_glx_texture_pixmap_new_with_pixmap (Pixmap pixmap)
118 {
119 return g_object_new (CLUTTER_GLX_TYPE_TEXTURE_PIXMAP,
120 "pixmap", pixmap,
121 NULL);
122 }
123
124 /**
125 * clutter_glx_texture_pixmap_new_with_window:
126 * @window: the X window to which this texture should be bound
127 *
128 * Creates a new #ClutterGLXTexturePixmap for @window
129 *
130 * Return value: A new #ClutterGLXTexturePixmap bound to the given X window
131 *
132 * Since: 0.8
133 *
134 * Deprecated: 1.6: Use clutter_x11_texture_pixmap_new_with_window() instead
135 */
136 ClutterActor *
137 clutter_glx_texture_pixmap_new_with_window (Window window)
138 {
139 return g_object_new (CLUTTER_GLX_TYPE_TEXTURE_PIXMAP,
140 "window", window,
141 NULL);
142 }
143
144 /**
145 * clutter_glx_texture_pixmap_new:
146 *
147 * Creates a new, empty #ClutterGLXTexturePixmap
148 *
149 * Return value: A new #ClutterGLXTexturePixmap
150 *
151 * Since: 0.8
152 *
153 * Deprecated: 1.6: Use clutter_x11_texture_pixmap_new() instead
154 */
155 ClutterActor *
156 clutter_glx_texture_pixmap_new (void)
157 {
158 return g_object_new (CLUTTER_GLX_TYPE_TEXTURE_PIXMAP, NULL);
159 }