> 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.

@@ -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;
 }

I'm not sure if this is correct for all programs. Some more testing needs to be 
done in other programs that use pbuffers. The set_drawable line must have a 
purpose (though I like to get rid of it or atleast implement it without 
ExtEscape). And I'm also not sure if we need to retrieve the pixelformat of the 
'parent hdc' as it is allways 1 though retrieving it is nicer.

Roderick
-- 
Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen! 
Ideal für Modem und ISDN: http://www.gmx.net/de/go/smartsurfer


Reply via email to