Commit 31f31208 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

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.
parent f17e7148
...@@ -1361,10 +1361,10 @@ static HRESULT ddraw_surface_blt_clipped(IDirectDrawSurfaceImpl *dst_surface, co ...@@ -1361,10 +1361,10 @@ static HRESULT ddraw_surface_blt_clipped(IDirectDrawSurfaceImpl *dst_surface, co
if (src_surface) if (src_surface)
{ {
src_rect_clipped.left += (clip_rect[i].left - dst_rect.left) * scale_x; src_rect_clipped.left += (LONG)((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.top += (LONG)((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.right -= (LONG)((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.bottom -= (LONG)((dst_rect.bottom - clip_rect[i].bottom) * scale_y);
if (src_surface->surface_desc.ddsCaps.dwCaps & DDSCAPS_FRONTBUFFER) if (src_surface->surface_desc.ddsCaps.dwCaps & DDSCAPS_FRONTBUFFER)
{ {
......
...@@ -297,7 +297,7 @@ static void test_clipper_blt(void) ...@@ -297,7 +297,7 @@ static void test_clipper_blt(void)
SetRect(&src_rect, 0, 0, 4, 1); SetRect(&src_rect, 0, 0, 4, 1);
hr = IDirectDrawSurface_Blt(dst_surface, NULL, src_surface, &src_rect, DDBLT_WAIT, NULL); 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 (i = 0; i < 4; ++i)
{ {
for (j = 0; j < 4; ++j) for (j = 0; j < 4; ++j)
...@@ -305,12 +305,8 @@ static void test_clipper_blt(void) ...@@ -305,12 +305,8 @@ static void test_clipper_blt(void)
x = 80 * ((2 * j) + 1); x = 80 * ((2 * j) + 1);
y = 60 * ((2 * i) + 1); y = 60 * ((2 * i) + 1);
color = get_surface_color(dst_surface, x, y); color = get_surface_color(dst_surface, x, y);
if ((i < 2 && j < 2) || (i >= 2 && j >= 2)) ok(compare_color(color, expected1[i * 4 + j], 1),
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);
"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);
} }
} }
......
...@@ -304,7 +304,7 @@ static void test_clipper_blt(void) ...@@ -304,7 +304,7 @@ static void test_clipper_blt(void)
SetRect(&src_rect, 0, 0, 4, 1); SetRect(&src_rect, 0, 0, 4, 1);
hr = IDirectDrawSurface_Blt(dst_surface, NULL, src_surface, &src_rect, DDBLT_WAIT, NULL); 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 (i = 0; i < 4; ++i)
{ {
for (j = 0; j < 4; ++j) for (j = 0; j < 4; ++j)
...@@ -312,12 +312,8 @@ static void test_clipper_blt(void) ...@@ -312,12 +312,8 @@ static void test_clipper_blt(void)
x = 80 * ((2 * j) + 1); x = 80 * ((2 * j) + 1);
y = 60 * ((2 * i) + 1); y = 60 * ((2 * i) + 1);
color = get_surface_color(dst_surface, x, y); color = get_surface_color(dst_surface, x, y);
if ((i < 2 && j < 2) || (i >= 2 && j >= 2)) ok(compare_color(color, expected1[i * 4 + j], 1),
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);
"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);
} }
} }
......
...@@ -599,7 +599,7 @@ static void test_clipper_blt(void) ...@@ -599,7 +599,7 @@ static void test_clipper_blt(void)
SetRect(&src_rect, 0, 0, 4, 1); SetRect(&src_rect, 0, 0, 4, 1);
hr = IDirectDrawSurface4_Blt(dst_surface, NULL, src_surface, &src_rect, DDBLT_WAIT, NULL); 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 (i = 0; i < 4; ++i)
{ {
for (j = 0; j < 4; ++j) for (j = 0; j < 4; ++j)
...@@ -607,12 +607,8 @@ static void test_clipper_blt(void) ...@@ -607,12 +607,8 @@ static void test_clipper_blt(void)
x = 80 * ((2 * j) + 1); x = 80 * ((2 * j) + 1);
y = 60 * ((2 * i) + 1); y = 60 * ((2 * i) + 1);
color = get_surface_color(dst_surface, x, y); color = get_surface_color(dst_surface, x, y);
if ((i < 2 && j < 2) || (i >= 2 && j >= 2)) ok(compare_color(color, expected1[i * 4 + j], 1),
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);
"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);
} }
} }
......
...@@ -592,7 +592,7 @@ static void test_clipper_blt(void) ...@@ -592,7 +592,7 @@ static void test_clipper_blt(void)
SetRect(&src_rect, 0, 0, 4, 1); SetRect(&src_rect, 0, 0, 4, 1);
hr = IDirectDrawSurface7_Blt(dst_surface, NULL, src_surface, &src_rect, DDBLT_WAIT, NULL); 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 (i = 0; i < 4; ++i)
{ {
for (j = 0; j < 4; ++j) for (j = 0; j < 4; ++j)
...@@ -600,12 +600,8 @@ static void test_clipper_blt(void) ...@@ -600,12 +600,8 @@ static void test_clipper_blt(void)
x = 80 * ((2 * j) + 1); x = 80 * ((2 * j) + 1);
y = 60 * ((2 * i) + 1); y = 60 * ((2 * i) + 1);
color = get_surface_color(dst_surface, x, y); color = get_surface_color(dst_surface, x, y);
if ((i < 2 && j < 2) || (i >= 2 && j >= 2)) ok(compare_color(color, expected1[i * 4 + j], 1),
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);
"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);
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment