ddraw: Convert to integer before adjusting the clipped source rect.

This makes a difference for the bottom and right edges, and we could end up
with an empty source rectangle otherwise.
This commit is contained in:
Henri Verbeet 2012-01-06 11:20:05 +01:00 committed by Alexandre Julliard
parent f17e714857
commit 31f3120815
5 changed files with 16 additions and 32 deletions

View File

@ -1361,10 +1361,10 @@ static HRESULT ddraw_surface_blt_clipped(IDirectDrawSurfaceImpl *dst_surface, co
if (src_surface)
{
src_rect_clipped.left += (clip_rect[i].left - dst_rect.left) * scale_x;
src_rect_clipped.top += (clip_rect[i].top - dst_rect.top) * scale_y;
src_rect_clipped.right -= (dst_rect.right - clip_rect[i].right) * scale_x;
src_rect_clipped.bottom -= (dst_rect.bottom - clip_rect[i].bottom) * scale_y;
src_rect_clipped.left += (LONG)((clip_rect[i].left - dst_rect.left) * scale_x);
src_rect_clipped.top += (LONG)((clip_rect[i].top - dst_rect.top) * scale_y);
src_rect_clipped.right -= (LONG)((dst_rect.right - clip_rect[i].right) * scale_x);
src_rect_clipped.bottom -= (LONG)((dst_rect.bottom - clip_rect[i].bottom) * scale_y);
if (src_surface->surface_desc.ddsCaps.dwCaps & DDSCAPS_FRONTBUFFER)
{

View File

@ -297,7 +297,7 @@ static void test_clipper_blt(void)
SetRect(&src_rect, 0, 0, 4, 1);
hr = IDirectDrawSurface_Blt(dst_surface, NULL, src_surface, &src_rect, DDBLT_WAIT, NULL);
todo_wine ok(SUCCEEDED(hr), "Failed to blit, hr %#x.\n", hr);
ok(SUCCEEDED(hr), "Failed to blit, hr %#x.\n", hr);
for (i = 0; i < 4; ++i)
{
for (j = 0; j < 4; ++j)
@ -305,12 +305,8 @@ static void test_clipper_blt(void)
x = 80 * ((2 * j) + 1);
y = 60 * ((2 * i) + 1);
color = get_surface_color(dst_surface, x, y);
if ((i < 2 && j < 2) || (i >= 2 && j >= 2))
todo_wine ok(compare_color(color, expected1[i * 4 + j], 1),
"Expected color 0x%08x at %u,%u, got 0x%08x.\n", expected1[i * 4 + j], x, y, color);
else
ok(compare_color(color, expected1[i * 4 + j], 1),
"Expected color 0x%08x at %u,%u, got 0x%08x.\n", expected1[i * 4 + j], x, y, color);
ok(compare_color(color, expected1[i * 4 + j], 1),
"Expected color 0x%08x at %u,%u, got 0x%08x.\n", expected1[i * 4 + j], x, y, color);
}
}

View File

@ -304,7 +304,7 @@ static void test_clipper_blt(void)
SetRect(&src_rect, 0, 0, 4, 1);
hr = IDirectDrawSurface_Blt(dst_surface, NULL, src_surface, &src_rect, DDBLT_WAIT, NULL);
todo_wine ok(SUCCEEDED(hr), "Failed to blit, hr %#x.\n", hr);
ok(SUCCEEDED(hr), "Failed to blit, hr %#x.\n", hr);
for (i = 0; i < 4; ++i)
{
for (j = 0; j < 4; ++j)
@ -312,12 +312,8 @@ static void test_clipper_blt(void)
x = 80 * ((2 * j) + 1);
y = 60 * ((2 * i) + 1);
color = get_surface_color(dst_surface, x, y);
if ((i < 2 && j < 2) || (i >= 2 && j >= 2))
todo_wine ok(compare_color(color, expected1[i * 4 + j], 1),
"Expected color 0x%08x at %u,%u, got 0x%08x.\n", expected1[i * 4 + j], x, y, color);
else
ok(compare_color(color, expected1[i * 4 + j], 1),
"Expected color 0x%08x at %u,%u, got 0x%08x.\n", expected1[i * 4 + j], x, y, color);
ok(compare_color(color, expected1[i * 4 + j], 1),
"Expected color 0x%08x at %u,%u, got 0x%08x.\n", expected1[i * 4 + j], x, y, color);
}
}

View File

@ -599,7 +599,7 @@ static void test_clipper_blt(void)
SetRect(&src_rect, 0, 0, 4, 1);
hr = IDirectDrawSurface4_Blt(dst_surface, NULL, src_surface, &src_rect, DDBLT_WAIT, NULL);
todo_wine ok(SUCCEEDED(hr), "Failed to blit, hr %#x.\n", hr);
ok(SUCCEEDED(hr), "Failed to blit, hr %#x.\n", hr);
for (i = 0; i < 4; ++i)
{
for (j = 0; j < 4; ++j)
@ -607,12 +607,8 @@ static void test_clipper_blt(void)
x = 80 * ((2 * j) + 1);
y = 60 * ((2 * i) + 1);
color = get_surface_color(dst_surface, x, y);
if ((i < 2 && j < 2) || (i >= 2 && j >= 2))
todo_wine ok(compare_color(color, expected1[i * 4 + j], 1),
"Expected color 0x%08x at %u,%u, got 0x%08x.\n", expected1[i * 4 + j], x, y, color);
else
ok(compare_color(color, expected1[i * 4 + j], 1),
"Expected color 0x%08x at %u,%u, got 0x%08x.\n", expected1[i * 4 + j], x, y, color);
ok(compare_color(color, expected1[i * 4 + j], 1),
"Expected color 0x%08x at %u,%u, got 0x%08x.\n", expected1[i * 4 + j], x, y, color);
}
}

View File

@ -592,7 +592,7 @@ static void test_clipper_blt(void)
SetRect(&src_rect, 0, 0, 4, 1);
hr = IDirectDrawSurface7_Blt(dst_surface, NULL, src_surface, &src_rect, DDBLT_WAIT, NULL);
todo_wine ok(SUCCEEDED(hr), "Failed to blit, hr %#x.\n", hr);
ok(SUCCEEDED(hr), "Failed to blit, hr %#x.\n", hr);
for (i = 0; i < 4; ++i)
{
for (j = 0; j < 4; ++j)
@ -600,12 +600,8 @@ static void test_clipper_blt(void)
x = 80 * ((2 * j) + 1);
y = 60 * ((2 * i) + 1);
color = get_surface_color(dst_surface, x, y);
if ((i < 2 && j < 2) || (i >= 2 && j >= 2))
todo_wine ok(compare_color(color, expected1[i * 4 + j], 1),
"Expected color 0x%08x at %u,%u, got 0x%08x.\n", expected1[i * 4 + j], x, y, color);
else
ok(compare_color(color, expected1[i * 4 + j], 1),
"Expected color 0x%08x at %u,%u, got 0x%08x.\n", expected1[i * 4 + j], x, y, color);
ok(compare_color(color, expected1[i * 4 + j], 1),
"Expected color 0x%08x at %u,%u, got 0x%08x.\n", expected1[i * 4 + j], x, y, color);
}
}