Chris Robinson : winex11: Create GLXPixmap for bitmaps in SetPixelFormat.

Alexandre Julliard julliard at winehq.org
Wed Oct 10 15:27:21 CDT 2007


Module: wine
Branch: master
Commit: fa6598a260e5f710fbcf4ff2a52d707d5271e65a
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=fa6598a260e5f710fbcf4ff2a52d707d5271e65a

Author: Chris Robinson <chris.kcat at gmail.com>
Date:   Wed Oct  3 09:20:30 2007 -0700

winex11: Create GLXPixmap for bitmaps in SetPixelFormat.

---

 dlls/winex11.drv/opengl.c |   59 ++++++++++++++++++++++++++------------------
 1 files changed, 35 insertions(+), 24 deletions(-)

diff --git a/dlls/winex11.drv/opengl.c b/dlls/winex11.drv/opengl.c
index 1a737dc..226dfb9 100644
--- a/dlls/winex11.drv/opengl.c
+++ b/dlls/winex11.drv/opengl.c
@@ -984,6 +984,26 @@ Drawable create_glxpixmap(Display *display, XVisualInfo *vis, Pixmap parent)
 }
 
 
+static XID create_bitmap_glxpixmap(X11DRV_PDEVICE *physDev)
+{
+    GLXPixmap ret;
+    XVisualInfo *vis;
+    XVisualInfo template;
+    int num;
+
+    wine_tsx11_lock();
+
+    /* Retrieve the visualid from our main visual which is the only visual we can use */
+    template.visualid =  XVisualIDFromVisual(visual);
+    vis = XGetVisualInfo(gdi_display, VisualIDMask, &template, &num);
+
+    ret = pglXCreateGLXPixmap(gdi_display, vis, physDev->bitmap->pixmap);
+    XFree(vis);
+    wine_tsx11_unlock();
+    TRACE("return %lx\n", ret);
+    return ret;
+}
+
 /**
  * X11DRV_ChoosePixelFormat
  *
@@ -1440,6 +1460,21 @@ BOOL X11DRV_SetPixelFormat(X11DRV_PDEVICE *physDev,
 
         physDev->gl_drawable = X11DRV_get_gl_drawable(hwnd);
     }
+    else if(physDev->bitmap) {
+        if(!(value&GLX_PIXMAP_BIT)) {
+            WARN("Pixel format %d is not compatible for bitmap rendering\n", iPixelFormat);
+            return FALSE;
+        }
+
+        physDev->bitmap->glxpixmap = create_bitmap_glxpixmap(physDev);
+        if(!physDev->bitmap->glxpixmap) {
+            WARN("Couldn't create glxpixmap for pixel format %d\n", iPixelFormat);
+            return FALSE;
+        }
+    }
+    else {
+        FIXME("called on a non-window, non-bitmap object?");
+    }
 
   physDev->current_pf = iPixelFormat;
 
@@ -3202,26 +3237,6 @@ static void X11DRV_WineGL_LoadExtensions(void)
 }
 
 
-static XID create_bitmap_glxpixmap(X11DRV_PDEVICE *physDev)
-{
-    GLXPixmap ret;
-    XVisualInfo *vis;
-    XVisualInfo template;
-    int num;
-
-    wine_tsx11_lock();
-
-    /* Retrieve the visualid from our main visual which is the only visual we can use */
-    template.visualid =  XVisualIDFromVisual(visual);
-    vis = XGetVisualInfo(gdi_display, VisualIDMask, &template, &num);
-
-    ret = pglXCreateGLXPixmap(gdi_display, vis, physDev->bitmap->pixmap);
-    XFree(vis);
-    wine_tsx11_unlock(); 
-    TRACE("return %lx\n", ret);
-    return ret;
-}
-
 Drawable get_glxdrawable(X11DRV_PDEVICE *physDev)
 {
     Drawable ret;
@@ -3231,11 +3246,7 @@ Drawable get_glxdrawable(X11DRV_PDEVICE *physDev)
         if (physDev->bitmap->hbitmap == BITMAP_stock_phys_bitmap.hbitmap)
             ret = physDev->drawable; /* PBuffer */
         else
-        {
-            if(!physDev->bitmap->glxpixmap)
-                physDev->bitmap->glxpixmap = create_bitmap_glxpixmap(physDev);
             ret = physDev->bitmap->glxpixmap;
-        }
     }
     else if(physDev->gl_drawable)
         ret = physDev->gl_drawable;




More information about the wine-cvs mailing list