Signed-off-by: Dmitry Timoshkov dmitry@baikal.ru --- dlls/d2d1/device.c | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-)
diff --git a/dlls/d2d1/device.c b/dlls/d2d1/device.c index 13c99458cfa..fbee558d087 100644 --- a/dlls/d2d1/device.c +++ b/dlls/d2d1/device.c @@ -1929,10 +1929,33 @@ static HRESULT STDMETHODCALLTYPE d2d_device_context_CreateImageBrush(ID2D1Device ID2D1Image *image, const D2D1_IMAGE_BRUSH_PROPERTIES *image_brush_desc, const D2D1_BRUSH_PROPERTIES *brush_desc, ID2D1ImageBrush **brush) { - FIXME("iface %p, image %p, image_brush_desc %p, brush_desc %p, brush %p stub!\n", - iface, image, image_brush_desc, brush_desc, brush); + struct d2d_device_context *context = impl_from_ID2D1DeviceContext(iface); + struct d2d_brush *object; + ID2D1Bitmap *bitmap; + D2D1_BITMAP_BRUSH_PROPERTIES1 bitmap_brush_desc; + HRESULT hr;
- return E_NOTIMPL; + TRACE("iface %p, image %p, image_brush_desc %p, brush_desc %p, brush %p.\n", iface, image, image_brush_desc, + brush_desc, brush); + + hr = ID2D1Image_QueryInterface(image, &IID_ID2D1Bitmap, (void **)&bitmap); + if (FAILED(hr)) + { + FIXME("ID2D1Image doesn't support ID2D1Bitmap interface.\n"); + return hr; + } + + bitmap_brush_desc.extendModeX = image_brush_desc->extendModeX; + bitmap_brush_desc.extendModeY = image_brush_desc->extendModeY; + bitmap_brush_desc.interpolationMode = image_brush_desc->interpolationMode; + + if (SUCCEEDED(hr = d2d_bitmap_brush_create(context->factory, bitmap, &bitmap_brush_desc, + brush_desc, &object))) + *brush = (ID2D1ImageBrush *)&object->ID2D1Brush_iface; + + ID2D1Bitmap_Release(bitmap); + + return hr; }
static HRESULT STDMETHODCALLTYPE d2d_device_context_ID2D1DeviceContext_CreateBitmapBrush(ID2D1DeviceContext *iface,
On 5/6/22 12:32, Dmitry Timoshkov wrote:
hr = ID2D1Image_QueryInterface(image, &IID_ID2D1Bitmap, (void **)&bitmap);
if (FAILED(hr))
{
FIXME("ID2D1Image doesn't support ID2D1Bitmap interface.\n");
return hr;
}
bitmap_brush_desc.extendModeX = image_brush_desc->extendModeX;
bitmap_brush_desc.extendModeY = image_brush_desc->extendModeY;
bitmap_brush_desc.interpolationMode = image_brush_desc->interpolationMode;
if (SUCCEEDED(hr = d2d_bitmap_brush_create(context->factory, bitmap, &bitmap_brush_desc,
brush_desc, &object)))
*brush = (ID2D1ImageBrush *)&object->ID2D1Brush_iface;
ID2D1Bitmap_Release(bitmap);
return hr; }
static HRESULT STDMETHODCALLTYPE d2d_device_context_ID2D1DeviceContext_CreateBitmapBrush(ID2D1DeviceContext *iface,
I don't think this can work, ID2D1ImageBrush is not compatible with what d2d_bitmap_brush_create() returns.
Nikolay Sivov nsivov@codeweavers.com wrote:
On 5/6/22 12:32, Dmitry Timoshkov wrote:
hr = ID2D1Image_QueryInterface(image, &IID_ID2D1Bitmap, (void **)&bitmap);
if (FAILED(hr))
{
FIXME("ID2D1Image doesn't support ID2D1Bitmap interface.\n");
return hr;
}
bitmap_brush_desc.extendModeX = image_brush_desc->extendModeX;
bitmap_brush_desc.extendModeY = image_brush_desc->extendModeY;
bitmap_brush_desc.interpolationMode = image_brush_desc->interpolationMode;
if (SUCCEEDED(hr = d2d_bitmap_brush_create(context->factory, bitmap, &bitmap_brush_desc,
brush_desc, &object)))
*brush = (ID2D1ImageBrush *)&object->ID2D1Brush_iface;
ID2D1Bitmap_Release(bitmap);
return hr; }
static HRESULT STDMETHODCALLTYPE d2d_device_context_ID2D1DeviceContext_CreateBitmapBrush(ID2D1DeviceContext *iface,
I don't think this can work, ID2D1ImageBrush is not compatible with what d2d_bitmap_brush_create() returns.
Ah, I see, thanks for spotting that. Apparently the app that I have here doesn't call anything from ID2D1ImageBrush that is not compatible with what ID2D1BitmapBrush provides, so it worked here.