[PATCH 1/4] d2d1: Add a properties list for builtin effects.

Ziqing Hui zhui at codeweavers.com
Tue Jul 27 06:10:45 CDT 2021


Signed-off-by: Ziqing Hui <zhui at codeweavers.com>
---
 dlls/d2d1/d2d1_private.h |  2 +-
 dlls/d2d1/device.c       |  2 +-
 dlls/d2d1/effect.c       | 45 +++++++++++++++++++++++++++++++++++++++-
 3 files changed, 46 insertions(+), 3 deletions(-)

diff --git a/dlls/d2d1/d2d1_private.h b/dlls/d2d1/d2d1_private.h
index ce99e7c3432..1cca943122e 100644
--- a/dlls/d2d1/d2d1_private.h
+++ b/dlls/d2d1/d2d1_private.h
@@ -574,7 +574,7 @@ struct d2d_effect
     ID2D1Factory *factory;
 };
 
-void d2d_effect_init(struct d2d_effect *effect, ID2D1Factory *factory) DECLSPEC_HIDDEN;
+void d2d_effect_init(struct d2d_effect *effect, ID2D1Factory *factory, const CLSID *effect_id) DECLSPEC_HIDDEN;
 
 static inline BOOL d2d_array_reserve(void **elements, size_t *capacity, size_t count, size_t size)
 {
diff --git a/dlls/d2d1/device.c b/dlls/d2d1/device.c
index 0647bc57fc3..cc86c6332f9 100644
--- a/dlls/d2d1/device.c
+++ b/dlls/d2d1/device.c
@@ -1893,7 +1893,7 @@ static HRESULT STDMETHODCALLTYPE d2d_device_context_CreateEffect(ID2D1DeviceCont
     if (!(object = heap_alloc_zero(sizeof(*object))))
         return E_OUTOFMEMORY;
 
-    d2d_effect_init(object, context->factory);
+    d2d_effect_init(object, context->factory, effect_id);
 
     TRACE("Created effect %p.\n", object);
     *effect = &object->ID2D1Effect_iface;
diff --git a/dlls/d2d1/effect.c b/dlls/d2d1/effect.c
index 40dd2187953..c9d8085f81a 100644
--- a/dlls/d2d1/effect.c
+++ b/dlls/d2d1/effect.c
@@ -20,6 +20,31 @@
 
 WINE_DEFAULT_DEBUG_CHANNEL(d2d);
 
+struct d2d_effect_info
+{
+    const CLSID *clsid;
+    BOOL cached;
+    D2D1_BUFFER_PRECISION precision;
+    UINT32 min_inputs;
+    UINT32 max_inputs;
+};
+
+static const struct d2d_effect_info builtin_effects[] =
+{
+    {
+        &CLSID_D2D12DAffineTransform,
+        FALSE, D2D1_BUFFER_PRECISION_UNKNOWN, 1, 1
+    },
+    {
+        &CLSID_D2D13DPerspectiveTransform,
+        FALSE, D2D1_BUFFER_PRECISION_UNKNOWN, 1, 1
+    },
+    {
+        &CLSID_D2D1Composite,
+        FALSE, D2D1_BUFFER_PRECISION_UNKNOWN, 1, 0xffffffff
+    }
+};
+
 static inline struct d2d_effect *impl_from_ID2D1Effect(ID2D1Effect *iface)
 {
     return CONTAINING_RECORD(iface, struct d2d_effect, ID2D1Effect_iface);
@@ -269,10 +294,28 @@ static const ID2D1ImageVtbl d2d_effect_image_vtbl =
     d2d_effect_image_GetFactory,
 };
 
-void d2d_effect_init(struct d2d_effect *effect, ID2D1Factory *factory)
+static void d2d_effect_init_standard_properties(struct d2d_effect *effect, const struct d2d_effect_info *info)
 {
+   /* TODO */
+}
+
+void d2d_effect_init(struct d2d_effect *effect, ID2D1Factory *factory, const CLSID *effect_id)
+{
+    unsigned int i;
+
     effect->ID2D1Effect_iface.lpVtbl = &d2d_effect_vtbl;
     effect->ID2D1Image_iface.lpVtbl = &d2d_effect_image_vtbl;
     effect->refcount = 1;
     ID2D1Factory_AddRef(effect->factory = factory);
+
+    for (i = 0; i < ARRAY_SIZE(builtin_effects); ++i)
+    {
+        if (IsEqualGUID(effect_id, builtin_effects[i].clsid))
+        {
+            d2d_effect_init_standard_properties(effect, builtin_effects + i);
+            return;
+        }
+    }
+
+    WARN("Unsupported effect clsid %s.\n", debugstr_guid(effect_id));
 }
-- 
2.25.1




More information about the wine-devel mailing list