ID2D1Bitmap derives from ID2D1Image, which in turn derives from ID2D1Resource. That means that ID2D1Device::CreateImageBrush() can't be really passed anything but a ID2D1Bitmap* represented as a ID2D1Image*.
I've added QueryInterface+FIXME just in case, probably it could be dropped.
v2: Fix test crashes with image == NULL. Signed-off-by: Dmitry Timoshkov dmitry@baikal.ru --- dlls/d2d1/brush.c | 15 ++++++++++++++- dlls/d2d1/d2d1_private.h | 1 - 2 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/dlls/d2d1/brush.c b/dlls/d2d1/brush.c index b9a673fe54c..2632b5892da 100644 --- a/dlls/d2d1/brush.c +++ b/dlls/d2d1/brush.c @@ -1327,7 +1327,20 @@ HRESULT d2d_image_brush_create(ID2D1Factory *factory, ID2D1Image *image, if (!(*brush = heap_alloc_zero(sizeof(**brush)))) return E_OUTOFMEMORY;
- d2d_brush_init(*brush, factory, D2D_BRUSH_TYPE_IMAGE, + if (image) + { + ID2D1Bitmap *bitmap; + + if (FAILED(ID2D1Image_QueryInterface(image, &IID_ID2D1Bitmap, (void **)&bitmap))) + { + FIXME("ID2D1Image doesn't support ID2D1Bitmap interface.\n"); + return E_FAIL; + } + + ID2D1Bitmap_Release(bitmap); + } + + d2d_brush_init(*brush, factory, D2D_BRUSH_TYPE_BITMAP, brush_desc, (ID2D1BrushVtbl *)&d2d_image_brush_vtbl); if (((*brush)->u.image.image = image)) ID2D1Image_AddRef((*brush)->u.image.image); diff --git a/dlls/d2d1/d2d1_private.h b/dlls/d2d1/d2d1_private.h index 29469f5142e..6183d9d4c99 100644 --- a/dlls/d2d1/d2d1_private.h +++ b/dlls/d2d1/d2d1_private.h @@ -42,7 +42,6 @@ enum d2d_brush_type D2D_BRUSH_TYPE_LINEAR, D2D_BRUSH_TYPE_RADIAL, D2D_BRUSH_TYPE_BITMAP, - D2D_BRUSH_TYPE_IMAGE, D2D_BRUSH_TYPE_COUNT, };
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=115075
Your paranoid android.
=== debian11 (32 bit WoW report) ===
d2d1: Unhandled exception: page fault on write access to 0x00000000 in 32-bit code (0x6ac0f5df).