Flickering bug for World of Warcraft

Bertrand Coconnier bcoconni at club-internet.fr
Sat Nov 4 05:22:40 CST 2006


Roderick Colenbrander wrote :

> Or perhaps a testcase isn't needed at all. I think the use of CreateCompatibleDC in wglGetPbufferDCARB is incorrect. According to MSDN this function creates a memory device context. Perhaps something like this works:
> HDC hdc = CreateDC(...);
> int format_orig = GetPixelFormat(hdc_orig);
> SetPixelFormat(hdc, format_orig);
> return hdc;

Thanks to your hints I could make the attached patch. It fixes the issue on my 
side : wglGetPbufferDCARB returns a DC which type is OBJ_DC and WoW does not 
flicker any more.

Regards,

Bertrand.
-------------- next part --------------
diff --git a/dlls/winex11.drv/opengl.c b/dlls/winex11.drv/opengl.c
index 962962f..b529f12 100644
--- a/dlls/winex11.drv/opengl.c
+++ b/dlls/winex11.drv/opengl.c
@@ -1869,16 +1869,18 @@ static HDC WINAPI X11DRV_wglGetPbufferDC
 {
     Wine_GLPBuffer* object = (Wine_GLPBuffer*) hPbuffer;
     HDC hDC;
+    int iPixelFormat;
+    PIXELFORMATDESCRIPTOR  pfd;
     if (NULL == object) {
         SetLastError(ERROR_INVALID_HANDLE);
         return NULL;
     }
-    hDC = CreateCompatibleDC(object->hdc);
 
-    /* The function wglGetPbufferDCARB returns a DC to which the pbuffer can be connected.
-     * We only support one onscreen rendering format (the one from the main visual), so use that. */
-    SetPixelFormat(hDC, 1, NULL);
-    set_drawable(hDC, object->drawable); /* works ?? */
+    hDC = CreateDCA("DISPLAY", NULL, NULL, NULL);
+    iPixelFormat = GetPixelFormat(object->hdc);
+    DescribePixelFormat(hDC, iPixelFormat, sizeof(PIXELFORMATDESCRIPTOR), &pfd); 
+    SetPixelFormat(hDC, iPixelFormat, &pfd);
+
     TRACE("(%p)->(%p)\n", hPbuffer, hDC);
     return hDC;
 }


More information about the wine-devel mailing list