mirror of
https://github.com/reactos/reactos.git
synced 2025-08-04 09:36:33 +00:00
- don't discard valid pixel formats and use flags only for ranking
- patch by Robert Millan (rmh dot reactos at aybabtu dot com) See issue #4384 for more details. svn path=/trunk/; revision=41112
This commit is contained in:
parent
8e792cec37
commit
6e73768999
1 changed files with 18 additions and 11 deletions
|
@ -502,6 +502,16 @@ ROSGL_SetContextCallBack( const ICDTable *table )
|
||||||
*/
|
*/
|
||||||
#define BUFFERDEPTH_SCORE(want, have) \
|
#define BUFFERDEPTH_SCORE(want, have) \
|
||||||
((want == 0) ? (0) : ((want < have) ? (1) : ((want > have) ? (3) : (0))))
|
((want == 0) ? (0) : ((want < have) ? (1) : ((want > have) ? (3) : (0))))
|
||||||
|
|
||||||
|
/* Score if we want and not have it */
|
||||||
|
#define FLAG_SCORE(want, have, flag) \
|
||||||
|
(((want & ~have) & flag) ? (1) : (0))
|
||||||
|
|
||||||
|
/* Score if what we want is different than what we have, except when
|
||||||
|
_DONTCARE was set */
|
||||||
|
#define FLAG_SCORE_DONTCARE(want, have, flag) \
|
||||||
|
((!(have & flag ## _DONTCARE)) && ((want & flag) != (have & flag)) ? (1) : (0))
|
||||||
|
|
||||||
int
|
int
|
||||||
APIENTRY
|
APIENTRY
|
||||||
rosglChoosePixelFormat( HDC hdc, CONST PIXELFORMATDESCRIPTOR *pfd )
|
rosglChoosePixelFormat( HDC hdc, CONST PIXELFORMATDESCRIPTOR *pfd )
|
||||||
|
@ -512,8 +522,6 @@ rosglChoosePixelFormat( HDC hdc, CONST PIXELFORMATDESCRIPTOR *pfd )
|
||||||
int best = 0;
|
int best = 0;
|
||||||
int score, bestScore = 0x7fff; /* used to choose a pfd if no exact match */
|
int score, bestScore = 0x7fff; /* used to choose a pfd if no exact match */
|
||||||
int icdNumFormats;
|
int icdNumFormats;
|
||||||
const DWORD compareFlags = PFD_DRAW_TO_WINDOW | PFD_DRAW_TO_BITMAP |
|
|
||||||
PFD_SUPPORT_GDI | PFD_SUPPORT_OPENGL;
|
|
||||||
|
|
||||||
DBGTRACE( "Called!" );
|
DBGTRACE( "Called!" );
|
||||||
|
|
||||||
|
@ -555,18 +563,17 @@ rosglChoosePixelFormat( HDC hdc, CONST PIXELFORMATDESCRIPTOR *pfd )
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
score = 0; /* higher is worse */
|
||||||
|
|
||||||
/* compare flags */
|
/* compare flags */
|
||||||
if ((pfd->dwFlags & compareFlags) != (icdPfd.dwFlags & compareFlags))
|
score += FLAG_SCORE(pfd->dwFlags, icdPfd.dwFlags, PFD_DRAW_TO_WINDOW);
|
||||||
continue;
|
score += FLAG_SCORE(pfd->dwFlags, icdPfd.dwFlags, PFD_DRAW_TO_BITMAP);
|
||||||
if (!(pfd->dwFlags & PFD_DOUBLEBUFFER_DONTCARE) &&
|
score += FLAG_SCORE(pfd->dwFlags, icdPfd.dwFlags, PFD_SUPPORT_GDI);
|
||||||
((pfd->dwFlags & PFD_DOUBLEBUFFER) != (icdPfd.dwFlags & PFD_DOUBLEBUFFER)))
|
score += FLAG_SCORE(pfd->dwFlags, icdPfd.dwFlags, PFD_SUPPORT_OPENGL);
|
||||||
continue;
|
score += FLAG_SCORE_DONTCARE(pfd->dwFlags, icdPfd.dwFlags, PFD_DOUBLEBUFFER);
|
||||||
if (!(pfd->dwFlags & PFD_STEREO_DONTCARE) &&
|
score += FLAG_SCORE_DONTCARE(pfd->dwFlags, icdPfd.dwFlags, PFD_STEREO);
|
||||||
((pfd->dwFlags & PFD_STEREO) != (icdPfd.dwFlags & PFD_STEREO)))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
/* check other attribs */
|
/* check other attribs */
|
||||||
score = 0; /* higher is worse */
|
|
||||||
if (pfd->iPixelType != icdPfd.iPixelType)
|
if (pfd->iPixelType != icdPfd.iPixelType)
|
||||||
score += 5; /* this is really bad i think */
|
score += 5; /* this is really bad i think */
|
||||||
if (pfd->iLayerType != icdPfd.iLayerType)
|
if (pfd->iLayerType != icdPfd.iLayerType)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue