[PATCH 2/3] d2d1: Skip empty source rectangle for ID2D1RenderTarget_DrawBitmap().

Jactry Zeng jzeng at codeweavers.com
Fri Jan 15 08:55:38 CST 2021


Signed-off-by: Jactry Zeng <jzeng at codeweavers.com>
---
 dlls/d2d1/device.c     | 3 +++
 dlls/d2d1/tests/d2d1.c | 5 +++++
 2 files changed, 8 insertions(+)

diff --git a/dlls/d2d1/device.c b/dlls/d2d1/device.c
index b609a2c1e24..e8bc7207a67 100644
--- a/dlls/d2d1/device.c
+++ b/dlls/d2d1/device.c
@@ -1087,6 +1087,9 @@ static void d2d_device_context_draw_bitmap(struct d2d_device_context *context, I
         d2d_rect_intersect(&s, src_rect);
     }
 
+    if (s.left == s.right || s.top == s.bottom)
+        return;
+
     if (dst_rect)
     {
         d = *dst_rect;
diff --git a/dlls/d2d1/tests/d2d1.c b/dlls/d2d1/tests/d2d1.c
index 6e3bc4a51d2..19bb94530c2 100644
--- a/dlls/d2d1/tests/d2d1.c
+++ b/dlls/d2d1/tests/d2d1.c
@@ -1835,6 +1835,11 @@ static void test_bitmap_brush(void)
     /* Invalid interpolation mode. */
     ID2D1RenderTarget_BeginDraw(rt);
 
+    set_rect(&dst_rect, 4.0f, 8.0f, 8.0f, 12.0f);
+    set_rect(&src_rect, 0.0f, 1.0f, image_size.width, 1.0f);
+    ID2D1RenderTarget_DrawBitmap(rt, bitmap, &dst_rect, 1.0f,
+            D2D1_BITMAP_INTERPOLATION_MODE_NEAREST_NEIGHBOR, &src_rect);
+
     set_rect(&dst_rect, 1.0f, 8.0f, 4.0f, 12.0f);
     set_rect(&src_rect, 2.0f, 1.0f, 4.0f, 3.0f);
     ID2D1RenderTarget_DrawBitmap(rt, bitmap, &dst_rect, 1.0f,
-- 
2.29.2




More information about the wine-devel mailing list