[PATCH] d2d1: Implement ID2D1DeviceContext::CreateImageBrush().

Dmitry Timoshkov dmitry at baikal.ru
Fri May 6 04:32:29 CDT 2022


Signed-off-by: Dmitry Timoshkov <dmitry at 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,
-- 
2.35.3




More information about the wine-devel mailing list