Ken Thomases : winemac: Return failure from DescribePixelFormat() for invalid pixel format.

Alexandre Julliard julliard at winehq.org
Thu Sep 12 14:55:21 CDT 2013


Module: wine
Branch: master
Commit: a300efc852290e21d354303f99736606eca7e855
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=a300efc852290e21d354303f99736606eca7e855

Author: Ken Thomases <ken at codeweavers.com>
Date:   Wed Sep 11 23:46:25 2013 -0500

winemac: Return failure from DescribePixelFormat() for invalid pixel format.

Also use the proper function for checking the format and looking up the
internal format description.

---

 dlls/winemac.drv/opengl.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/dlls/winemac.drv/opengl.c b/dlls/winemac.drv/opengl.c
index a3c5d48..f2407fc 100644
--- a/dlls/winemac.drv/opengl.c
+++ b/dlls/winemac.drv/opengl.c
@@ -3307,16 +3307,16 @@ static BOOL create_context(struct wgl_context *context, CGLContextObj share)
  */
 int macdrv_wglDescribePixelFormat(HDC hdc, int fmt, UINT size, PIXELFORMATDESCRIPTOR *descr)
 {
-    int ret = nb_displayable_formats;
     const pixel_format *pf;
     const struct color_mode *mode;
 
     TRACE("hdc %p fmt %d size %u descr %p\n", hdc, fmt, size, descr);
 
-    if (fmt <= 0 || fmt > ret || !descr) return ret;
+    if (!descr) return nb_displayable_formats;
     if (size < sizeof(*descr)) return 0;
 
-    pf = &pixel_formats[fmt - 1];
+    if (!(pf = get_pixel_format(fmt, FALSE)))
+        return 0;
 
     memset(descr, 0, sizeof(*descr));
     descr->nSize            = sizeof(*descr);
@@ -3363,7 +3363,7 @@ int macdrv_wglDescribePixelFormat(HDC hdc, int fmt, UINT size, PIXELFORMATDESCRI
     descr->cStencilBits     = pf->stencil_bits;
     descr->cAuxBuffers      = pf->aux_buffers;
     descr->iLayerType       = PFD_MAIN_PLANE;
-    return ret;
+    return nb_displayable_formats;
 }
 
 /***********************************************************************




More information about the wine-cvs mailing list