Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/d2d1/brush.c | 134 ++++++++++++++++++++++++++++----------- dlls/d2d1/d2d1_private.h | 2 +- dlls/d2d1/tests/d2d1.c | 44 +++++++++++++ 3 files changed, 142 insertions(+), 38 deletions(-)
diff --git a/dlls/d2d1/brush.c b/dlls/d2d1/brush.c index 450507cef6..fa4488ef18 100644 --- a/dlls/d2d1/brush.c +++ b/dlls/d2d1/brush.c @@ -816,22 +816,23 @@ HRESULT d2d_radial_gradient_brush_create(ID2D1Factory *factory, return S_OK; }
-static inline struct d2d_brush *impl_from_ID2D1BitmapBrush(ID2D1BitmapBrush *iface) +static inline struct d2d_brush *impl_from_ID2D1BitmapBrush1(ID2D1BitmapBrush1 *iface) { return CONTAINING_RECORD(iface, struct d2d_brush, ID2D1Brush_iface); }
-static HRESULT STDMETHODCALLTYPE d2d_bitmap_brush_QueryInterface(ID2D1BitmapBrush *iface, +static HRESULT STDMETHODCALLTYPE d2d_bitmap_brush_QueryInterface(ID2D1BitmapBrush1 *iface, REFIID iid, void **out) { TRACE("iface %p, iid %s, out %p.\n", iface, debugstr_guid(iid), out);
- if (IsEqualGUID(iid, &IID_ID2D1BitmapBrush) + if (IsEqualGUID(iid, &IID_ID2D1BitmapBrush1) + || IsEqualGUID(iid, &IID_ID2D1BitmapBrush) || IsEqualGUID(iid, &IID_ID2D1Brush) || IsEqualGUID(iid, &IID_ID2D1Resource) || IsEqualGUID(iid, &IID_IUnknown)) { - ID2D1BitmapBrush_AddRef(iface); + ID2D1BitmapBrush1_AddRef(iface); *out = iface; return S_OK; } @@ -842,9 +843,9 @@ static HRESULT STDMETHODCALLTYPE d2d_bitmap_brush_QueryInterface(ID2D1BitmapBrus return E_NOINTERFACE; }
-static ULONG STDMETHODCALLTYPE d2d_bitmap_brush_AddRef(ID2D1BitmapBrush *iface) +static ULONG STDMETHODCALLTYPE d2d_bitmap_brush_AddRef(ID2D1BitmapBrush1 *iface) { - struct d2d_brush *brush = impl_from_ID2D1BitmapBrush(iface); + struct d2d_brush *brush = impl_from_ID2D1BitmapBrush1(iface); ULONG refcount = InterlockedIncrement(&brush->refcount);
TRACE("%p increasing refcount to %u.\n", iface, refcount); @@ -852,9 +853,9 @@ static ULONG STDMETHODCALLTYPE d2d_bitmap_brush_AddRef(ID2D1BitmapBrush *iface) return refcount; }
-static ULONG STDMETHODCALLTYPE d2d_bitmap_brush_Release(ID2D1BitmapBrush *iface) +static ULONG STDMETHODCALLTYPE d2d_bitmap_brush_Release(ID2D1BitmapBrush1 *iface) { - struct d2d_brush *brush = impl_from_ID2D1BitmapBrush(iface); + struct d2d_brush *brush = impl_from_ID2D1BitmapBrush1(iface); ULONG refcount = InterlockedDecrement(&brush->refcount);
TRACE("%p decreasing refcount to %u.\n", iface, refcount); @@ -871,57 +872,57 @@ static ULONG STDMETHODCALLTYPE d2d_bitmap_brush_Release(ID2D1BitmapBrush *iface) return refcount; }
-static void STDMETHODCALLTYPE d2d_bitmap_brush_GetFactory(ID2D1BitmapBrush *iface, +static void STDMETHODCALLTYPE d2d_bitmap_brush_GetFactory(ID2D1BitmapBrush1 *iface, ID2D1Factory **factory) { - struct d2d_brush *brush = impl_from_ID2D1BitmapBrush(iface); + struct d2d_brush *brush = impl_from_ID2D1BitmapBrush1(iface);
TRACE("iface %p, factory %p.\n", iface, factory);
ID2D1Factory_AddRef(*factory = brush->factory); }
-static void STDMETHODCALLTYPE d2d_bitmap_brush_SetOpacity(ID2D1BitmapBrush *iface, float opacity) +static void STDMETHODCALLTYPE d2d_bitmap_brush_SetOpacity(ID2D1BitmapBrush1 *iface, float opacity) { - struct d2d_brush *brush = impl_from_ID2D1BitmapBrush(iface); + struct d2d_brush *brush = impl_from_ID2D1BitmapBrush1(iface);
TRACE("iface %p, opacity %.8e.\n", iface, opacity);
brush->opacity = opacity; }
-static void STDMETHODCALLTYPE d2d_bitmap_brush_SetTransform(ID2D1BitmapBrush *iface, +static void STDMETHODCALLTYPE d2d_bitmap_brush_SetTransform(ID2D1BitmapBrush1 *iface, const D2D1_MATRIX_3X2_F *transform) { - struct d2d_brush *brush = impl_from_ID2D1BitmapBrush(iface); + struct d2d_brush *brush = impl_from_ID2D1BitmapBrush1(iface);
TRACE("iface %p, transform %p.\n", iface, transform);
brush->transform = *transform; }
-static float STDMETHODCALLTYPE d2d_bitmap_brush_GetOpacity(ID2D1BitmapBrush *iface) +static float STDMETHODCALLTYPE d2d_bitmap_brush_GetOpacity(ID2D1BitmapBrush1 *iface) { - struct d2d_brush *brush = impl_from_ID2D1BitmapBrush(iface); + struct d2d_brush *brush = impl_from_ID2D1BitmapBrush1(iface);
TRACE("iface %p.\n", iface);
return brush->opacity; }
-static void STDMETHODCALLTYPE d2d_bitmap_brush_GetTransform(ID2D1BitmapBrush *iface, +static void STDMETHODCALLTYPE d2d_bitmap_brush_GetTransform(ID2D1BitmapBrush1 *iface, D2D1_MATRIX_3X2_F *transform) { - struct d2d_brush *brush = impl_from_ID2D1BitmapBrush(iface); + struct d2d_brush *brush = impl_from_ID2D1BitmapBrush1(iface);
TRACE("iface %p, transform %p.\n", iface, transform);
*transform = brush->transform; }
-static void STDMETHODCALLTYPE d2d_bitmap_brush_SetExtendModeX(ID2D1BitmapBrush *iface, D2D1_EXTEND_MODE mode) +static void STDMETHODCALLTYPE d2d_bitmap_brush_SetExtendModeX(ID2D1BitmapBrush1 *iface, D2D1_EXTEND_MODE mode) { - struct d2d_brush *brush = impl_from_ID2D1BitmapBrush(iface); + struct d2d_brush *brush = impl_from_ID2D1BitmapBrush1(iface);
TRACE("iface %p, mode %#x.\n", iface, mode);
@@ -933,9 +934,9 @@ static void STDMETHODCALLTYPE d2d_bitmap_brush_SetExtendModeX(ID2D1BitmapBrush * } }
-static void STDMETHODCALLTYPE d2d_bitmap_brush_SetExtendModeY(ID2D1BitmapBrush *iface, D2D1_EXTEND_MODE mode) +static void STDMETHODCALLTYPE d2d_bitmap_brush_SetExtendModeY(ID2D1BitmapBrush1 *iface, D2D1_EXTEND_MODE mode) { - struct d2d_brush *brush = impl_from_ID2D1BitmapBrush(iface); + struct d2d_brush *brush = impl_from_ID2D1BitmapBrush1(iface);
TRACE("iface %p, mode %#x.\n", iface, mode);
@@ -947,13 +948,23 @@ static void STDMETHODCALLTYPE d2d_bitmap_brush_SetExtendModeY(ID2D1BitmapBrush * } }
-static void STDMETHODCALLTYPE d2d_bitmap_brush_SetInterpolationMode(ID2D1BitmapBrush *iface, +static void STDMETHODCALLTYPE d2d_bitmap_brush_SetInterpolationMode(ID2D1BitmapBrush1 *iface, D2D1_BITMAP_INTERPOLATION_MODE mode) { - struct d2d_brush *brush = impl_from_ID2D1BitmapBrush(iface); + struct d2d_brush *brush = impl_from_ID2D1BitmapBrush1(iface);
TRACE("iface %p, mode %#x.\n", iface, mode);
+ switch (mode) + { + case D2D1_BITMAP_INTERPOLATION_MODE_NEAREST_NEIGHBOR: + case D2D1_BITMAP_INTERPOLATION_MODE_LINEAR: + break; + default: + WARN("Unknown interpolation mode %#x.\n", mode); + return; + } + brush->u.bitmap.interpolation_mode = mode; if (brush->u.bitmap.sampler_state) { @@ -962,9 +973,9 @@ static void STDMETHODCALLTYPE d2d_bitmap_brush_SetInterpolationMode(ID2D1BitmapB } }
-static void STDMETHODCALLTYPE d2d_bitmap_brush_SetBitmap(ID2D1BitmapBrush *iface, ID2D1Bitmap *bitmap) +static void STDMETHODCALLTYPE d2d_bitmap_brush_SetBitmap(ID2D1BitmapBrush1 *iface, ID2D1Bitmap *bitmap) { - struct d2d_brush *brush = impl_from_ID2D1BitmapBrush(iface); + struct d2d_brush *brush = impl_from_ID2D1BitmapBrush1(iface);
TRACE("iface %p, bitmap %p.\n", iface, bitmap);
@@ -975,36 +986,43 @@ static void STDMETHODCALLTYPE d2d_bitmap_brush_SetBitmap(ID2D1BitmapBrush *iface brush->u.bitmap.bitmap = unsafe_impl_from_ID2D1Bitmap(bitmap); }
-static D2D1_EXTEND_MODE STDMETHODCALLTYPE d2d_bitmap_brush_GetExtendModeX(ID2D1BitmapBrush *iface) +static D2D1_EXTEND_MODE STDMETHODCALLTYPE d2d_bitmap_brush_GetExtendModeX(ID2D1BitmapBrush1 *iface) { - struct d2d_brush *brush = impl_from_ID2D1BitmapBrush(iface); + struct d2d_brush *brush = impl_from_ID2D1BitmapBrush1(iface);
TRACE("iface %p.\n", iface);
return brush->u.bitmap.extend_mode_x; }
-static D2D1_EXTEND_MODE STDMETHODCALLTYPE d2d_bitmap_brush_GetExtendModeY(ID2D1BitmapBrush *iface) +static D2D1_EXTEND_MODE STDMETHODCALLTYPE d2d_bitmap_brush_GetExtendModeY(ID2D1BitmapBrush1 *iface) { - struct d2d_brush *brush = impl_from_ID2D1BitmapBrush(iface); + struct d2d_brush *brush = impl_from_ID2D1BitmapBrush1(iface);
TRACE("iface %p.\n", iface);
return brush->u.bitmap.extend_mode_y; }
-static D2D1_BITMAP_INTERPOLATION_MODE STDMETHODCALLTYPE d2d_bitmap_brush_GetInterpolationMode(ID2D1BitmapBrush *iface) +static D2D1_BITMAP_INTERPOLATION_MODE STDMETHODCALLTYPE d2d_bitmap_brush_GetInterpolationMode(ID2D1BitmapBrush1 *iface) { - struct d2d_brush *brush = impl_from_ID2D1BitmapBrush(iface); + struct d2d_brush *brush = impl_from_ID2D1BitmapBrush1(iface);
TRACE("iface %p.\n", iface);
- return brush->u.bitmap.interpolation_mode; + switch (brush->u.bitmap.interpolation_mode) + { + case D2D1_INTERPOLATION_MODE_NEAREST_NEIGHBOR: + case D2D1_INTERPOLATION_MODE_LINEAR: + return brush->u.bitmap.interpolation_mode; + default: + return D2D1_BITMAP_INTERPOLATION_MODE_LINEAR; + } }
-static void STDMETHODCALLTYPE d2d_bitmap_brush_GetBitmap(ID2D1BitmapBrush *iface, ID2D1Bitmap **bitmap) +static void STDMETHODCALLTYPE d2d_bitmap_brush_GetBitmap(ID2D1BitmapBrush1 *iface, ID2D1Bitmap **bitmap) { - struct d2d_brush *brush = impl_from_ID2D1BitmapBrush(iface); + struct d2d_brush *brush = impl_from_ID2D1BitmapBrush1(iface);
TRACE("iface %p, bitmap %p.\n", iface, bitmap);
@@ -1012,7 +1030,47 @@ static void STDMETHODCALLTYPE d2d_bitmap_brush_GetBitmap(ID2D1BitmapBrush *iface ID2D1Bitmap_AddRef(*bitmap); }
-static const struct ID2D1BitmapBrushVtbl d2d_bitmap_brush_vtbl = +static void STDMETHODCALLTYPE d2d_bitmap_brush_SetInterpolationMode1(ID2D1BitmapBrush1 *iface, + D2D1_INTERPOLATION_MODE mode) +{ + struct d2d_brush *brush = impl_from_ID2D1BitmapBrush1(iface); + + TRACE("iface %p, mode %#x.\n", iface, mode); + + switch (mode) + { + case D2D1_INTERPOLATION_MODE_NEAREST_NEIGHBOR: + case D2D1_INTERPOLATION_MODE_LINEAR: + break; + case D2D1_INTERPOLATION_MODE_CUBIC: + case D2D1_INTERPOLATION_MODE_MULTI_SAMPLE_LINEAR: + case D2D1_INTERPOLATION_MODE_ANISOTROPIC: + case D2D1_INTERPOLATION_MODE_HIGH_QUALITY_CUBIC: + FIXME("Unhandled interpolation mode %#x.\n", mode); + break; + default: + WARN("Unknown interpolation mode %#x.\n", mode); + return; + } + + brush->u.bitmap.interpolation_mode = mode; + if (brush->u.bitmap.sampler_state) + { + ID3D10SamplerState_Release(brush->u.bitmap.sampler_state); + brush->u.bitmap.sampler_state = NULL; + } +} + +static D2D1_INTERPOLATION_MODE STDMETHODCALLTYPE d2d_bitmap_brush_GetInterpolationMode1(ID2D1BitmapBrush1 *iface) +{ + struct d2d_brush *brush = impl_from_ID2D1BitmapBrush1(iface); + + TRACE("iface %p.\n", iface); + + return brush->u.bitmap.interpolation_mode; +} + +static const struct ID2D1BitmapBrush1Vtbl d2d_bitmap_brush_vtbl = { d2d_bitmap_brush_QueryInterface, d2d_bitmap_brush_AddRef, @@ -1030,6 +1088,8 @@ static const struct ID2D1BitmapBrushVtbl d2d_bitmap_brush_vtbl = d2d_bitmap_brush_GetExtendModeY, d2d_bitmap_brush_GetInterpolationMode, d2d_bitmap_brush_GetBitmap, + d2d_bitmap_brush_SetInterpolationMode1, + d2d_bitmap_brush_GetInterpolationMode1, };
HRESULT d2d_bitmap_brush_create(ID2D1Factory *factory, ID2D1Bitmap *bitmap, const D2D1_BITMAP_BRUSH_PROPERTIES *bitmap_brush_desc, @@ -1242,7 +1302,7 @@ static void d2d_brush_bind_bitmap(struct d2d_brush *brush, ID3D10Device *device, { D3D10_SAMPLER_DESC sampler_desc;
- if (brush->u.bitmap.interpolation_mode == D2D1_BITMAP_INTERPOLATION_MODE_NEAREST_NEIGHBOR) + if (brush->u.bitmap.interpolation_mode == D2D1_INTERPOLATION_MODE_NEAREST_NEIGHBOR) sampler_desc.Filter = D3D10_FILTER_MIN_MAG_MIP_POINT; else sampler_desc.Filter = D3D10_FILTER_MIN_MAG_MIP_LINEAR; diff --git a/dlls/d2d1/d2d1_private.h b/dlls/d2d1/d2d1_private.h index 3fed59fa72..c8515eaa12 100644 --- a/dlls/d2d1/d2d1_private.h +++ b/dlls/d2d1/d2d1_private.h @@ -280,7 +280,7 @@ struct d2d_brush struct d2d_bitmap *bitmap; D2D1_EXTEND_MODE extend_mode_x; D2D1_EXTEND_MODE extend_mode_y; - D2D1_BITMAP_INTERPOLATION_MODE interpolation_mode; + D2D1_INTERPOLATION_MODE interpolation_mode; ID3D10SamplerState *sampler_state; } bitmap; } u; diff --git a/dlls/d2d1/tests/d2d1.c b/dlls/d2d1/tests/d2d1.c index 6419df23d8..4136b69885 100644 --- a/dlls/d2d1/tests/d2d1.c +++ b/dlls/d2d1/tests/d2d1.c @@ -1656,6 +1656,7 @@ static void test_bitmap_brush(void) D2D1_RECT_F src_rect, dst_rect; D2D1_EXTEND_MODE extend_mode; IDXGISwapChain *swapchain; + ID2D1BitmapBrush1 *brush1; ID2D1BitmapBrush *brush; ID2D1RenderTarget *rt; ID3D10Device1 *device; @@ -1877,6 +1878,49 @@ static void test_bitmap_brush(void) match = compare_surface(surface, "cf7b90ba7b139fdfbe9347e1907d635cfb4ed197"); ok(match, "Surface does not match.\n");
+ if (SUCCEEDED(ID2D1BitmapBrush_QueryInterface(brush, &IID_ID2D1BitmapBrush1, (void **)&brush1))) + { + D2D1_INTERPOLATION_MODE interpolation_mode1; + + interpolation_mode = ID2D1BitmapBrush1_GetInterpolationMode(brush1); + ok(interpolation_mode == D2D1_BITMAP_INTERPOLATION_MODE_NEAREST_NEIGHBOR, + "Unexpected interpolation mode %#x.\n", interpolation_mode); + + interpolation_mode1 = ID2D1BitmapBrush1_GetInterpolationMode1(brush1); + ok(interpolation_mode1 == D2D1_INTERPOLATION_MODE_NEAREST_NEIGHBOR, + "Unexpected interpolation mode %#x.\n", interpolation_mode1); + + ID2D1BitmapBrush1_SetInterpolationMode1(brush1, D2D1_INTERPOLATION_MODE_CUBIC); + interpolation_mode = ID2D1BitmapBrush1_GetInterpolationMode(brush1); + ok(interpolation_mode == D2D1_BITMAP_INTERPOLATION_MODE_LINEAR, + "Unexpected interpolation mode %#x.\n", interpolation_mode); + + interpolation_mode1 = ID2D1BitmapBrush1_GetInterpolationMode1(brush1); + ok(interpolation_mode1 == D2D1_INTERPOLATION_MODE_CUBIC, + "Unexpected interpolation mode %#x.\n", interpolation_mode1); + + ID2D1BitmapBrush1_SetInterpolationMode1(brush1, 100); + interpolation_mode1 = ID2D1BitmapBrush1_GetInterpolationMode1(brush1); + ok(interpolation_mode1 == D2D1_INTERPOLATION_MODE_CUBIC, + "Unexpected interpolation mode %#x.\n", interpolation_mode1); + + ID2D1BitmapBrush1_SetInterpolationMode(brush1, 100); + interpolation_mode1 = ID2D1BitmapBrush1_GetInterpolationMode1(brush1); + ok(interpolation_mode1 == D2D1_INTERPOLATION_MODE_CUBIC, + "Unexpected interpolation mode %#x.\n", interpolation_mode1); + + ID2D1BitmapBrush1_SetInterpolationMode(brush1, D2D1_BITMAP_INTERPOLATION_MODE_NEAREST_NEIGHBOR); + interpolation_mode = ID2D1BitmapBrush1_GetInterpolationMode(brush1); + ok(interpolation_mode == D2D1_BITMAP_INTERPOLATION_MODE_NEAREST_NEIGHBOR, + "Unexpected interpolation mode %#x.\n", interpolation_mode); + + interpolation_mode1 = ID2D1BitmapBrush1_GetInterpolationMode1(brush1); + ok(interpolation_mode1 == D2D1_INTERPOLATION_MODE_NEAREST_NEIGHBOR, + "Unexpected interpolation mode %#x.\n", interpolation_mode1); + + ID2D1BitmapBrush1_Release(brush1); + } + ID2D1BitmapBrush_Release(brush); refcount = ID2D1Bitmap_Release(bitmap); ok(!refcount, "Bitmap has %u references left.\n", refcount);
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/d2d1/brush.c | 5 +++-- dlls/d2d1/d2d1_private.h | 2 +- dlls/d2d1/device.c | 20 ++++++++++++++------ 3 files changed, 18 insertions(+), 9 deletions(-)
diff --git a/dlls/d2d1/brush.c b/dlls/d2d1/brush.c index fa4488ef18..b03af89211 100644 --- a/dlls/d2d1/brush.c +++ b/dlls/d2d1/brush.c @@ -1092,8 +1092,9 @@ static const struct ID2D1BitmapBrush1Vtbl d2d_bitmap_brush_vtbl = d2d_bitmap_brush_GetInterpolationMode1, };
-HRESULT d2d_bitmap_brush_create(ID2D1Factory *factory, ID2D1Bitmap *bitmap, const D2D1_BITMAP_BRUSH_PROPERTIES *bitmap_brush_desc, - const D2D1_BRUSH_PROPERTIES *brush_desc, struct d2d_brush **brush) +HRESULT d2d_bitmap_brush_create(ID2D1Factory *factory, ID2D1Bitmap *bitmap, + const D2D1_BITMAP_BRUSH_PROPERTIES1 *bitmap_brush_desc, const D2D1_BRUSH_PROPERTIES *brush_desc, + struct d2d_brush **brush) { if (!(*brush = heap_alloc_zero(sizeof(**brush)))) return E_OUTOFMEMORY; diff --git a/dlls/d2d1/d2d1_private.h b/dlls/d2d1/d2d1_private.h index c8515eaa12..d7989f93a2 100644 --- a/dlls/d2d1/d2d1_private.h +++ b/dlls/d2d1/d2d1_private.h @@ -295,7 +295,7 @@ HRESULT d2d_radial_gradient_brush_create(ID2D1Factory *factory, const D2D1_RADIAL_GRADIENT_BRUSH_PROPERTIES *gradient_desc, const D2D1_BRUSH_PROPERTIES *brush_desc, ID2D1GradientStopCollection *gradient, struct d2d_brush **brush) DECLSPEC_HIDDEN; HRESULT d2d_bitmap_brush_create(ID2D1Factory *factory, ID2D1Bitmap *bitmap, - const D2D1_BITMAP_BRUSH_PROPERTIES *bitmap_brush_desc, const D2D1_BRUSH_PROPERTIES *brush_desc, + const D2D1_BITMAP_BRUSH_PROPERTIES1 *bitmap_brush_desc, const D2D1_BRUSH_PROPERTIES *brush_desc, struct d2d_brush **brush) DECLSPEC_HIDDEN; void d2d_brush_bind_resources(struct d2d_brush *brush, ID3D10Device *device, unsigned int brush_idx) DECLSPEC_HIDDEN; HRESULT d2d_brush_get_ps_cb(struct d2d_brush *brush, struct d2d_brush *opacity_brush, BOOL outline, diff --git a/dlls/d2d1/device.c b/dlls/d2d1/device.c index 041cb33c90..d779fb0a97 100644 --- a/dlls/d2d1/device.c +++ b/dlls/d2d1/device.c @@ -401,14 +401,15 @@ static HRESULT STDMETHODCALLTYPE d2d_device_context_CreateBitmapBrush(ID2D1Devic ID2D1Bitmap *bitmap, const D2D1_BITMAP_BRUSH_PROPERTIES *bitmap_brush_desc, const D2D1_BRUSH_PROPERTIES *brush_desc, ID2D1BitmapBrush **brush) { - struct d2d_device_context *render_target = impl_from_ID2D1DeviceContext(iface); + struct d2d_device_context *context = impl_from_ID2D1DeviceContext(iface); struct d2d_brush *object; HRESULT hr;
TRACE("iface %p, bitmap %p, bitmap_brush_desc %p, brush_desc %p, brush %p.\n", iface, bitmap, bitmap_brush_desc, brush_desc, brush);
- if (SUCCEEDED(hr = d2d_bitmap_brush_create(render_target->factory, bitmap, bitmap_brush_desc, brush_desc, &object))) + if (SUCCEEDED(hr = d2d_bitmap_brush_create(context->factory, bitmap, (const D2D1_BITMAP_BRUSH_PROPERTIES1 *)bitmap_brush_desc, + brush_desc, &object))) *brush = (ID2D1BitmapBrush *)&object->ID2D1Brush_iface;
return hr; @@ -1863,12 +1864,19 @@ static HRESULT STDMETHODCALLTYPE d2d_device_context_CreateImageBrush(ID2D1Device
static HRESULT STDMETHODCALLTYPE d2d_device_context_ID2D1DeviceContext_CreateBitmapBrush(ID2D1DeviceContext *iface, ID2D1Bitmap *bitmap, const D2D1_BITMAP_BRUSH_PROPERTIES1 *bitmap_brush_desc, - const D2D1_BRUSH_PROPERTIES *brush_desc, ID2D1BitmapBrush1 **bitmap_brush) + const D2D1_BRUSH_PROPERTIES *brush_desc, ID2D1BitmapBrush1 **brush) { - FIXME("iface %p, bitmap %p, bitmap_brush_desc %p, brush_desc %p, bitmap_brush %p stub!\n", iface, bitmap, - bitmap_brush_desc, brush_desc, bitmap_brush); + struct d2d_device_context *context = impl_from_ID2D1DeviceContext(iface); + struct d2d_brush *object; + HRESULT hr;
- return E_NOTIMPL; + TRACE("iface %p, bitmap %p, bitmap_brush_desc %p, brush_desc %p, brush %p.\n", iface, bitmap, bitmap_brush_desc, + brush_desc, brush); + + if (SUCCEEDED(hr = d2d_bitmap_brush_create(context->factory, bitmap, bitmap_brush_desc, brush_desc, &object))) + *brush = (ID2D1BitmapBrush1 *)&object->ID2D1Brush_iface; + + return hr; }
static HRESULT STDMETHODCALLTYPE d2d_device_context_CreateCommandList(ID2D1DeviceContext *iface,
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- include/d2d1_1.idl | 104 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 104 insertions(+)
diff --git a/include/d2d1_1.idl b/include/d2d1_1.idl index 284bd60ece..c6cd9c7398 100644 --- a/include/d2d1_1.idl +++ b/include/d2d1_1.idl @@ -164,6 +164,30 @@ typedef enum D2D1_LAYER_OPTIONS1 typedef struct D2D1_PROPERTY_BINDING D2D1_PROPERTY_BINDING; typedef D2D_MATRIX_4X4_F D2D1_MATRIX_4X4_F;
+typedef enum D2D1_PROPERTY_TYPE +{ + D2D1_PROPERTY_TYPE_UNKNOWN = 0x0, + D2D1_PROPERTY_TYPE_STRING = 0x1, + D2D1_PROPERTY_TYPE_BOOL = 0x2, + D2D1_PROPERTY_TYPE_UINT32 = 0x3, + D2D1_PROPERTY_TYPE_INT32 = 0x4, + D2D1_PROPERTY_TYPE_FLOAT = 0x5, + D2D1_PROPERTY_TYPE_VECTOR2 = 0x6, + D2D1_PROPERTY_TYPE_VECTOR3 = 0x7, + D2D1_PROPERTY_TYPE_VECTOR4 = 0x8, + D2D1_PROPERTY_TYPE_BLOB = 0x9, + D2D1_PROPERTY_TYPE_IUNKNOWN = 0xa, + D2D1_PROPERTY_TYPE_ENUM = 0xb, + D2D1_PROPERTY_TYPE_ARRAY = 0xc, + D2D1_PROPERTY_TYPE_CLSID = 0xd, + D2D1_PROPERTY_TYPE_MATRIX_3X2 = 0xe, + D2D1_PROPERTY_TYPE_MATRIX_4X3 = 0xf, + D2D1_PROPERTY_TYPE_MATRIX_4X4 = 0x10, + D2D1_PROPERTY_TYPE_MATRIX_5X4 = 0x11, + D2D1_PROPERTY_TYPE_COLOR_CONTEXT = 0x12, + D2D1_PROPERTY_TYPE_FORCE_DWORD = 0xffffffff, +} D2D1_PROPERTY_TYPE; + typedef struct D2D1_STROKE_STYLE_PROPERTIES1 { D2D1_CAP_STYLE startCap; @@ -250,6 +274,86 @@ typedef struct D2D1_EFFECT_INPUT_DESCRIPTION
typedef HRESULT (__stdcall *PD2D1_EFFECT_FACTORY)(IUnknown **effect);
+[ + object, + uuid(483473d7-cd46-4f9d-9d3a-3112aa80159d), + local, +] +interface ID2D1Properties : IUnknown +{ + UINT32 GetPropertyCount(); + HRESULT GetPropertyName( + [in] UINT32 index, + [out] WCHAR *name, + [in] UINT32 name_count + ); + UINT32 GetPropertyNameLength( + [in] UINT32 index + ); + D2D1_PROPERTY_TYPE GetType( + [in] UINT32 index + ); + UINT32 GetPropertyIndex( + [in] const WCHAR *name + ); + HRESULT SetValueByName( + [in] const WCHAR *name, + [in] D2D1_PROPERTY_TYPE type, + [in] const BYTE *value, + [in] UINT32 value_size + ); + HRESULT SetValue( + [in] UINT32 index, + [in] D2D1_PROPERTY_TYPE type, + [in] const BYTE *value, + [in] UINT32 value_size + ); + HRESULT GetValueByName( + [in] const WCHAR *name, + [in] D2D1_PROPERTY_TYPE type, + [out] BYTE *value, + [in] UINT32 value_size + ); + HRESULT GetValue( + [in] UINT32 index, + [in] D2D1_PROPERTY_TYPE type, + [out] BYTE *value, + [in] UINT32 value_size + ); + UINT32 GetValueSize( + [in] UINT32 index + ); + HRESULT GetSubProperties( + [in] UINT32 index, + [out] ID2D1Properties **props + ); +} + +[ + object, + uuid(28211a43-7d89-476f-8181-2d6159b220ad), + local, +] +interface ID2D1Effect : ID2D1Properties +{ + void SetInput( + [in] UINT32 index, + [in] ID2D1Image *input, + [in] BOOL invalidate + ); + HRESULT SetInputCount( + [in] UINT32 count + ); + void GetInput( + [in] UINT32 index, + [out] ID2D1Image **input + ); + UINT32 GetInputCount(); + void GetOutput( + [out] ID2D1Image **output + ); +} + [ object, uuid(689f1f85-c72e-4e33-8f19-85754efd5ace),
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com