gdi32: Update the DC in most OpenGL functions.

This commit is contained in:
Alexandre Julliard 2007-09-17 16:56:56 +02:00
parent 99a258311c
commit 9aee0b4157
2 changed files with 16 additions and 12 deletions

View File

@ -65,16 +65,17 @@ static DC* OPENGL_GetDefaultDC(void)
HGLRC WINAPI wglCreateContext(HDC hdc) HGLRC WINAPI wglCreateContext(HDC hdc)
{ {
HGLRC ret = 0; HGLRC ret = 0;
DC * dc = DC_GetDCPtr( hdc ); DC * dc = get_dc_ptr( hdc );
TRACE("(%p)\n",hdc); TRACE("(%p)\n",hdc);
if (!dc) return 0; if (!dc) return 0;
update_dc( dc );
if (!dc->funcs->pwglCreateContext) FIXME(" :stub\n"); if (!dc->funcs->pwglCreateContext) FIXME(" :stub\n");
else ret = dc->funcs->pwglCreateContext(dc->physDev); else ret = dc->funcs->pwglCreateContext(dc->physDev);
DC_ReleaseDCPtr( dc ); release_dc_ptr( dc );
return ret; return ret;
} }
@ -195,21 +196,22 @@ static BOOL WINAPI wglMakeContextCurrentARB(HDC hDrawDC, HDC hReadDC, HGLRC hglr
TRACE("hDrawDC: (%p), hReadDC: (%p) hglrc: (%p)\n", hDrawDC, hReadDC, hglrc); TRACE("hDrawDC: (%p), hReadDC: (%p) hglrc: (%p)\n", hDrawDC, hReadDC, hglrc);
/* Both hDrawDC and hReadDC need to be valid */ /* Both hDrawDC and hReadDC need to be valid */
DrawDC = DC_GetDCPtr( hDrawDC); DrawDC = get_dc_ptr( hDrawDC );
if (!DrawDC) return FALSE; if (!DrawDC) return FALSE;
ReadDC = DC_GetDCPtr( hReadDC); ReadDC = get_dc_ptr( hReadDC );
if (!ReadDC) { if (!ReadDC) {
DC_ReleaseDCPtr(DrawDC); release_dc_ptr( DrawDC );
return FALSE; return FALSE;
} }
update_dc( DrawDC );
update_dc( ReadDC );
if (!DrawDC->funcs->pwglMakeContextCurrentARB) FIXME(" :stub\n"); if (!DrawDC->funcs->pwglMakeContextCurrentARB) FIXME(" :stub\n");
else ret = DrawDC->funcs->pwglMakeContextCurrentARB(DrawDC->physDev, ReadDC->physDev, hglrc); else ret = DrawDC->funcs->pwglMakeContextCurrentARB(DrawDC->physDev, ReadDC->physDev, hglrc);
DC_ReleaseDCPtr(DrawDC); release_dc_ptr( DrawDC );
DC_ReleaseDCPtr(ReadDC); release_dc_ptr( ReadDC );
return ret; return ret;
} }

View File

@ -394,16 +394,17 @@ BOOL WINAPI SetPixelFormat( HDC hdc, INT iPixelFormat,
INT WINAPI GetPixelFormat( HDC hdc ) INT WINAPI GetPixelFormat( HDC hdc )
{ {
INT ret = 0; INT ret = 0;
DC * dc = DC_GetDCPtr( hdc ); DC * dc = get_dc_ptr( hdc );
TRACE("(%p)\n",hdc); TRACE("(%p)\n",hdc);
if (!dc) return 0; if (!dc) return 0;
update_dc( dc );
if (!dc->funcs->pGetPixelFormat) FIXME(" :stub\n"); if (!dc->funcs->pGetPixelFormat) FIXME(" :stub\n");
else ret = dc->funcs->pGetPixelFormat(dc->physDev); else ret = dc->funcs->pGetPixelFormat(dc->physDev);
DC_ReleaseDCPtr( dc ); release_dc_ptr( dc );
return ret; return ret;
} }
@ -460,12 +461,13 @@ INT WINAPI DescribePixelFormat( HDC hdc, INT iPixelFormat, UINT nBytes,
BOOL WINAPI SwapBuffers( HDC hdc ) BOOL WINAPI SwapBuffers( HDC hdc )
{ {
INT bRet = FALSE; INT bRet = FALSE;
DC * dc = DC_GetDCPtr( hdc ); DC * dc = get_dc_ptr( hdc );
TRACE("(%p)\n",hdc); TRACE("(%p)\n",hdc);
if (!dc) return TRUE; if (!dc) return TRUE;
update_dc( dc );
if (!dc->funcs->pSwapBuffers) if (!dc->funcs->pSwapBuffers)
{ {
FIXME(" :stub\n"); FIXME(" :stub\n");
@ -473,7 +475,7 @@ BOOL WINAPI SwapBuffers( HDC hdc )
} }
else bRet = dc->funcs->pSwapBuffers(dc->physDev); else bRet = dc->funcs->pSwapBuffers(dc->physDev);
DC_ReleaseDCPtr( dc ); release_dc_ptr( dc );
return bRet; return bRet;
} }