mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 18:15:11 +00:00
[WINESYNC] d3dx9/tests: Introduce compare_uint().
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org> wine commit id 9bcb1f5195d1e65e0e7afb288d36fee716fe3a60 by Henri Verbeet <hverbeet@codeweavers.com>
This commit is contained in:
parent
67c812be35
commit
1697b87434
2 changed files with 12 additions and 13 deletions
|
@ -146,20 +146,19 @@ static inline void expect_vec4_(unsigned int line, const D3DXVECTOR4 *expected,
|
|||
got->x, got->y, got->z, got->w);
|
||||
}
|
||||
|
||||
static BOOL compare_uint(unsigned int x, unsigned int y, unsigned int max_diff)
|
||||
{
|
||||
unsigned int diff = x > y ? x - y : y - x;
|
||||
|
||||
return diff <= max_diff;
|
||||
}
|
||||
|
||||
static BOOL compare_color(DWORD c1, DWORD c2, BYTE max_diff)
|
||||
{
|
||||
if (abs((c1 & 0xff) - (c2 & 0xff)) > max_diff)
|
||||
return FALSE;
|
||||
c1 >>= 8; c2 >>= 8;
|
||||
if (abs((c1 & 0xff) - (c2 & 0xff)) > max_diff)
|
||||
return FALSE;
|
||||
c1 >>= 8; c2 >>= 8;
|
||||
if (abs((c1 & 0xff) - (c2 & 0xff)) > max_diff)
|
||||
return FALSE;
|
||||
c1 >>= 8; c2 >>= 8;
|
||||
if (abs((c1 & 0xff) - (c2 & 0xff)) > max_diff)
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
return compare_uint(c1 & 0xff, c2 & 0xff, max_diff)
|
||||
&& compare_uint((c1 >> 8) & 0xff, (c2 >> 8) & 0xff, max_diff)
|
||||
&& compare_uint((c1 >> 16) & 0xff, (c2 >> 16) & 0xff, max_diff)
|
||||
&& compare_uint((c1 >> 24) & 0xff, (c2 >> 24) & 0xff, max_diff);
|
||||
}
|
||||
|
||||
static BOOL is_autogenmipmap_supported(IDirect3DDevice9 *device, D3DRESOURCETYPE resource_type)
|
||||
|
|
|
@ -15,4 +15,4 @@ files: {include/d3dx9.h: sdk/include/dxsdk/d3dx9.h, include/d3dx9anim.h: sdk/inc
|
|||
include/d3dx9mesh.h: sdk/include/dxsdk/d3dx9mesh.h, include/d3dx9of.h: sdk/include/dxsdk/d3dx9of.h,
|
||||
include/d3dx9shader.h: sdk/include/dxsdk/d3dx9shader.h, include/d3dx9shape.h: sdk/include/dxsdk/d3dx9shape.h,
|
||||
include/d3dx9tex.h: sdk/include/dxsdk/d3dx9tex.h, include/d3dx9xof.h: sdk/include/dxsdk/d3dx9xof.h}
|
||||
tags: {wine: aab980a16253ff6bb6286572576899bfc0f83945}
|
||||
tags: {wine: 9bcb1f5195d1e65e0e7afb288d36fee716fe3a60}
|
||||
|
|
Loading…
Reference in a new issue