Roderick Colenbrander : winex11.drv: Limit formats to nMaxFormats in wglChoosePixelFormatARB.
Alexandre Julliard
julliard at winehq.org
Thu Jun 7 13:39:16 CDT 2012
Module: wine
Branch: master
Commit: 9e73f7a6df5cdfe4cbe714224ad36df776c02af5
URL: http://source.winehq.org/git/wine.git/?a=commit;h=9e73f7a6df5cdfe4cbe714224ad36df776c02af5
Author: Roderick Colenbrander <thunderbird2k at gmail.com>
Date: Wed Jun 6 21:55:34 2012 -0700
winex11.drv: Limit formats to nMaxFormats in wglChoosePixelFormatARB.
---
dlls/winex11.drv/opengl.c | 11 +++++------
1 files changed, 5 insertions(+), 6 deletions(-)
diff --git a/dlls/winex11.drv/opengl.c b/dlls/winex11.drv/opengl.c
index c84226b..3bdf771 100644
--- a/dlls/winex11.drv/opengl.c
+++ b/dlls/winex11.drv/opengl.c
@@ -2903,10 +2903,11 @@ static GLboolean WINAPI X11DRV_wglChoosePixelFormatARB(HDC hdc, const int *piAtt
}
/* Loop through all matching formats and check if they are suitable.
- * Note that this function should at max return nMaxFormats different formats */
+ * Note that this function should at max return nMaxFormats different formats */
for(run=0; run < 2; run++)
{
- for (it = 0; it < nCfgs; ++it) {
+ for (it = 0; it < nCfgs && pfmt_it < nMaxFormats; ++it)
+ {
gl_test = pglXGetFBConfigAttrib(gdi_display, cfgs[it], GLX_FBCONFIG_ID, &fmt_id);
if (gl_test) {
ERR("Failed to retrieve FBCONFIG_ID from GLXFBConfig, expect problems.\n");
@@ -2922,10 +2923,8 @@ static GLboolean WINAPI X11DRV_wglChoosePixelFormatARB(HDC hdc, const int *piAtt
if( ((run == 0) && fmt->offscreenOnly) || ((run == 1) && !fmt->offscreenOnly) )
continue;
- if(pfmt_it < nMaxFormats) {
- piFormats[pfmt_it] = fmt->iPixelFormat;
- TRACE("at %d/%d found FBCONFIG_ID 0x%x (%d)\n", it + 1, nCfgs, fmt_id, piFormats[pfmt_it]);
- }
+ piFormats[pfmt_it] = fmt->iPixelFormat;
+ TRACE("at %d/%d found FBCONFIG_ID 0x%x (%d)\n", it + 1, nCfgs, fmt_id, piFormats[pfmt_it]);
pfmt_it++;
}
}
More information about the wine-cvs
mailing list