[cairo-commit] glitz/src/glx glitz-glx.h, 1.2, 1.3 glitz_glx_format.c, 1.2, 1.3 glitz_glxint.h, 1.3, 1.4

David Reveman commit at pdx.freedesktop.org
Tue Jun 28 18:26:41 PDT 2005


Committed by: davidr

Update of /cvs/cairo/glitz/src/glx
In directory gabe:/tmp/cvs-serv21425/src/glx

Modified Files:
	glitz-glx.h glitz_glx_format.c glitz_glxint.h 
Log Message:
Add glitz_glx_find_drawable_format_for_visual

Index: glitz-glx.h
===================================================================
RCS file: /cvs/cairo/glitz/src/glx/glitz-glx.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- glitz-glx.h	25 Jan 2005 19:50:26 -0000	1.2
+++ glitz-glx.h	29 Jun 2005 01:26:39 -0000	1.3
@@ -53,6 +53,11 @@
                                 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,

Index: glitz_glx_format.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glx/glitz_glx_format.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- glitz_glx_format.c	25 Jan 2005 19:50:26 -0000	1.2
+++ glitz_glx_format.c	29 Jun 2005 01:26:39 -0000	1.3
@@ -89,10 +89,6 @@
                    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 @@
       screen_info->format_ids[n] = id;
       screen_info->n_formats++;
     }
-  }
 }
 
 static void
@@ -318,6 +313,71 @@
 }
 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,

Index: glitz_glxint.h
===================================================================
RCS file: /cvs/cairo/glitz/src/glx/glitz_glxint.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- glitz_glxint.h	12 Apr 2005 14:54:56 -0000	1.3
+++ glitz_glxint.h	29 Jun 2005 01:26:39 -0000	1.4
@@ -184,6 +184,7 @@
 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)




More information about the cairo-commit mailing list