fix Mesa ICD DrvSetFormatPixel, do not create stack cruption by ignore the 3 param.

copy code from fxgl interface and make DrvSetFormatPixel work

svn path=/trunk/; revision=30399
This commit is contained in:
Magnus Olsen 2007-11-12 18:39:47 +00:00
parent 90e352745f
commit a240dabd79

View file

@ -283,19 +283,23 @@ WGLAPI BOOL GLAPIENTRY DrvSwapLayerBuffers(HDC hdc,UINT fuPlanes)
WGLAPI int GLAPIENTRY DrvDescribePixelFormat(HDC hdc,int iPixelFormat,UINT nBytes, WGLAPI int GLAPIENTRY DrvDescribePixelFormat(HDC hdc,int iPixelFormat,UINT nBytes,
LPPIXELFORMATDESCRIPTOR ppfd) LPPIXELFORMATDESCRIPTOR ppfd)
{ {
int qt_valid_pix; int qt_valid_pix;
(void) hdc;
qt_valid_pix = qt_pix;
qt_valid_pix = qt_pix;
if(ppfd == NULL) if(ppfd == NULL)
return(qt_valid_pix); return(qt_valid_pix);
if(iPixelFormat < 1 || iPixelFormat > qt_valid_pix || nBytes != sizeof(PIXELFORMATDESCRIPTOR))
{ if (iPixelFormat < 1 || iPixelFormat > qt_valid_pix ||
SetLastError(0); ((nBytes != sizeof(PIXELFORMATDESCRIPTOR)) && (nBytes != 0))) {
return(0); SetLastError(0);
} return qt_valid_pix;
*ppfd = pix[iPixelFormat - 1].pfd; }
return(qt_valid_pix);
if (nBytes != 0)
*ppfd = pix[iPixelFormat - 1].pfd;
return qt_valid_pix;
} }
/* /*
@ -311,19 +315,27 @@ WGLAPI PROC GLAPIENTRY DrvGetProcAddress(LPCSTR lpszProc)
return(NULL); return(NULL);
} }
WGLAPI BOOL GLAPIENTRY DrvSetPixelFormat(HDC hdc,int iPixelFormat) WGLAPI BOOL GLAPIENTRY DrvSetPixelFormat(HDC hdc,int iPixelFormat, const PIXELFORMATDESCRIPTOR *ppfd)
{ {
int qt_valid_pix; int qt_valid_pix;
(void) hdc;
qt_valid_pix = qt_pix; qt_valid_pix = qt_pix;
if(iPixelFormat < 1 || iPixelFormat > qt_valid_pix)
{ if (iPixelFormat < 1 || iPixelFormat > qt_valid_pix) {
SetLastError(0); if (ppfd == NULL) {
return(FALSE); PIXELFORMATDESCRIPTOR my_pfd;
} if (!DrvDescribePixelFormat(hdc, iPixelFormat, sizeof(PIXELFORMATDESCRIPTOR), &my_pfd)) {
curPFD = iPixelFormat; SetLastError(0);
return(TRUE); return FALSE;
}
} else if (ppfd->nSize != sizeof(PIXELFORMATDESCRIPTOR)) {
SetLastError(0);
return FALSE;
}
}
curPFD = iPixelFormat;
return TRUE;
} }
WGLAPI BOOL GLAPIENTRY DrvSwapBuffers(HDC hdc) WGLAPI BOOL GLAPIENTRY DrvSwapBuffers(HDC hdc)