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

Alexandre Julliard julliard at winehq.org
Fri Jan 6 15:31:34 CST 2012


Module: wine
Branch: master
Commit: 31f3120815721c36b3f31a66e91a564aa3c5165b
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=31f3120815721c36b3f31a66e91a564aa3c5165b

Author: Henri Verbeet <hverbeet at codeweavers.com>
Date:   Fri Jan  6 11:20:05 2012 +0100

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.

---

 dlls/ddraw/surface.c      |    8 ++++----
 dlls/ddraw/tests/ddraw1.c |   10 +++-------
 dlls/ddraw/tests/ddraw2.c |   10 +++-------
 dlls/ddraw/tests/ddraw4.c |   10 +++-------
 dlls/ddraw/tests/ddraw7.c |   10 +++-------
 5 files changed, 16 insertions(+), 32 deletions(-)

diff --git a/dlls/ddraw/surface.c b/dlls/ddraw/surface.c
index 0b9248c..6069da7 100644
--- a/dlls/ddraw/surface.c
+++ b/dlls/ddraw/surface.c
@@ -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)
             {
diff --git a/dlls/ddraw/tests/ddraw1.c b/dlls/ddraw/tests/ddraw1.c
index 7275df6..09d632a 100644
--- a/dlls/ddraw/tests/ddraw1.c
+++ b/dlls/ddraw/tests/ddraw1.c
@@ -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);
         }
     }
 
diff --git a/dlls/ddraw/tests/ddraw2.c b/dlls/ddraw/tests/ddraw2.c
index 71a57a8..7ffa977 100644
--- a/dlls/ddraw/tests/ddraw2.c
+++ b/dlls/ddraw/tests/ddraw2.c
@@ -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);
         }
     }
 
diff --git a/dlls/ddraw/tests/ddraw4.c b/dlls/ddraw/tests/ddraw4.c
index db8d005..68448d1 100644
--- a/dlls/ddraw/tests/ddraw4.c
+++ b/dlls/ddraw/tests/ddraw4.c
@@ -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);
         }
     }
 
diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c
index 630247b..d434c94 100644
--- a/dlls/ddraw/tests/ddraw7.c
+++ b/dlls/ddraw/tests/ddraw7.c
@@ -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);
         }
     }
 




More information about the wine-cvs mailing list