d3dx9: Move bool cropping into helper function.

This commit is contained in:
Rico Schüller 2012-09-05 22:51:42 +02:00 committed by Alexandre Julliard
parent 65c651e376
commit 823d1fbc38
2 changed files with 15 additions and 10 deletions

View file

@ -1649,8 +1649,6 @@ static HRESULT WINAPI ID3DXBaseEffectImpl_SetBool(ID3DXBaseEffect *iface, D3DXHA
if (param && !param->element_count && param->rows == 1 && param->columns == 1)
{
/* crop input */
b = b != 0;
set_number(param->data, param->type, &b, D3DXPT_BOOL);
return D3D_OK;
}
@ -1699,7 +1697,8 @@ static HRESULT WINAPI ID3DXBaseEffectImpl_SetBoolArray(ID3DXBaseEffect *iface, D
case D3DXPC_MATRIX_ROWS:
for (i = 0; i < size; ++i)
{
set_number((DWORD *)param->data + i, param->type, &b[i], D3DXPT_BOOL);
/* don't crop the input, use D3DXPT_INT instead of D3DXPT_BOOL */
set_number((DWORD *)param->data + i, param->type, &b[i], D3DXPT_INT);
}
return D3D_OK;

View file

@ -271,6 +271,11 @@ const char *debug_d3dxparameter_registerset(D3DXREGISTER_SET r)
#undef WINE_D3DX_TO_STR
/* parameter type conversion helpers */
BOOL get_bool(LPCVOID data)
{
return (*(DWORD *)data) != 0;
}
INT get_int(D3DXPARAMETER_TYPE type, LPCVOID data)
{
INT i;
@ -286,7 +291,7 @@ INT get_int(D3DXPARAMETER_TYPE type, LPCVOID data)
break;
case D3DXPT_BOOL:
i = *(BOOL *)data;
i = get_bool(data);
break;
default:
@ -313,7 +318,7 @@ FLOAT get_float(D3DXPARAMETER_TYPE type, LPCVOID data)
break;
case D3DXPT_BOOL:
f = *(BOOL *)data;
f = get_bool(data);
break;
default:
@ -325,15 +330,16 @@ FLOAT get_float(D3DXPARAMETER_TYPE type, LPCVOID data)
return f;
}
BOOL get_bool(LPCVOID data)
{
return (*(DWORD *)data) != 0;
}
void set_number(LPVOID outdata, D3DXPARAMETER_TYPE outtype, LPCVOID indata, D3DXPARAMETER_TYPE intype)
{
TRACE("Changing from type %s to type %s\n", debug_d3dxparameter_type(intype), debug_d3dxparameter_type(outtype));
if (outtype == intype)
{
*(DWORD *)outdata = *(DWORD *)indata;
return;
}
switch (outtype)
{
case D3DXPT_FLOAT: