[PATCH 2/5] wined3d: Rename PLIGHTINFOEL to something less awful.

Henri Verbeet hverbeet at codeweavers.com
Wed Oct 14 03:55:16 CDT 2009


---
 dlls/wined3d/device.c          |   43 +++++++++++++++++++++++----------------
 dlls/wined3d/state.c           |    5 +--
 dlls/wined3d/stateblock.c      |   20 ++++++++++--------
 dlls/wined3d/wined3d_private.h |    6 ++--
 4 files changed, 41 insertions(+), 33 deletions(-)

diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 90da2a0..a94c4bb 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -2429,7 +2429,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_MultiplyTransform(IWineD3DDevice *iface
 
 static HRESULT WINAPI IWineD3DDeviceImpl_SetLight(IWineD3DDevice *iface, DWORD Index, CONST WINED3DLIGHT* pLight) {
     float rho;
-    PLIGHTINFOEL *object = NULL;
+    struct wined3d_light_info *object = NULL;
     UINT Hi = LIGHTMAP_HASHFUNC(Index);
     struct list *e;
 
@@ -2468,8 +2468,9 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetLight(IWineD3DDevice *iface, DWORD I
         return WINED3DERR_INVALIDCALL;
     }
 
-    LIST_FOR_EACH(e, &This->updateStateBlock->lightMap[Hi]) {
-        object = LIST_ENTRY(e, PLIGHTINFOEL, entry);
+    LIST_FOR_EACH(e, &This->updateStateBlock->lightMap[Hi])
+    {
+        object = LIST_ENTRY(e, struct wined3d_light_info, entry);
         if(object->OriginalIndex == Index) break;
         object = NULL;
     }
@@ -2572,15 +2573,17 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetLight(IWineD3DDevice *iface, DWORD I
     return WINED3D_OK;
 }
 
-static HRESULT WINAPI IWineD3DDeviceImpl_GetLight(IWineD3DDevice *iface, DWORD Index, WINED3DLIGHT* pLight) {
-    PLIGHTINFOEL *lightInfo = NULL;
+static HRESULT WINAPI IWineD3DDeviceImpl_GetLight(IWineD3DDevice *iface, DWORD Index, WINED3DLIGHT *pLight)
+{
+    struct wined3d_light_info *lightInfo = NULL;
     IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
     DWORD Hi = LIGHTMAP_HASHFUNC(Index);
     struct list *e;
     TRACE("(%p) : Idx(%d), pLight(%p)\n", This, Index, pLight);
 
-    LIST_FOR_EACH(e, &This->stateBlock->lightMap[Hi]) {
-        lightInfo = LIST_ENTRY(e, PLIGHTINFOEL, entry);
+    LIST_FOR_EACH(e, &This->stateBlock->lightMap[Hi])
+    {
+        lightInfo = LIST_ENTRY(e, struct wined3d_light_info, entry);
         if(lightInfo->OriginalIndex == Index) break;
         lightInfo = NULL;
     }
@@ -2598,15 +2601,17 @@ static HRESULT WINAPI IWineD3DDeviceImpl_GetLight(IWineD3DDevice *iface, DWORD I
  * Get / Set Light Enable
  *   (Note for consistency, renamed d3dx function by adding the 'set' prefix)
  *****/
-static HRESULT WINAPI IWineD3DDeviceImpl_SetLightEnable(IWineD3DDevice *iface, DWORD Index, BOOL Enable) {
-    PLIGHTINFOEL *lightInfo = NULL;
+static HRESULT WINAPI IWineD3DDeviceImpl_SetLightEnable(IWineD3DDevice *iface, DWORD Index, BOOL Enable)
+{
+    struct wined3d_light_info *lightInfo = NULL;
     IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
     UINT Hi = LIGHTMAP_HASHFUNC(Index);
     struct list *e;
     TRACE("(%p) : Idx(%d), enable? %d\n", This, Index, Enable);
 
-    LIST_FOR_EACH(e, &This->updateStateBlock->lightMap[Hi]) {
-        lightInfo = LIST_ENTRY(e, PLIGHTINFOEL, entry);
+    LIST_FOR_EACH(e, &This->updateStateBlock->lightMap[Hi])
+    {
+        lightInfo = LIST_ENTRY(e, struct wined3d_light_info, entry);
         if(lightInfo->OriginalIndex == Index) break;
         lightInfo = NULL;
     }
@@ -2619,8 +2624,9 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetLightEnable(IWineD3DDevice *iface, D
         IWineD3DDeviceImpl_SetLight(iface, Index, &WINED3D_default_light);
 
         /* Search for it again! Should be fairly quick as near head of list */
-        LIST_FOR_EACH(e, &This->updateStateBlock->lightMap[Hi]) {
-            lightInfo = LIST_ENTRY(e, PLIGHTINFOEL, entry);
+        LIST_FOR_EACH(e, &This->updateStateBlock->lightMap[Hi])
+        {
+            lightInfo = LIST_ENTRY(e, struct wined3d_light_info, entry);
             if(lightInfo->OriginalIndex == Index) break;
             lightInfo = NULL;
         }
@@ -2680,16 +2686,17 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetLightEnable(IWineD3DDevice *iface, D
     return WINED3D_OK;
 }
 
-static HRESULT WINAPI IWineD3DDeviceImpl_GetLightEnable(IWineD3DDevice *iface, DWORD Index,BOOL* pEnable) {
-
-    PLIGHTINFOEL *lightInfo = NULL;
+static HRESULT WINAPI IWineD3DDeviceImpl_GetLightEnable(IWineD3DDevice *iface, DWORD Index,BOOL* pEnable)
+{
+    struct wined3d_light_info *lightInfo = NULL;
     IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
     struct list *e;
     UINT Hi = LIGHTMAP_HASHFUNC(Index);
     TRACE("(%p) : for idx(%d)\n", This, Index);
 
-    LIST_FOR_EACH(e, &This->stateBlock->lightMap[Hi]) {
-        lightInfo = LIST_ENTRY(e, PLIGHTINFOEL, entry);
+    LIST_FOR_EACH(e, &This->stateBlock->lightMap[Hi])
+    {
+        lightInfo = LIST_ENTRY(e, struct wined3d_light_info, entry);
         if(lightInfo->OriginalIndex == Index) break;
         lightInfo = NULL;
     }
diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c
index 637bec6..e7723ee 100644
--- a/dlls/wined3d/state.c
+++ b/dlls/wined3d/state.c
@@ -3724,6 +3724,7 @@ static void state_vertexblend(DWORD state, IWineD3DStateBlockImpl *stateblock, s
 
 static void transform_view(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
 {
+    const struct wined3d_light_info *light = NULL;
     unsigned int k;
 
     /* If we are changing the View matrix, reset the light and clipping planes to the new view
@@ -3732,8 +3733,6 @@ static void transform_view(DWORD state, IWineD3DStateBlockImpl *stateblock, stru
      * NOTE2: Apparently texture transforms do NOT need reapplying
      */
 
-    const PLIGHTINFOEL *light = NULL;
-
     glMatrixMode(GL_MODELVIEW);
     checkGLcall("glMatrixMode(GL_MODELVIEW)");
     glLoadMatrixf(&stateblock->transforms[WINED3DTS_VIEW].u.m[0][0]);
@@ -4684,7 +4683,7 @@ static void viewport_vertexpart(DWORD state, IWineD3DStateBlockImpl *stateblock,
 static void light(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
 {
     UINT Index = state - STATE_ACTIVELIGHT(0);
-    const PLIGHTINFOEL *lightInfo = stateblock->activeLights[Index];
+    const struct wined3d_light_info *lightInfo = stateblock->activeLights[Index];
 
     if(!lightInfo) {
         glDisable(GL_LIGHT0 + Index);
diff --git a/dlls/wined3d/stateblock.c b/dlls/wined3d/stateblock.c
index 64ae8bb..74a9f3a 100644
--- a/dlls/wined3d/stateblock.c
+++ b/dlls/wined3d/stateblock.c
@@ -440,11 +440,11 @@ static void stateblock_init_lights(IWineD3DStateBlockImpl *stateblock, struct li
 
     for (i = 0; i < LIGHTMAP_SIZE; ++i)
     {
-        const PLIGHTINFOEL *src_light;
+        const struct wined3d_light_info *src_light;
 
-        LIST_FOR_EACH_ENTRY(src_light, &light_map[i], PLIGHTINFOEL, entry)
+        LIST_FOR_EACH_ENTRY(src_light, &light_map[i], struct wined3d_light_info, entry)
         {
-            PLIGHTINFOEL *dst_light = HeapAlloc(GetProcessHeap(), 0, sizeof(*dst_light));
+            struct wined3d_light_info *dst_light = HeapAlloc(GetProcessHeap(), 0, sizeof(*dst_light));
 
             *dst_light = *src_light;
             dst_light->changed = TRUE;
@@ -510,8 +510,9 @@ static ULONG  WINAPI IWineD3DStateBlockImpl_Release(IWineD3DStateBlock *iface) {
 
         for(counter = 0; counter < LIGHTMAP_SIZE; counter++) {
             struct list *e1, *e2;
-            LIST_FOR_EACH_SAFE(e1, e2, &This->lightMap[counter]) {
-                PLIGHTINFOEL *light = LIST_ENTRY(e1, PLIGHTINFOEL, entry);
+            LIST_FOR_EACH_SAFE(e1, e2, &This->lightMap[counter])
+            {
+                struct wined3d_light_info *light = LIST_ENTRY(e1, struct wined3d_light_info, entry);
                 list_remove(&light->entry);
                 HeapFree(GetProcessHeap(), 0, light);
             }
@@ -559,12 +560,12 @@ static void record_lights(IWineD3DStateBlockImpl *This, const IWineD3DStateBlock
         struct list *e, *f;
         LIST_FOR_EACH(e, &This->lightMap[i]) {
             BOOL updated = FALSE;
-            PLIGHTINFOEL *src = LIST_ENTRY(e, PLIGHTINFOEL, entry), *realLight;
+            struct wined3d_light_info *src = LIST_ENTRY(e, struct wined3d_light_info, entry), *realLight;
             if (!src->changed && !src->enabledChanged) continue;
 
             /* Look up the light in the destination */
             LIST_FOR_EACH(f, &targetStateBlock->lightMap[i]) {
-                realLight = LIST_ENTRY(f, PLIGHTINFOEL, entry);
+                realLight = LIST_ENTRY(f, struct wined3d_light_info, entry);
                 if(realLight->OriginalIndex == src->OriginalIndex) {
                     if(src->changed) {
                         src->OriginalParms = realLight->OriginalParms;
@@ -982,8 +983,9 @@ static void apply_lights(IWineD3DDevice *pDevice, const IWineD3DStateBlockImpl *
     for(i = 0; i < LIGHTMAP_SIZE; i++) {
         struct list *e;
 
-        LIST_FOR_EACH(e, &This->lightMap[i]) {
-            const PLIGHTINFOEL *light = LIST_ENTRY(e, PLIGHTINFOEL, entry);
+        LIST_FOR_EACH(e, &This->lightMap[i])
+        {
+            const struct wined3d_light_info *light = LIST_ENTRY(e, struct wined3d_light_info, entry);
 
             if(light->changed) {
                 IWineD3DDevice_SetLight(pDevice, light->OriginalIndex, &light->OriginalParms);
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 66d3865..4077d81 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -1203,8 +1203,8 @@ HRESULT create_primary_opengl_context(IWineD3DDevice *iface, IWineD3DSwapChain *
 /*****************************************************************************
  * Internal representation of a light
  */
-typedef struct PLIGHTINFOEL PLIGHTINFOEL;
-struct PLIGHTINFOEL {
+struct wined3d_light_info
+{
     WINED3DLIGHT OriginalParms; /* Note D3D8LIGHT == D3D9LIGHT */
     DWORD        OriginalIndex;
     LONG         glIndex;
@@ -2153,7 +2153,7 @@ struct IWineD3DStateBlockImpl
 #define LIGHTMAP_SIZE 43 /* Use of a prime number recommended. Set to 1 for a linked list! */
 #define LIGHTMAP_HASHFUNC(x) ((x) % LIGHTMAP_SIZE) /* Primitive and simple function */
     struct list               lightMap[LIGHTMAP_SIZE]; /* Hash map containing the lights */
-    PLIGHTINFOEL             *activeLights[MAX_ACTIVE_LIGHTS]; /* Map of opengl lights to d3d lights */
+    const struct wined3d_light_info *activeLights[MAX_ACTIVE_LIGHTS]; /* Map of opengl lights to d3d lights */
 
     /* Clipping */
     double                    clipplane[MAX_CLIPPLANES][4];
-- 
1.6.4.4




More information about the wine-patches mailing list