d2d1: Handle invalid interpolation mode in DrawBitmap().
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com> Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
00b40eac91
commit
56703ff9a6
|
@ -1006,6 +1006,7 @@ static void STDMETHODCALLTYPE d2d_device_context_DrawBitmap(ID2D1DeviceContext *
|
|||
ID2D1Bitmap *bitmap, const D2D1_RECT_F *dst_rect, float opacity,
|
||||
D2D1_BITMAP_INTERPOLATION_MODE interpolation_mode, const D2D1_RECT_F *src_rect)
|
||||
{
|
||||
struct d2d_device_context *context = impl_from_ID2D1DeviceContext(iface);
|
||||
D2D1_BITMAP_BRUSH_PROPERTIES bitmap_brush_desc;
|
||||
D2D1_BRUSH_PROPERTIES brush_desc;
|
||||
ID2D1BitmapBrush *brush;
|
||||
|
@ -1015,6 +1016,13 @@ static void STDMETHODCALLTYPE d2d_device_context_DrawBitmap(ID2D1DeviceContext *
|
|||
TRACE("iface %p, bitmap %p, dst_rect %s, opacity %.8e, interpolation_mode %#x, src_rect %s.\n",
|
||||
iface, bitmap, debug_d2d_rect_f(dst_rect), opacity, interpolation_mode, debug_d2d_rect_f(src_rect));
|
||||
|
||||
if (interpolation_mode != D2D1_BITMAP_INTERPOLATION_MODE_NEAREST_NEIGHBOR
|
||||
&& interpolation_mode != D2D1_BITMAP_INTERPOLATION_MODE_LINEAR)
|
||||
{
|
||||
context->error.code = E_INVALIDARG;
|
||||
return;
|
||||
}
|
||||
|
||||
if (src_rect)
|
||||
{
|
||||
s = *src_rect;
|
||||
|
|
|
@ -1815,6 +1815,19 @@ static void test_bitmap_brush(void)
|
|||
match = compare_surface(surface, "9437f4447d98feaad41a1c4202ee90aadc718ee6");
|
||||
ok(match, "Surface does not match.\n");
|
||||
|
||||
/* Invalid interpolation mode. */
|
||||
ID2D1RenderTarget_BeginDraw(rt);
|
||||
|
||||
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,
|
||||
D2D1_BITMAP_INTERPOLATION_MODE_LINEAR + 1, &src_rect);
|
||||
|
||||
hr = ID2D1RenderTarget_EndDraw(rt, NULL, NULL);
|
||||
ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
|
||||
match = compare_surface(surface, "9437f4447d98feaad41a1c4202ee90aadc718ee6");
|
||||
ok(match, "Surface does not match.\n");
|
||||
|
||||
ID2D1RenderTarget_BeginDraw(rt);
|
||||
|
||||
ID2D1RenderTarget_Clear(rt, &color);
|
||||
|
|
Loading…
Reference in New Issue