summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDavid Reveman <davidr@novell.com>2005-06-29 01:26:39 +0000
committerDavid Reveman <davidr@novell.com>2005-06-29 01:26:39 +0000
commit0f337a68eece15aa4166a1ab707c9905530e3856 (patch)
tree9e6549f139f5a04d7fa3a4ab5cd6e9820a5f6b42 /src
parentd0ccadf30b458cad6a73a542970db8ec664827a2 (diff)
Add glitz_glx_find_drawable_format_for_visual
Diffstat (limited to 'src')
-rw-r--r--src/glx/glitz-glx.h5
-rw-r--r--src/glx/glitz_glx_format.c70
-rw-r--r--src/glx/glitz_glxint.h1
3 files changed, 71 insertions, 5 deletions
diff --git a/src/glx/glitz-glx.h b/src/glx/glitz-glx.h
index cdfebb4..d0e3125 100644
--- a/src/glx/glitz-glx.h
+++ b/src/glx/glitz-glx.h
@@ -53,6 +53,11 @@ glitz_glx_find_drawable_format (Display *display,
const glitz_drawable_format_t *templ,
int count);
+glitz_drawable_format_t *
+glitz_glx_find_drawable_format_for_visual (Display *display,
+ int screen,
+ VisualID visual_id);
+
XVisualInfo *
glitz_glx_get_visual_info_from_format (Display *display,
int screen,
diff --git a/src/glx/glitz_glx_format.c b/src/glx/glitz_glx_format.c
index 563bb74..51670fc 100644
--- a/src/glx/glitz_glx_format.c
+++ b/src/glx/glitz_glx_format.c
@@ -89,10 +89,6 @@ _glitz_add_format (glitz_glx_screen_info_t *screen_info,
glitz_drawable_format_t *format,
XID id)
{
- if (!glitz_drawable_format_find (screen_info->formats,
- screen_info->n_formats,
- GLITZ_DRAWABLE_FORMAT_ALL_EXCEPT_ID_MASK,
- format, 0)) {
int n = screen_info->n_formats;
screen_info->formats =
@@ -107,7 +103,6 @@ _glitz_add_format (glitz_glx_screen_info_t *screen_info,
screen_info->format_ids[n] = id;
screen_info->n_formats++;
}
- }
}
static void
@@ -318,6 +313,71 @@ glitz_glx_find_drawable_format (Display *display,
}
slim_hidden_def(glitz_glx_find_drawable_format);
+glitz_drawable_format_t *
+glitz_glx_find_drawable_format_for_visual (Display *display,
+ int screen,
+ VisualID visual_id)
+{
+ glitz_drawable_format_t *format = NULL;
+ glitz_glx_screen_info_t *screen_info;
+ int i;
+
+ screen_info = glitz_glx_screen_info_get (display, screen);
+ if (!screen_info)
+ return NULL;
+
+ if (screen_info->glx_feature_mask & GLITZ_GLX_FEATURE_FBCONFIG_MASK)
+ {
+ glitz_glx_static_proc_address_list_t *glx = &screen_info->glx;
+ GLXFBConfig *fbconfigs;
+ int fid, n_fbconfigs;
+
+ fid = -1;
+ fbconfigs = glx->get_fbconfigs (display, screen, &n_fbconfigs);
+ for (i = 0; i < n_fbconfigs; i++)
+ {
+ XVisualInfo *visinfo;
+
+ visinfo = glx->get_visual_from_fbconfig (display, fbconfigs[i]);
+ if (visinfo && visinfo->visualid == visual_id)
+ {
+ int value;
+
+ glx->get_fbconfig_attrib (display, fbconfigs[i],
+ GLX_FBCONFIG_ID, &value);
+ for (fid = 0; fid < screen_info->n_formats; fid++)
+ {
+ if (screen_info->format_ids[fid] == value)
+ {
+ format = screen_info->formats + fid;
+ break;
+ }
+ }
+
+ if (format)
+ break;
+ }
+ }
+
+ if (fbconfigs)
+ XFree (fbconfigs);
+ }
+ else
+ {
+ for (i = 0; i < screen_info->n_formats; i++)
+ {
+ if (visual_id == screen_info->format_ids[i])
+ {
+ format = screen_info->formats + i;
+ break;
+ }
+ }
+ }
+
+ return format;
+}
+slim_hidden_def(glitz_glx_find_drawable_format_for_visual);
+
XVisualInfo *
glitz_glx_get_visual_info_from_format (Display *display,
int screen,
diff --git a/src/glx/glitz_glxint.h b/src/glx/glitz_glxint.h
index fda6d9f..023a79b 100644
--- a/src/glx/glitz_glxint.h
+++ b/src/glx/glitz_glxint.h
@@ -184,6 +184,7 @@ glitz_glx_swap_buffers (void *abstract_drawable);
slim_hidden_proto(glitz_glx_init)
slim_hidden_proto(glitz_glx_fini)
slim_hidden_proto(glitz_glx_find_drawable_format)
+slim_hidden_proto(glitz_glx_find_drawable_format_for_visual)
slim_hidden_proto(glitz_glx_get_visual_info_from_format)
slim_hidden_proto(glitz_glx_create_drawable_for_window)
slim_hidden_proto(glitz_glx_create_pbuffer_drawable)