[PATCH 4/4] d2d1: Implement d2d_effect_GetValue().
Ziqing Hui
zhui at codeweavers.com
Tue Jul 27 06:10:48 CDT 2021
Signed-off-by: Ziqing Hui <zhui at codeweavers.com>
---
dlls/d2d1/effect.c | 28 +++++++++++++++++++++++++---
dlls/d2d1/tests/d2d1.c | 27 +++++++++++----------------
2 files changed, 36 insertions(+), 19 deletions(-)
diff --git a/dlls/d2d1/effect.c b/dlls/d2d1/effect.c
index 2d70ec84f6a..02e81b86973 100644
--- a/dlls/d2d1/effect.c
+++ b/dlls/d2d1/effect.c
@@ -169,10 +169,32 @@ static HRESULT STDMETHODCALLTYPE d2d_effect_GetValueByName(ID2D1Effect *iface, c
static HRESULT STDMETHODCALLTYPE d2d_effect_GetValue(ID2D1Effect *iface, UINT32 index, D2D1_PROPERTY_TYPE type,
BYTE *value, UINT32 value_size)
{
- FIXME("iface %p, index %u, type %#x, value %p, value_size %u stub!\n", iface, index, type,
- value, value_size);
+ struct d2d_effect *effect = impl_from_ID2D1Effect(iface);
+ struct d2d_property *property;
- return E_NOTIMPL;
+ TRACE("iface %p, index %u, type %#x, value %p, value_size %u.\n", iface, index, type, value, value_size);
+
+ if (index < D2D1_PROPERTY_CLSID)
+ {
+ FIXME("Custom properties are not supported.\n");
+ return D2DERR_INVALID_PROPERTY;
+ }
+
+ if (index > D2D1_PROPERTY_MAX_INPUTS)
+ return D2DERR_INVALID_PROPERTY;
+
+ property = effect->standard_properties + index - D2D1_PROPERTY_CLSID;
+
+ if ((type > D2D1_PROPERTY_TYPE_COLOR_CONTEXT)
+ || (type != D2D1_PROPERTY_TYPE_UNKNOWN && type != property->type)
+ || (type != D2D1_PROPERTY_TYPE_STRING && value_size != property->value_size))
+ return E_INVALIDARG;
+ if (type == D2D1_PROPERTY_TYPE_STRING && value_size < property->value_size)
+ return D2DERR_INSUFFICIENT_BUFFER;
+
+ memcpy(value, property->value, property->value_size);
+
+ return S_OK;
}
static UINT32 STDMETHODCALLTYPE d2d_effect_GetValueSize(ID2D1Effect *iface, UINT32 index)
diff --git a/dlls/d2d1/tests/d2d1.c b/dlls/d2d1/tests/d2d1.c
index 629bbd65523..dde41912068 100644
--- a/dlls/d2d1/tests/d2d1.c
+++ b/dlls/d2d1/tests/d2d1.c
@@ -9734,8 +9734,6 @@ static void test_effect(BOOL d3d11)
ID2D1Image_Release(image_b);
ID2D1Image_Release(image_a);
- todo_wine
- {
hr = ID2D1Effect_GetValue(effect, 0xdeadbeef, D2D1_PROPERTY_TYPE_CLSID, (BYTE *)&clsid, sizeof(clsid));
ok(hr == D2DERR_INVALID_PROPERTY, "Got unexpected hr %#x.\n", hr);
@@ -9746,6 +9744,8 @@ static void test_effect(BOOL d3d11)
hr = ID2D1Effect_GetValue(effect, D2D1_PROPERTY_CLSID, D2D1_PROPERTY_TYPE_CLSID, buffer, sizeof(clsid));
ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
+ todo_wine
+ {
hr = ID2D1Effect_GetValue(effect, D2D1_PROPERTY_DISPLAYNAME, D2D1_PROPERTY_TYPE_STRING, buffer, sizeof(buffer));
ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
str_size = (wcslen((WCHAR *)buffer) + 1) * sizeof(WCHAR);
@@ -9753,6 +9753,7 @@ static void test_effect(BOOL d3d11)
ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
hr = ID2D1Effect_GetValue(effect, D2D1_PROPERTY_DISPLAYNAME, D2D1_PROPERTY_TYPE_STRING, buffer, str_size - 1);
ok(hr == D2DERR_INSUFFICIENT_BUFFER, "Got unexpected hr %#x.\n", hr);
+ }
hr = ID2D1Effect_GetValue(effect, D2D1_PROPERTY_CLSID, 0xdeadbeef, (BYTE *)&clsid, sizeof(clsid));
ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr);
@@ -9766,36 +9767,30 @@ static void test_effect(BOOL d3d11)
hr = ID2D1Effect_GetValue(effect, D2D1_PROPERTY_CLSID,
D2D1_PROPERTY_TYPE_CLSID, (BYTE *)&clsid, sizeof(clsid));
ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
- if (hr == S_OK)
- ok(IsEqualGUID(&clsid, test->clsid), "Got unexpected clsid %s, expected %s.\n",
- debugstr_guid(&clsid), debugstr_guid(test->clsid));
+ ok(IsEqualGUID(&clsid, test->clsid), "Got unexpected clsid %s, expected %s.\n",
+ debugstr_guid(&clsid), debugstr_guid(test->clsid));
hr = ID2D1Effect_GetValue(effect, D2D1_PROPERTY_CACHED,
D2D1_PROPERTY_TYPE_BOOL, (BYTE *)&cached, sizeof(cached));
ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
- if (hr == S_OK)
- ok(cached == FALSE, "Got unexpected cached %d.\n", cached);
+ ok(cached == FALSE, "Got unexpected cached %d.\n", cached);
hr = ID2D1Effect_GetValue(effect, D2D1_PROPERTY_PRECISION,
D2D1_PROPERTY_TYPE_ENUM, (BYTE *)&precision, sizeof(precision));
ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
- if (hr == S_OK)
- ok(precision == D2D1_BUFFER_PRECISION_UNKNOWN, "Got unexpected precision %u.\n", precision);
+ ok(precision == D2D1_BUFFER_PRECISION_UNKNOWN, "Got unexpected precision %u.\n", precision);
hr = ID2D1Effect_GetValue(effect, D2D1_PROPERTY_MIN_INPUTS,
D2D1_PROPERTY_TYPE_UINT32, (BYTE *)&min_inputs, sizeof(min_inputs));
ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
- if (hr == S_OK)
- ok(min_inputs == test->min_inputs, "Got unexpected min inputs %u, expected %u.\n",
- min_inputs, test->min_inputs);
+ ok(min_inputs == test->min_inputs, "Got unexpected min inputs %u, expected %u.\n",
+ min_inputs, test->min_inputs);
hr = ID2D1Effect_GetValue(effect, D2D1_PROPERTY_MAX_INPUTS,
D2D1_PROPERTY_TYPE_UINT32, (BYTE *)&max_inputs, sizeof(max_inputs));
ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
- if (hr == S_OK)
- ok(max_inputs == test->max_inputs, "Got unexpected max inputs %u, expected %u.\n",
- max_inputs, test->max_inputs);
- }
+ ok(max_inputs == test->max_inputs, "Got unexpected max inputs %u, expected %u.\n",
+ max_inputs, test->max_inputs);
ID2D1Effect_Release(effect);
winetest_pop_context();
--
2.25.1
More information about the wine-devel
mailing list