diff src/graph_engine_openvg.c @ 1110:851a062368bd

Change signature of mbe_win_surface_create() by using format argument
author Thinker K.F. Li <thinker@codemud.net>
date Wed, 08 Dec 2010 18:31:39 +0800
parents 7f4dd130a78e
children 7451af5d63ec
line wrap: on
line diff
--- a/src/graph_engine_openvg.c	Tue Dec 07 12:42:41 2010 +0800
+++ b/src/graph_engine_openvg.c	Wed Dec 08 18:31:39 2010 +0800
@@ -540,76 +540,30 @@
 }
 
 #ifdef EGL_GLX
-#include <X11/Xlib.h>
-#include <X11/Xutil.h>
-
-static int
-_get_img_fmt_from_xvisual(Display *display, Visual *visual) {
-    VisualID visual_id;
-    XVisualInfo temp;
-    XVisualInfo *infos;
-    int n;
-    int fmt = -1;
-    
-    visual_id = XVisualIDFromVisual(visual);
-    temp.visualid = visual_id;
-    infos = XGetVisualInfo(display, VisualIDMask, &temp, &n);
-    if(n != 1)
-	return -1;
-
-    switch(infos->depth) {
-    case 32:
-	fmt = MB_IFMT_ARGB32;
-	break;
-	
-    case 24:
-	fmt = MB_IFMT_RGB24;
-	break;
-	
-    case 16:
-	fmt = MB_IFMT_RGB16_565;
-	break;
-	
-    case 8:
-	fmt = MB_IFMT_A8;
-	break;
-	
-    case 1:
-	fmt = MB_IFMT_A1;
-	break;
-    }
-
-    return fmt;
-}
-
 /*! \brief Create an EGL window surface for X11.
  *
  * This function is compiled only for GLX enabled.
  */
 mbe_surface_t *
-mbe_win_surface_create(Display *display, Drawable drawable,
-		       Visual *visual, int width, int height) {
+mbe_win_surface_create(void *display, void *drawable,
+		       int fmt, int width, int height) {
     EGLDisplay egl_disp;
     EGLSurface egl_surface;
     mbe_surface_t *surface;
     EGLConfig config;
     EGLint attrib_list[2] = {EGL_NONE};
-    int fmt;
     int r;
 
-    fmt = _get_img_fmt_from_xvisual(display, visual);
-    if(fmt == -1)
-	return NULL;
-    
     r = _openvg_find_config(fmt, width, height, &config);
     if(r != 0)
 	return NULL;
 
-    egl_disp = eglGetDisplay(display);
+    egl_disp = eglGetDisplay((Display *)display);
     if(egl_disp == EGL_NO_DISPLAY || egl_disp != _VG_DISPLAY())
 	return NULL;
 
-    egl_surface = eglCreateWindowSurface(egl_disp, config, drawable,
+    egl_surface = eglCreateWindowSurface(egl_disp, config,
+					 (Drawable)drawable,
 					 attrib_list);
 
     surface = O_ALLOC(mbe_surface_t);