=?UTF-8?Q?Rico=20Sch=C3=BCller=20?=: d3dx9: Use set_number instead of get_bool/int/float.

Alexandre Julliard julliard at winehq.org
Fri Sep 14 10:54:21 CDT 2012


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

Author: Rico Schüller <kgbricola at web.de>
Date:   Fri Sep 14 10:56:07 2012 +0200

d3dx9: Use set_number instead of get_bool/int/float.

---

 dlls/d3dx9_36/d3dx9_36_private.h |    3 ---
 dlls/d3dx9_36/effect.c           |   19 +++++++++++--------
 dlls/d3dx9_36/util.c             |    6 +++---
 3 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/dlls/d3dx9_36/d3dx9_36_private.h b/dlls/d3dx9_36/d3dx9_36_private.h
index c4cc69c..bd208f8 100644
--- a/dlls/d3dx9_36/d3dx9_36_private.h
+++ b/dlls/d3dx9_36/d3dx9_36_private.h
@@ -94,9 +94,6 @@ const char *debug_d3dxparameter_type(D3DXPARAMETER_TYPE t) DECLSPEC_HIDDEN;
 const char *debug_d3dxparameter_registerset(D3DXREGISTER_SET r) DECLSPEC_HIDDEN;
 
 /* parameter type conversion helpers */
-INT get_int(D3DXPARAMETER_TYPE type, LPCVOID data) DECLSPEC_HIDDEN;
-FLOAT get_float(D3DXPARAMETER_TYPE type, LPCVOID data) DECLSPEC_HIDDEN;
-BOOL get_bool(LPCVOID data) DECLSPEC_HIDDEN;
 void set_number(LPVOID outdata, D3DXPARAMETER_TYPE outtype, LPCVOID indata, D3DXPARAMETER_TYPE intype) DECLSPEC_HIDDEN;
 
 #endif /* __WINE_D3DX9_36_PRIVATE_H */
diff --git a/dlls/d3dx9_36/effect.c b/dlls/d3dx9_36/effect.c
index a6dcd98..a063358 100644
--- a/dlls/d3dx9_36/effect.c
+++ b/dlls/d3dx9_36/effect.c
@@ -853,7 +853,10 @@ static void get_vector(struct d3dx_parameter *param, D3DXVECTOR4 *vector)
 
     for (i = 0; i < 4; ++i)
     {
-        ((FLOAT *)vector)[i] = i < param->columns ? get_float(param->type, (DWORD *)param->data + i) : 0.0f;
+        if (i < param->columns)
+            set_number((FLOAT *)vector + i, D3DXPT_FLOAT, (DWORD *)param->data + i, param->type);
+        else
+            ((FLOAT *)vector)[i] = 0.0f;
     }
 }
 
@@ -876,7 +879,7 @@ static void get_matrix(struct d3dx_parameter *param, D3DXMATRIX *matrix)
         for (k = 0; k < 4; ++k)
         {
             if ((i < param->rows) && (k < param->columns))
-                matrix->u.m[i][k] = get_float(param->type, (FLOAT *)param->data + i * param->columns + k);
+                set_number((FLOAT *)&matrix->u.m[i][k], D3DXPT_FLOAT, (DWORD *)param->data + i * param->columns + k, param->type);
             else
                 matrix->u.m[i][k] = 0.0f;
         }
@@ -1667,7 +1670,7 @@ static HRESULT WINAPI ID3DXBaseEffectImpl_GetBool(ID3DXBaseEffect *iface, D3DXHA
 
     if (b && param && !param->element_count && param->rows == 1 && param->columns == 1)
     {
-        *b = get_bool(param->data);
+        set_number(b, D3DXPT_BOOL, param->data, param->type);
         TRACE("Returning %s\n", *b ? "TRUE" : "FALSE");
         return D3D_OK;
     }
@@ -1733,7 +1736,7 @@ static HRESULT WINAPI ID3DXBaseEffectImpl_GetBoolArray(ID3DXBaseEffect *iface, D
 
         for (i = 0; i < size; ++i)
         {
-            b[i] = get_bool((DWORD *)param->data + i);
+            set_number(&b[i], D3DXPT_BOOL, (DWORD *)param->data + i, param->type);
         }
         return D3D_OK;
     }
@@ -1794,7 +1797,7 @@ static HRESULT WINAPI ID3DXBaseEffectImpl_GetInt(ID3DXBaseEffect *iface, D3DXHAN
     {
         if (param->columns == 1 && param->rows == 1)
         {
-            *n = get_int(param->type, param->data);
+            set_number(n, D3DXPT_INT, param->data, param->type);
             TRACE("Returning %i\n", *n);
             return D3D_OK;
         }
@@ -1879,7 +1882,7 @@ static HRESULT WINAPI ID3DXBaseEffectImpl_GetIntArray(ID3DXBaseEffect *iface, D3
 
         for (i = 0; i < size; ++i)
         {
-            n[i] = get_int(param->type, (DWORD *)param->data + i);
+            set_number(&n[i], D3DXPT_INT, (DWORD *)param->data + i, param->type);
         }
         return D3D_OK;
     }
@@ -1916,7 +1919,7 @@ static HRESULT WINAPI ID3DXBaseEffectImpl_GetFloat(ID3DXBaseEffect *iface, D3DXH
 
     if (f && param && !param->element_count && param->columns == 1 && param->rows == 1)
     {
-        *f = get_float(param->type, (DWORD *)param->data);
+        set_number(f, D3DXPT_FLOAT, (DWORD *)param->data, param->type);
         TRACE("Returning %f\n", *f);
         return D3D_OK;
     }
@@ -1981,7 +1984,7 @@ static HRESULT WINAPI ID3DXBaseEffectImpl_GetFloatArray(ID3DXBaseEffect *iface,
 
         for (i = 0; i < size; ++i)
         {
-            f[i] = get_float(param->type, (DWORD *)param->data + i);
+            set_number(&f[i], D3DXPT_FLOAT, (DWORD *)param->data + i, param->type);
         }
         return D3D_OK;
     }
diff --git a/dlls/d3dx9_36/util.c b/dlls/d3dx9_36/util.c
index c5160fa..b4cdefe 100644
--- a/dlls/d3dx9_36/util.c
+++ b/dlls/d3dx9_36/util.c
@@ -271,12 +271,12 @@ const char *debug_d3dxparameter_registerset(D3DXREGISTER_SET r)
 #undef WINE_D3DX_TO_STR
 
 /* parameter type conversion helpers */
-BOOL get_bool(LPCVOID data)
+static BOOL get_bool(LPCVOID data)
 {
     return (*(DWORD *)data) != 0;
 }
 
-INT get_int(D3DXPARAMETER_TYPE type, LPCVOID data)
+static INT get_int(D3DXPARAMETER_TYPE type, LPCVOID data)
 {
     INT i;
 
@@ -303,7 +303,7 @@ INT get_int(D3DXPARAMETER_TYPE type, LPCVOID data)
     return i;
 }
 
-FLOAT get_float(D3DXPARAMETER_TYPE type, LPCVOID data)
+static FLOAT get_float(D3DXPARAMETER_TYPE type, LPCVOID data)
 {
     FLOAT f;
 




More information about the wine-cvs mailing list