Sorry, but this one really does need this function. It has a comparison that doesn't fit the pattern 'abs(x - y) <= max_diff' that compare_uint() is intended for, and I'm not sure how to rewrite it to fit that pattern.
Signed-off-by: Chip Davis cdavis@codeweavers.com --- dlls/d3d9/tests/visual.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/dlls/d3d9/tests/visual.c b/dlls/d3d9/tests/visual.c index f873f3ae9b3..ab754f9d3bc 100644 --- a/dlls/d3d9/tests/visual.c +++ b/dlls/d3d9/tests/visual.c @@ -63,11 +63,14 @@ static HWND create_window(void) return hwnd; }
-static BOOL compare_uint(unsigned int x, unsigned int y, unsigned int max_diff) +static unsigned int absdiff(unsigned int x, unsigned int y) { - unsigned int diff = x > y ? x - y : y - x; + return x > y ? x - y : y - x; +}
- return diff <= max_diff; +static BOOL compare_uint(unsigned int x, unsigned int y, unsigned int max_diff) +{ + return absdiff(x, y) <= max_diff; }
static BOOL color_match(D3DCOLOR c1, D3DCOLOR c2, BYTE max_diff) @@ -3191,7 +3194,7 @@ static void generate_bumpmap_textures(IDirect3DDevice9 *device) { WORD *ptr = (WORD *)(((BYTE *)locked_rect.pBits) + (y * locked_rect.Pitch)); for (x = 0; x < 128; ++x) { - if(abs(x-64)>abs(y-64)) + if(absdiff(x,64)>absdiff(y,64)) { if(x < 64) *ptr++ = 0xc000;