opengl: Sync a dibsection to its pixmap before drawing to it via opengl

Huw D M Davies h.davies1 at physics.ox.ac.uk
Fri Jan 27 09:48:00 CST 2006


        Huw Davies <huw at codeweavers.com>
        opengl: Sync a dibsection to its pixmap before drawing to it via opengl
-- 
Huw Davies
huw at codeweavers.com
diff --git a/dlls/opengl32/opengl_ext.h b/dlls/opengl32/opengl_ext.h
index 274f8d3..ad176c4 100644
--- a/dlls/opengl32/opengl_ext.h
+++ b/dlls/opengl32/opengl_ext.h
@@ -58,7 +58,8 @@ extern void (*wine_tsx11_lock_ptr)(void)
 extern void (*wine_tsx11_unlock_ptr)(void);
 
 /* As GLX relies on X, this is needed */
-#define ENTER_GL() wine_tsx11_lock_ptr()
+void enter_gl(void);
+#define ENTER_GL() enter_gl()
 #define LEAVE_GL() wine_tsx11_unlock_ptr()
 
 
diff --git a/dlls/opengl32/wgl.c b/dlls/opengl32/wgl.c
index afb4c86..c8b6b60 100644
--- a/dlls/opengl32/wgl.c
+++ b/dlls/opengl32/wgl.c
@@ -54,7 +54,8 @@ enum x11drv_escape_codes
     X11DRV_END_EXPOSURES,       /* end graphics exposures */
     X11DRV_GET_DCE,             /* get the DCE pointer */
     X11DRV_SET_DCE,             /* set the DCE pointer */
-    X11DRV_GET_GLX_DRAWABLE     /* get current glx drawable for a DC */
+    X11DRV_GET_GLX_DRAWABLE,    /* get current glx drawable for a DC */
+    X11DRV_SYNC_PIXMAP          /* sync the dibsection to its pixmap */
 };
 
 void (*wine_tsx11_lock_ptr)(void) = NULL;
@@ -88,6 +89,23 @@ static inline Wine_GLContext *get_contex
     return ret;
 }
 
+void enter_gl(void)
+{
+    GLXContext gl_ctx;
+    Wine_GLContext *ctx;
+    enum x11drv_escape_codes escape = X11DRV_SYNC_PIXMAP;
+
+    wine_tsx11_lock_ptr(); /* unlock in LEAVE_GL */
+    gl_ctx = glXGetCurrentContext();
+    if(!gl_ctx) return;
+    ctx = get_context_from_GLXContext(gl_ctx);
+    if(!ctx || GetObjectType(ctx->hdc) == OBJ_DC)
+        return;
+
+    ExtEscape(ctx->hdc, X11DRV_ESCAPE, sizeof(escape), (LPCSTR)&escape, 0, NULL);
+    return;
+}
+
 static inline void free_context(Wine_GLContext *context)
 {
   if (context->next != NULL) context->next->prev = context->prev;
diff --git a/dlls/x11drv/init.c b/dlls/x11drv/init.c
index c2729b4..183988e 100644
--- a/dlls/x11drv/init.c
+++ b/dlls/x11drv/init.c
@@ -423,6 +423,14 @@ INT X11DRV_ExtEscape( X11DRV_PDEVICE *ph
                     return TRUE;
                 }
                 break;
+            case X11DRV_SYNC_PIXMAP:
+                if(physDev->bitmap)
+                {
+                    X11DRV_CoerceDIBSection(physDev, DIB_Status_GdiMod, FALSE);
+                    return TRUE;
+                }
+                return FALSE;
+                break;
             }
         }
         break;
diff --git a/dlls/x11drv/x11drv.h b/dlls/x11drv/x11drv.h
index 21b28d5..55b10b1 100644
--- a/dlls/x11drv/x11drv.h
+++ b/dlls/x11drv/x11drv.h
@@ -480,7 +480,8 @@ enum x11drv_escape_codes
     X11DRV_END_EXPOSURES,    /* end graphics exposures */
     X11DRV_GET_DCE,          /* get the DCE pointer */
     X11DRV_SET_DCE,          /* set the DCE pointer */
-    X11DRV_GET_GLX_DRAWABLE  /* get current glx drawable for a DC */
+    X11DRV_GET_GLX_DRAWABLE, /* get current glx drawable for a DC */
+    X11DRV_SYNC_PIXMAP       /* sync the dibsection to its pixmap */
 };
 
 struct x11drv_escape_set_drawable



More information about the wine-patches mailing list