Updated d2d1-ID2D1Factory1 patchset

This commit is contained in:
Alistair Leslie-Hughes 2019-12-03 15:23:04 +11:00
parent 70aaee4bf8
commit 7b177b15fa
2 changed files with 76 additions and 38 deletions

View File

@ -1,49 +1,52 @@
From 30d0aa2712dbdfe8f532118f9829c7999c0326a7 Mon Sep 17 00:00:00 2001
From 7be7006fb497490d61c283f419d73c13ef532ccf Mon Sep 17 00:00:00 2001
From: Lucian Poston <lucian.poston@gmail.com>
Date: Thu, 3 May 2018 00:38:06 -0700
Subject: [PATCH] d2d1: Use ID2D1Factory1 in d2d_geometry
Subject: [PATCH] d2d1: Use ID2D1Factory2 in d2d_geometry
https://bugs.winehq.org/show_bug.cgi?id=44052
Signed-off-by: Lucian Poston <lucian.poston@gmail.com>
---
dlls/d2d1/d2d1_private.h | 8 ++++----
dlls/d2d1/factory.c | 6 +++---
dlls/d2d1/geometry.c | 30 +++++++++++++++++++++---------
3 files changed, 28 insertions(+), 16 deletions(-)
dlls/d2d1/d2d1_private.h | 10 +++++-----
dlls/d2d1/factory.c | 8 ++++----
dlls/d2d1/geometry.c | 38 +++++++++++++++++++++++++++-----------
3 files changed, 36 insertions(+), 20 deletions(-)
diff --git a/dlls/d2d1/d2d1_private.h b/dlls/d2d1/d2d1_private.h
index 70b841df8cb..85c56524de4 100644
index 2e42d6d550..1cacb6c1a9 100644
--- a/dlls/d2d1/d2d1_private.h
+++ b/dlls/d2d1/d2d1_private.h
@@ -424,7 +424,7 @@ struct d2d_geometry
@@ -426,7 +426,7 @@ struct d2d_geometry
ID2D1Geometry ID2D1Geometry_iface;
LONG refcount;
- ID2D1Factory *factory;
+ ID2D1Factory1 *factory;
+ ID2D1Factory2 *factory;
D2D_MATRIX_3X2_F transform;
@@ -494,10 +494,10 @@ struct d2d_geometry
@@ -496,12 +496,12 @@ struct d2d_geometry
} u;
};
-void d2d_path_geometry_init(struct d2d_geometry *geometry, ID2D1Factory *factory) DECLSPEC_HIDDEN;
+void d2d_path_geometry_init(struct d2d_geometry *geometry, ID2D1Factory1 *factory) DECLSPEC_HIDDEN;
+void d2d_path_geometry_init(struct d2d_geometry *geometry, ID2D1Factory2 *factory) DECLSPEC_HIDDEN;
HRESULT d2d_rectangle_geometry_init(struct d2d_geometry *geometry,
- ID2D1Factory *factory, const D2D1_RECT_F *rect) DECLSPEC_HIDDEN;
-void d2d_transformed_geometry_init(struct d2d_geometry *geometry, ID2D1Factory *factory,
+ ID2D1Factory1 *factory, const D2D1_RECT_F *rect) DECLSPEC_HIDDEN;
+void d2d_transformed_geometry_init(struct d2d_geometry *geometry, ID2D1Factory1 *factory,
+ ID2D1Factory2 *factory, const D2D1_RECT_F *rect) DECLSPEC_HIDDEN;
+void d2d_transformed_geometry_init(struct d2d_geometry *geometry, ID2D1Factory2 *factory,
ID2D1Geometry *src_geometry, const D2D_MATRIX_3X2_F *transform) DECLSPEC_HIDDEN;
HRESULT d2d_geometry_group_init(struct d2d_geometry *geometry, ID2D1Factory *factory,
-HRESULT d2d_geometry_group_init(struct d2d_geometry *geometry, ID2D1Factory *factory,
+HRESULT d2d_geometry_group_init(struct d2d_geometry *geometry, ID2D1Factory2 *factory,
D2D1_FILL_MODE fill_mode, ID2D1Geometry **src_geometries, unsigned int geometry_count) DECLSPEC_HIDDEN;
struct d2d_geometry *unsafe_impl_from_ID2D1Geometry(ID2D1Geometry *iface) DECLSPEC_HIDDEN;
diff --git a/dlls/d2d1/factory.c b/dlls/d2d1/factory.c
index c2a0405abdd..33c2d173596 100644
index 48a2efb96b..a1bc6dd296 100644
--- a/dlls/d2d1/factory.c
+++ b/dlls/d2d1/factory.c
@@ -141,7 +141,7 @@ static HRESULT STDMETHODCALLTYPE d2d_factory_CreateRectangleGeometry(ID2D1Factor
@@ -138,7 +138,7 @@ static HRESULT STDMETHODCALLTYPE d2d_factory_CreateRectangleGeometry(ID2D1Factor
if (!(object = heap_alloc_zero(sizeof(*object))))
return E_OUTOFMEMORY;
@ -52,7 +55,16 @@ index c2a0405abdd..33c2d173596 100644
{
WARN("Failed to initialize rectangle geometry, hr %#x.\n", hr);
heap_free(object);
@@ -207,7 +207,7 @@ static HRESULT STDMETHODCALLTYPE d2d_factory_CreateTransformedGeometry(ID2D1Fact
@@ -179,7 +179,7 @@ static HRESULT STDMETHODCALLTYPE d2d_factory_CreateGeometryGroup(ID2D1Factory2 *
if (!(object = heap_alloc_zero(sizeof(*object))))
return E_OUTOFMEMORY;
- if (FAILED(hr = d2d_geometry_group_init(object, (ID2D1Factory *)iface, fill_mode, geometries, geometry_count)))
+ if (FAILED(hr = d2d_geometry_group_init(object, iface, fill_mode, geometries, geometry_count)))
{
WARN("Failed to initialize geometry group, hr %#x.\n", hr);
heap_free(object);
@@ -204,7 +204,7 @@ static HRESULT STDMETHODCALLTYPE d2d_factory_CreateTransformedGeometry(ID2D1Fact
if (!(object = heap_alloc_zero(sizeof(*object))))
return E_OUTOFMEMORY;
@ -61,7 +73,7 @@ index c2a0405abdd..33c2d173596 100644
TRACE("Created transformed geometry %p.\n", object);
*transformed_geometry = (ID2D1TransformedGeometry *)&object->ID2D1Geometry_iface;
@@ -224,7 +224,7 @@ static HRESULT STDMETHODCALLTYPE d2d_factory_CreatePathGeometry(ID2D1Factory2 *i
@@ -221,7 +221,7 @@ static HRESULT STDMETHODCALLTYPE d2d_factory_CreatePathGeometry(ID2D1Factory2 *i
if (!(object = heap_alloc_zero(sizeof(*object))))
return E_OUTOFMEMORY;
@ -71,29 +83,29 @@ index c2a0405abdd..33c2d173596 100644
TRACE("Created path geometry %p.\n", object);
*geometry = (ID2D1PathGeometry *)&object->ID2D1Geometry_iface;
diff --git a/dlls/d2d1/geometry.c b/dlls/d2d1/geometry.c
index 250ff0c5535..7b67e247f7a 100644
index 23049d015e..79850f1c20 100644
--- a/dlls/d2d1/geometry.c
+++ b/dlls/d2d1/geometry.c
@@ -2343,15 +2343,15 @@ static void d2d_geometry_cleanup(struct d2d_geometry *geometry)
@@ -2338,15 +2338,15 @@ static void d2d_geometry_cleanup(struct d2d_geometry *geometry)
heap_free(geometry->fill.bezier_vertices);
heap_free(geometry->fill.faces);
heap_free(geometry->fill.vertices);
- ID2D1Factory_Release(geometry->factory);
+ ID2D1Factory1_Release(geometry->factory);
+ ID2D1Factory2_Release(geometry->factory);
}
-static void d2d_geometry_init(struct d2d_geometry *geometry, ID2D1Factory *factory,
+static void d2d_geometry_init(struct d2d_geometry *geometry, ID2D1Factory1 *factory,
+static void d2d_geometry_init(struct d2d_geometry *geometry, ID2D1Factory2 *factory,
const D2D1_MATRIX_3X2_F *transform, const struct ID2D1GeometryVtbl *vtbl)
{
geometry->ID2D1Geometry_iface.lpVtbl = vtbl;
geometry->refcount = 1;
- ID2D1Factory_AddRef(geometry->factory = factory);
+ ID2D1Factory1_AddRef(geometry->factory = factory);
+ ID2D1Factory2_AddRef(geometry->factory = factory);
geometry->transform = *transform;
}
@@ -3040,10 +3040,14 @@ static ULONG STDMETHODCALLTYPE d2d_path_geometry_Release(ID2D1PathGeometry *ifac
@@ -3035,10 +3035,14 @@ static ULONG STDMETHODCALLTYPE d2d_path_geometry_Release(ID2D1PathGeometry *ifac
static void STDMETHODCALLTYPE d2d_path_geometry_GetFactory(ID2D1PathGeometry *iface, ID2D1Factory **factory)
{
struct d2d_geometry *geometry = impl_from_ID2D1PathGeometry(iface);
@ -102,23 +114,23 @@ index 250ff0c5535..7b67e247f7a 100644
TRACE("iface %p, factory %p.\n", iface, factory);
- ID2D1Factory_AddRef(*factory = geometry->factory);
+ if (FAILED(hr = ID2D1Factory1_QueryInterface(geometry->factory, &IID_ID2D1Factory, (void **)factory)))
+ if (FAILED(hr = ID2D1Factory2_QueryInterface(geometry->factory, &IID_ID2D1Factory, (void **)factory)))
+ {
+ WARN("Unable to query ID2D1Factory interface %#x", hr);
+ }
}
static HRESULT STDMETHODCALLTYPE d2d_path_geometry_GetBounds(ID2D1PathGeometry *iface,
@@ -3491,7 +3495,7 @@ static const struct ID2D1PathGeometryVtbl d2d_path_geometry_vtbl =
@@ -3486,7 +3490,7 @@ static const struct ID2D1PathGeometryVtbl d2d_path_geometry_vtbl =
d2d_path_geometry_GetFigureCount,
};
-void d2d_path_geometry_init(struct d2d_geometry *geometry, ID2D1Factory *factory)
+void d2d_path_geometry_init(struct d2d_geometry *geometry, ID2D1Factory1 *factory)
+void d2d_path_geometry_init(struct d2d_geometry *geometry, ID2D1Factory2 *factory)
{
d2d_geometry_init(geometry, factory, &identity, (ID2D1GeometryVtbl *)&d2d_path_geometry_vtbl);
geometry->u.path.ID2D1GeometrySink_iface.lpVtbl = &d2d_geometry_sink_vtbl;
@@ -3556,10 +3560,14 @@ static ULONG STDMETHODCALLTYPE d2d_rectangle_geometry_Release(ID2D1RectangleGeom
@@ -3551,10 +3555,14 @@ static ULONG STDMETHODCALLTYPE d2d_rectangle_geometry_Release(ID2D1RectangleGeom
static void STDMETHODCALLTYPE d2d_rectangle_geometry_GetFactory(ID2D1RectangleGeometry *iface, ID2D1Factory **factory)
{
struct d2d_geometry *geometry = impl_from_ID2D1RectangleGeometry(iface);
@ -127,23 +139,23 @@ index 250ff0c5535..7b67e247f7a 100644
TRACE("iface %p, factory %p.\n", iface, factory);
- ID2D1Factory_AddRef(*factory = geometry->factory);
+ if (FAILED(hr = ID2D1Factory1_QueryInterface(geometry->factory, &IID_ID2D1Factory, (void **)factory)))
+ if (FAILED(hr = ID2D1Factory2_QueryInterface(geometry->factory, &IID_ID2D1Factory, (void **)factory)))
+ {
+ WARN("Unable to query ID2D1Factory interface %#x", hr);
+ }
}
static HRESULT STDMETHODCALLTYPE d2d_rectangle_geometry_GetBounds(ID2D1RectangleGeometry *iface,
@@ -3779,7 +3787,7 @@ static const struct ID2D1RectangleGeometryVtbl d2d_rectangle_geometry_vtbl =
@@ -3774,7 +3782,7 @@ static const struct ID2D1RectangleGeometryVtbl d2d_rectangle_geometry_vtbl =
d2d_rectangle_geometry_GetRect,
};
-HRESULT d2d_rectangle_geometry_init(struct d2d_geometry *geometry, ID2D1Factory *factory, const D2D1_RECT_F *rect)
+HRESULT d2d_rectangle_geometry_init(struct d2d_geometry *geometry, ID2D1Factory1 *factory, const D2D1_RECT_F *rect)
+HRESULT d2d_rectangle_geometry_init(struct d2d_geometry *geometry, ID2D1Factory2 *factory, const D2D1_RECT_F *rect)
{
struct d2d_face *f;
D2D1_POINT_2F *v;
@@ -3900,10 +3908,14 @@ static void STDMETHODCALLTYPE d2d_transformed_geometry_GetFactory(ID2D1Transform
@@ -3895,10 +3903,14 @@ static void STDMETHODCALLTYPE d2d_transformed_geometry_GetFactory(ID2D1Transform
ID2D1Factory **factory)
{
struct d2d_geometry *geometry = impl_from_ID2D1TransformedGeometry(iface);
@ -152,22 +164,48 @@ index 250ff0c5535..7b67e247f7a 100644
TRACE("iface %p, factory %p.\n", iface, factory);
- ID2D1Factory_AddRef(*factory = geometry->factory);
+ if (FAILED(hr = ID2D1Factory1_QueryInterface(geometry->factory, &IID_ID2D1Factory, (void **)factory)))
+ if (FAILED(hr = ID2D1Factory2_QueryInterface(geometry->factory, &IID_ID2D1Factory, (void **)factory)))
+ {
+ WARN("Unable to query ID2D1Factory interface %#x", hr);
+ }
}
static HRESULT STDMETHODCALLTYPE d2d_transformed_geometry_GetBounds(ID2D1TransformedGeometry *iface,
@@ -4096,7 +4108,7 @@ static const struct ID2D1TransformedGeometryVtbl d2d_transformed_geometry_vtbl =
@@ -4091,7 +4103,7 @@ static const struct ID2D1TransformedGeometryVtbl d2d_transformed_geometry_vtbl =
d2d_transformed_geometry_GetTransform,
};
-void d2d_transformed_geometry_init(struct d2d_geometry *geometry, ID2D1Factory *factory,
+void d2d_transformed_geometry_init(struct d2d_geometry *geometry, ID2D1Factory1 *factory,
+void d2d_transformed_geometry_init(struct d2d_geometry *geometry, ID2D1Factory2 *factory,
ID2D1Geometry *src_geometry, const D2D_MATRIX_3X2_F *transform)
{
struct d2d_geometry *src_impl;
@@ -4167,11 +4179,15 @@ static ULONG STDMETHODCALLTYPE d2d_geometry_group_Release(ID2D1GeometryGroup *if
static void STDMETHODCALLTYPE d2d_geometry_group_GetFactory(ID2D1GeometryGroup *iface,
ID2D1Factory **factory)
{
+ HRESULT hr;
struct d2d_geometry *geometry = impl_from_ID2D1GeometryGroup(iface);
TRACE("iface %p, factory %p.\n", iface, factory);
- ID2D1Factory_AddRef(*factory = geometry->factory);
+ if (FAILED(hr = ID2D1Factory2_QueryInterface(geometry->factory, &IID_ID2D1Factory, (void **)factory)))
+ {
+ WARN("Unable to query ID2D1Factory interface %#x", hr);
+ }
}
static HRESULT STDMETHODCALLTYPE d2d_geometry_group_GetBounds(ID2D1GeometryGroup *iface,
@@ -4347,7 +4363,7 @@ static const struct ID2D1GeometryGroupVtbl d2d_geometry_group_vtbl =
d2d_geometry_group_GetSourceGeometries,
};
-HRESULT d2d_geometry_group_init(struct d2d_geometry *geometry, ID2D1Factory *factory,
+HRESULT d2d_geometry_group_init(struct d2d_geometry *geometry, ID2D1Factory2 *factory,
D2D1_FILL_MODE fill_mode, ID2D1Geometry **geometries, unsigned int geometry_count)
{
unsigned int i;
--
2.20.1
2.17.1

View File

@ -2389,9 +2389,9 @@ fi
# | * dlls/d2d1/d2d1_private.h, dlls/d2d1/factory.c, dlls/d2d1/geometry.c
# |
if test "$enable_d2d1_ID2D1Factory1" -eq 1; then
patch_apply d2d1-ID2D1Factory1/0003-d2d1-Use-ID2D1Factory1-in-d2d_geometry.patch
patch_apply d2d1-ID2D1Factory1/0001-d2d1-Use-ID2D1Factory2-in-d2d_geometry.patch
(
printf '%s\n' '+ { "Lucian Poston", "d2d1: Use ID2D1Factory1 in d2d_geometry.", 1 },';
printf '%s\n' '+ { "Lucian Poston", "d2d1: Use ID2D1Factory2 in d2d_geometry.", 1 },';
) >> "$patchlist"
fi