Alexandre Julliard : winex11: Get the information from the drawable structure in SwapBuffers.

Alexandre Julliard julliard at winehq.org
Mon Sep 10 15:22:09 CDT 2012


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

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Fri Sep  7 21:00:46 2012 +0200

winex11: Get the information from the drawable structure in SwapBuffers.

---

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

diff --git a/dlls/winex11.drv/opengl.c b/dlls/winex11.drv/opengl.c
index 6e0c0b7..32a10ac 100644
--- a/dlls/winex11.drv/opengl.c
+++ b/dlls/winex11.drv/opengl.c
@@ -3028,7 +3028,9 @@ static void X11DRV_WineGL_LoadExtensions(void)
  */
 static BOOL glxdrv_SwapBuffers(PHYSDEV dev)
 {
-  struct glx_physdev *physdev = get_glxdrv_dev( dev );
+    enum x11drv_escape_codes code = X11DRV_FLUSH_GL_DRAWABLE;
+    struct gl_drawable *gl;
+    HWND hwnd;
   struct wgl_context *ctx = NtCurrentTeb()->glContext;
 
   TRACE("(%p)\n", dev->hdc);
@@ -3040,36 +3042,35 @@ static BOOL glxdrv_SwapBuffers(PHYSDEV dev)
       return FALSE;
   }
 
-  if (!physdev->drawable)
-  {
-      WARN("Using an invalid drawable, skipping\n");
-      SetLastError(ERROR_INVALID_HANDLE);
-      return FALSE;
-  }
-
   sync_context(ctx);
-  switch (physdev->type)
-  {
-  case DC_GL_PIXMAP_WIN:
-      if(pglXCopySubBufferMESA) {
-          int w = physdev->x11dev->dc_rect.right - physdev->x11dev->dc_rect.left;
-          int h = physdev->x11dev->dc_rect.bottom - physdev->x11dev->dc_rect.top;
-
-          /* (glX)SwapBuffers has an implicit glFlush effect, however
-           * GLX_MESA_copy_sub_buffer doesn't. Make sure GL is flushed before
-           * copying */
-          pglFlush();
-          if(w > 0 && h > 0)
-              pglXCopySubBufferMESA(gdi_display, physdev->drawable, 0, 0, w, h);
-          break;
-      }
-      /* fall through */
-  default:
-      pglXSwapBuffers(gdi_display, physdev->drawable);
-      break;
-  }
 
-  flush_gl_drawable( physdev );
+    hwnd = WindowFromDC( dev->hdc );
+    EnterCriticalSection( &context_section );
+
+    if (!XFindContext( gdi_display, (XID)hwnd, gl_hwnd_context, (char **)&gl ) ||
+        !XFindContext( gdi_display, (XID)dev->hdc, gl_pbuffer_context, (char **)&gl ))
+    {
+        switch (gl->type)
+        {
+        case DC_GL_PIXMAP_WIN:
+            if (pglXCopySubBufferMESA) {
+                /* (glX)SwapBuffers has an implicit glFlush effect, however
+                 * GLX_MESA_copy_sub_buffer doesn't. Make sure GL is flushed before
+                 * copying */
+                pglFlush();
+                pglXCopySubBufferMESA( gdi_display, gl->drawable, 0, 0,
+                                       gl->rect.right - gl->rect.left, gl->rect.bottom - gl->rect.top );
+                break;
+            }
+            /* fall through */
+        default:
+            pglXSwapBuffers(gdi_display, gl->drawable);
+            break;
+        }
+    }
+    LeaveCriticalSection( &context_section );
+
+    ExtEscape( dev->hdc, X11DRV_ESCAPE, sizeof(code), (LPSTR)&code, 0, NULL );
 
   /* FPS support */
   if (TRACE_ON(fps))




More information about the wine-cvs mailing list