Henri Verbeet : wined3d: Get rid of the WineD3D_PixelFormat typedef.

Alexandre Julliard julliard at winehq.org
Fri May 6 13:44:00 CDT 2011


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

Author: Henri Verbeet <hverbeet at codeweavers.com>
Date:   Thu May  5 20:56:10 2011 +0200

wined3d: Get rid of the WineD3D_PixelFormat typedef.

---

 dlls/wined3d/context.c         |    8 +++++---
 dlls/wined3d/directx.c         |   22 +++++++++++-----------
 dlls/wined3d/wined3d_private.h |    6 +++---
 3 files changed, 19 insertions(+), 17 deletions(-)

diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c
index 9fecddd..6898603 100644
--- a/dlls/wined3d/context.c
+++ b/dlls/wined3d/context.c
@@ -1219,10 +1219,12 @@ static int WineD3D_ChoosePixelFormat(IWineD3DDeviceImpl *This, HDC hdc,
 
     getDepthStencilBits(ds_format, &depthBits, &stencilBits);
 
-    for(matchtry = 0; matchtry < (sizeof(matches) / sizeof(matches[0])) && !iPixelFormat; matchtry++) {
-        for(i=0; i<nCfgs; i++) {
+    for (matchtry = 0; matchtry < (sizeof(matches) / sizeof(*matches)) && !iPixelFormat; ++matchtry)
+    {
+        for (i = 0; i < nCfgs; ++i)
+        {
+            const struct wined3d_pixel_format *cfg = &This->adapter->cfgs[i];
             BOOL exactDepthMatch = TRUE;
-            WineD3D_PixelFormat *cfg = &This->adapter->cfgs[i];
 
             /* For now only accept RGBA formats. Perhaps some day we will
              * allow floating point formats for pbuffers. */
diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c
index 69a0673..8b486f8 100644
--- a/dlls/wined3d/directx.c
+++ b/dlls/wined3d/directx.c
@@ -2932,7 +2932,7 @@ HRESULT CDECL wined3d_get_adapter_identifier(const struct wined3d *wined3d,
 }
 
 static BOOL IWineD3DImpl_IsPixelFormatCompatibleWithRenderFmt(const struct wined3d_gl_info *gl_info,
-        const WineD3D_PixelFormat *cfg, const struct wined3d_format *format)
+        const struct wined3d_pixel_format *cfg, const struct wined3d_format *format)
 {
     short redSize, greenSize, blueSize, alphaSize, colorBits;
 
@@ -2969,7 +2969,7 @@ static BOOL IWineD3DImpl_IsPixelFormatCompatibleWithRenderFmt(const struct wined
 }
 
 static BOOL IWineD3DImpl_IsPixelFormatCompatibleWithDepthFmt(const struct wined3d_gl_info *gl_info,
-        const WineD3D_PixelFormat *cfg, const struct wined3d_format *format)
+        const struct wined3d_pixel_format *cfg, const struct wined3d_format *format)
 {
     short depthSize, stencilSize;
     BOOL lockable = FALSE;
@@ -3033,7 +3033,7 @@ HRESULT CDECL wined3d_check_depth_stencil_match(const struct wined3d *wined3d,
     }
     else
     {
-        const WineD3D_PixelFormat *cfgs;
+        const struct wined3d_pixel_format *cfgs;
         unsigned int cfg_count;
         unsigned int i;
 
@@ -3094,7 +3094,7 @@ HRESULT CDECL wined3d_check_device_multisample_type(const struct wined3d *wined3
 
     if (format->flags & (WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_STENCIL))
     {
-        const WineD3D_PixelFormat *cfgs;
+        const struct wined3d_pixel_format *cfgs;
         unsigned int i, cfg_count;
 
         cfgs = adapter->cfgs;
@@ -3118,7 +3118,7 @@ HRESULT CDECL wined3d_check_device_multisample_type(const struct wined3d *wined3
     else if (format->flags & WINED3DFMT_FLAG_RENDERTARGET)
     {
         short redSize, greenSize, blueSize, alphaSize, colorBits;
-        const WineD3D_PixelFormat *cfgs;
+        const struct wined3d_pixel_format *cfgs;
         unsigned int i, cfg_count;
 
         if (!getColorBits(format, &redSize, &greenSize, &blueSize, &alphaSize, &colorBits))
@@ -3187,7 +3187,7 @@ static BOOL CheckDepthStencilCapability(const struct wined3d_adapter *adapter,
         /* Walk through all WGL pixel formats to find a match */
         for (it = 0; it < adapter->nCfgs; ++it)
         {
-            WineD3D_PixelFormat *cfg = &adapter->cfgs[it];
+            const struct wined3d_pixel_format *cfg = &adapter->cfgs[it];
             if (IWineD3DImpl_IsPixelFormatCompatibleWithRenderFmt(&adapter->gl_info, cfg, display_format))
             {
                 if (IWineD3DImpl_IsPixelFormatCompatibleWithDepthFmt(&adapter->gl_info, cfg, ds_format))
@@ -3217,10 +3217,10 @@ static BOOL CheckRenderTargetCapability(const struct wined3d_adapter *adapter,
     if (!(check_format->flags & WINED3DFMT_FLAG_RENDERTARGET)) return FALSE;
     if (wined3d_settings.offscreen_rendering_mode == ORM_BACKBUFFER)
     {
-        WineD3D_PixelFormat *cfgs = adapter->cfgs;
-        int it;
         short AdapterRed, AdapterGreen, AdapterBlue, AdapterAlpha, AdapterTotalSize;
         short CheckRed, CheckGreen, CheckBlue, CheckAlpha, CheckTotalSize;
+        const struct wined3d_pixel_format *cfgs = adapter->cfgs;
+        int it;
 
         getColorBits(adapter_format, &AdapterRed, &AdapterGreen, &AdapterBlue, &AdapterAlpha, &AdapterTotalSize);
         getColorBits(check_format, &CheckRed, &CheckGreen, &CheckBlue, &CheckAlpha, &CheckTotalSize);
@@ -5140,10 +5140,10 @@ static BOOL InitAdapters(struct wined3d *wined3d)
         struct wined3d_adapter *adapter = &wined3d->adapters[0];
         const struct wined3d_gl_info *gl_info = &adapter->gl_info;
         struct wined3d_fake_gl_ctx fake_gl_ctx = {0};
+        struct wined3d_pixel_format *cfgs;
         int iPixelFormat;
         int res;
         int i;
-        WineD3D_PixelFormat *cfgs;
         DISPLAY_DEVICEW DisplayDevice;
         HDC hdc;
 
@@ -5202,7 +5202,7 @@ static BOOL InitAdapters(struct wined3d *wined3d)
             attribute = WGL_NUMBER_PIXEL_FORMATS_ARB;
             GL_EXTCALL(wglGetPixelFormatAttribivARB(hdc, 0, 0, 1, &attribute, &adapter->nCfgs));
 
-            adapter->cfgs = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, adapter->nCfgs *sizeof(WineD3D_PixelFormat));
+            adapter->cfgs = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, adapter->nCfgs * sizeof(*adapter->cfgs));
             cfgs = adapter->cfgs;
             attribs[nAttribs++] = WGL_RED_BITS_ARB;
             attribs[nAttribs++] = WGL_GREEN_BITS_ARB;
@@ -5262,7 +5262,7 @@ static BOOL InitAdapters(struct wined3d *wined3d)
         else
         {
             int nCfgs = DescribePixelFormat(hdc, 0, 0, 0);
-            adapter->cfgs = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, nCfgs*sizeof(WineD3D_PixelFormat));
+            adapter->cfgs = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, nCfgs * sizeof(*adapter->cfgs));
             adapter->nCfgs = 0; /* We won't accept all formats e.g. software accelerated ones will be skipped */
 
             cfgs = adapter->cfgs;
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 6ca0ed7..3c3c428 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -1263,7 +1263,7 @@ struct wined3d_light_info
 /* The default light parameters */
 extern const WINED3DLIGHT WINED3D_default_light DECLSPEC_HIDDEN;
 
-typedef struct WineD3D_PixelFormat
+struct wined3d_pixel_format
 {
     int iPixelFormat; /* WGL pixel format */
     int iPixelType; /* WGL pixel type e.g. WGL_TYPE_RGBA_ARB, WGL_TYPE_RGBA_FLOAT_ARB or WGL_TYPE_COLORINDEX_ARB */
@@ -1273,7 +1273,7 @@ typedef struct WineD3D_PixelFormat
     BOOL doubleBuffer;
     int auxBuffers;
     int numSamples;
-} WineD3D_PixelFormat;
+} wined3d_pixel_format;
 
 /* The driver names reflect the lowest GPU supported
  * by a certain driver, so DRIVER_AMD_R300 supports
@@ -1528,7 +1528,7 @@ struct wined3d_adapter
     struct wined3d_driver_info driver_info;
     WCHAR                   DeviceName[CCHDEVICENAME]; /* DeviceName for use with e.g. ChangeDisplaySettings */
     int                     nCfgs;
-    WineD3D_PixelFormat     *cfgs;
+    struct wined3d_pixel_format *cfgs;
     BOOL                    brokenStencil; /* Set on cards which only offer mixed depth+stencil */
     unsigned int            TextureRam; /* Amount of texture memory both video ram + AGP/TurboCache/HyperMemory/.. */
     unsigned int            UsedTextureRam;




More information about the wine-cvs mailing list