Signed-off-by: Ziqing Hui zhui@codeweavers.com --- include/d2d1effects.idl | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-)
diff --git a/include/d2d1effects.idl b/include/d2d1effects.idl index ee1dbe94728..5dde46cbb6a 100644 --- a/include/d2d1effects.idl +++ b/include/d2d1effects.idl @@ -16,7 +16,8 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */
-cpp_quote("DEFINE_GUID(CLSID_D2D12DAffineTransform, 0x6aa97485,0x6354,0x4cfc,0x90,0x8c,0xe4,0xa7,0x4f,0x62,0xc9,0x6c);") +cpp_quote("DEFINE_GUID(CLSID_D2D12DAffineTransform, 0x6aa97485,0x6354,0x4cfc,0x90,0x8c,0xe4,0xa7,0x4f,0x62,0xc9,0x6c);") +cpp_quote("DEFINE_GUID(CLSID_D2D13DPerspectiveTransform, 0xc2844d0b,0x3d86,0x46e7,0x85,0xba,0x52,0x6c,0x92,0x40,0xf3,0xfb);")
typedef enum D2D1_BORDER_MODE { @@ -44,3 +45,26 @@ typedef enum D2D1_2DAFFINETRANSFORM_INTERPOLATION_MODE D2D1_2DAFFINETRANSFORM_INTERPOLATION_MODE_HIGH_QUALITY_CUBIC = 0x5, D2D1_2DAFFINETRANSFORM_INTERPOLATION_MODE_FORCE_DWORD = 0xffffffff } D2D1_2DAFFINETRANSFORM_INTERPOLATION_MODE; + +typedef enum D2D1_3DPERSPECTIVETRANSFORM_PROP +{ + D2D1_3DPERSPECTIVETRANSFORM_PROP_INTERPOLATION_MODE = 0x0, + D2D1_3DPERSPECTIVETRANSFORM_PROP_BORDER_MODE = 0x1, + D2D1_3DPERSPECTIVETRANSFORM_PROP_DEPTH = 0x2, + D2D1_3DPERSPECTIVETRANSFORM_PROP_PERSPECTIVE_ORIGIN = 0x3, + D2D1_3DPERSPECTIVETRANSFORM_PROP_LOCAL_OFFSET = 0x4, + D2D1_3DPERSPECTIVETRANSFORM_PROP_GLOBAL_OFFSET = 0x5, + D2D1_3DPERSPECTIVETRANSFORM_PROP_ROTATION_ORIGIN = 0x6, + D2D1_3DPERSPECTIVETRANSFORM_PROP_ROTATION = 0x7, + D2D1_3DPERSPECTIVETRANSFORM_PROP_FORCE_DWORD = 0xffffffff +} D2D1_3DPERSPECTIVETRANSFORM_PROP; + +typedef enum D2D1_3DPERSPECTIVETRANSFORM_INTERPOLATION_MODE +{ + D2D1_3DPERSPECTIVETRANSFORM_INTERPOLATION_MODE_NEAREST_NEIGHBOR = 0x0, + D2D1_3DPERSPECTIVETRANSFORM_INTERPOLATION_MODE_LINEAR = 0x1, + D2D1_3DPERSPECTIVETRANSFORM_INTERPOLATION_MODE_CUBIC = 0x2, + D2D1_3DPERSPECTIVETRANSFORM_INTERPOLATION_MODE_MULTI_SAMPLE_LINEAR = 0x3, + D2D1_3DPERSPECTIVETRANSFORM_INTERPOLATION_MODE_ANISOTROPIC = 0x4, + D2D1_3DPERSPECTIVETRANSFORM_INTERPOLATION_MODE_FORCE_DWORD = 0xffffffff +} D2D1_3DPERSPECTIVETRANSFORM_INTERPOLATION_MODE;
Signed-off-by: Ziqing Hui zhui@codeweavers.com --- include/d2d1effects.idl | 7 +++++++ 1 file changed, 7 insertions(+)
diff --git a/include/d2d1effects.idl b/include/d2d1effects.idl index 5dde46cbb6a..4154276345b 100644 --- a/include/d2d1effects.idl +++ b/include/d2d1effects.idl @@ -18,6 +18,7 @@
cpp_quote("DEFINE_GUID(CLSID_D2D12DAffineTransform, 0x6aa97485,0x6354,0x4cfc,0x90,0x8c,0xe4,0xa7,0x4f,0x62,0xc9,0x6c);") cpp_quote("DEFINE_GUID(CLSID_D2D13DPerspectiveTransform, 0xc2844d0b,0x3d86,0x46e7,0x85,0xba,0x52,0x6c,0x92,0x40,0xf3,0xfb);") +cpp_quote("DEFINE_GUID(CLSID_D2D1Composite, 0x48fc9f51,0xf6ac,0x48f1,0x8b,0x58,0x3b,0x28,0xac,0x46,0xf7,0x6d);")
typedef enum D2D1_BORDER_MODE { @@ -68,3 +69,9 @@ typedef enum D2D1_3DPERSPECTIVETRANSFORM_INTERPOLATION_MODE D2D1_3DPERSPECTIVETRANSFORM_INTERPOLATION_MODE_ANISOTROPIC = 0x4, D2D1_3DPERSPECTIVETRANSFORM_INTERPOLATION_MODE_FORCE_DWORD = 0xffffffff } D2D1_3DPERSPECTIVETRANSFORM_INTERPOLATION_MODE; + +typedef enum D2D1_COMPOSITE_PROP +{ + D2D1_COMPOSITE_PROP_MODE = 0x0, + D2D1_COMPOSITE_PROP_FORCE_DWORD = 0xffffffff +} D2D1_COMPOSITE_PROP;
Signed-off-by: Ziqing Hui zhui@codeweavers.com --- dlls/d2d1/tests/d2d1.c | 133 ++++++++++++++++++++++++++++++++++++++--- 1 file changed, 124 insertions(+), 9 deletions(-)
diff --git a/dlls/d2d1/tests/d2d1.c b/dlls/d2d1/tests/d2d1.c index 1ee4941da99..f9448f168ab 100644 --- a/dlls/d2d1/tests/d2d1.c +++ b/dlls/d2d1/tests/d2d1.c @@ -20,6 +20,7 @@ #include <limits.h> #include <math.h> #include <float.h> +#include <wchar.h> #include "d2d1_1.h" #include "d3d11.h" #include "wincrypt.h" @@ -9680,13 +9681,47 @@ static void test_mt_factory(BOOL d3d11)
static void test_effect(BOOL d3d11) { + unsigned int i, min_inputs, max_inputs; + D2D1_BUFFER_PRECISION precision; ID2D1Image *image_a, *image_b; struct d2d1_test_context ctx; ID2D1DeviceContext *context; ID2D1Factory1 *factory; ID2D1Effect *effect; + WCHAR buffer[1024]; + BOOL cached; + CLSID clsid; HRESULT hr;
+ const WCHAR *expected_author = L"Microsoft Corporation"; + const struct effect_test + { + const CLSID *clsid; + const WCHAR *name; + const WCHAR *category; + UINT32 min_inputs; + UINT32 max_inputs; + const WCHAR *description; + } + effect_tests[] = + { + /* 0: 2D Affine Transform */ + { + &CLSID_D2D12DAffineTransform, L"2D Affine Transform", L"Transform", 1, 1, + L"Applies a 2D affine transform to a bitmap.", + }, + /* 1: 3D Perspective Transform */ + { + &CLSID_D2D13DPerspectiveTransform, L"3D Perspective Transform", L"Transform", 1, 1, + L"Applies a 3D perspective transform to a bitmap." + }, + /* 2: Composite */ + { + &CLSID_D2D1Composite, L"Composite", L"Composite", 1, 0xffffffff, + L"Composites foreground and background images using the selected composition mode." + } + }; + if (!init_test_context(&ctx, d3d11)) return;
@@ -9699,17 +9734,97 @@ static void test_effect(BOOL d3d11)
hr = ID2D1RenderTarget_QueryInterface(ctx.rt, &IID_ID2D1DeviceContext, (void **)&context); ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); - hr = ID2D1DeviceContext_CreateEffect(context, &CLSID_D2D12DAffineTransform, &effect); - ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
- hr = ID2D1Effect_QueryInterface(effect, &IID_ID2D1Image, (void **)&image_a); - ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); - ID2D1Effect_GetOutput(effect, &image_b); - ok(image_b == image_a, "Got unexpected image_b %p, expected %p.\n", image_b, image_a); - ID2D1Image_Release(image_b); - ID2D1Image_Release(image_a); + for (i = 0; i < ARRAY_SIZE(effect_tests); ++i) + { + const struct effect_test *test = effect_tests + i; + + winetest_push_context("Test %u", i); + + hr = ID2D1DeviceContext_CreateEffect(context, test->clsid, &effect); + ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); + + hr = ID2D1Effect_QueryInterface(effect, &IID_ID2D1Image, (void **)&image_a); + ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); + ID2D1Effect_GetOutput(effect, &image_b); + ok(image_b == image_a, "Got unexpected image_b %p, expected %p.\n", image_b, image_a); + ID2D1Image_Release(image_b); + ID2D1Image_Release(image_a); + + if (PRIMARYLANGID(GetSystemDefaultLangID()) == LANG_ENGLISH) + { + todo_wine + { + 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)); + + hr = ID2D1Effect_GetValue(effect, D2D1_PROPERTY_DISPLAYNAME, + D2D1_PROPERTY_TYPE_STRING, (BYTE *)buffer, sizeof(buffer)); + ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); + if (hr == S_OK) + ok(!wcscmp(buffer, test->name), "Got unexpected name %s, expected %s.\n", + debugstr_w(buffer), debugstr_w(test->name)); + + hr = ID2D1Effect_GetValue(effect, D2D1_PROPERTY_AUTHOR, + D2D1_PROPERTY_TYPE_STRING, (BYTE *)buffer, sizeof(buffer)); + ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); + if (hr == S_OK) + ok(!wcscmp(buffer, expected_author), "Got unexpected author %s.\n", debugstr_w(buffer)); + + hr = ID2D1Effect_GetValue(effect, D2D1_PROPERTY_CATEGORY, + D2D1_PROPERTY_TYPE_STRING, (BYTE *)buffer, sizeof(buffer)); + ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); + if (hr == S_OK) + ok(!wcscmp(buffer, test->category), "Got unexpected category %s, expected %s.\n", + debugstr_w(buffer), debugstr_w(test->category)); + + hr = ID2D1Effect_GetValue(effect, D2D1_PROPERTY_DESCRIPTION, + D2D1_PROPERTY_TYPE_STRING, (BYTE *)buffer, sizeof(buffer)); + ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); + if (hr == S_OK) + ok(!wcscmp(buffer, test->description), "Got unexpected description %s, expected %s.\n", + debugstr_w(buffer), debugstr_w(test->description)); + + 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); + + 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); + + 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); + + 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); + } + } + else + { + skip("Non-English locale.\n"); + } + + ID2D1Effect_Release(effect); + winetest_pop_context(); + }
- ID2D1Effect_Release(effect); ID2D1DeviceContext_Release(context); ID2D1Factory1_Release(factory); release_test_context(&ctx);
Hi,
Il 21/07/21 12:02, Ziqing Hui ha scritto:
- const WCHAR *expected_author = L"Microsoft Corporation";
- const struct effect_test
- {
const CLSID *clsid;
const WCHAR *name;
const WCHAR *category;
UINT32 min_inputs;
UINT32 max_inputs;
const WCHAR *description;
- }
- effect_tests[] =
- {
/* 0: 2D Affine Transform */
{
&CLSID_D2D12DAffineTransform, L"2D Affine Transform", L"Transform", 1, 1,
L"Applies a 2D affine transform to a bitmap.",
},
/* 1: 3D Perspective Transform */
{
&CLSID_D2D13DPerspectiveTransform, L"3D Perspective Transform", L"Transform", 1, 1,
L"Applies a 3D perspective transform to a bitmap."
},
/* 2: Composite */
{
&CLSID_D2D1Composite, L"Composite", L"Composite", 1, 0xffffffff,
L"Composites foreground and background images using the selected composition mode."
}
- };
Hmm, is it a good idea to add the precise Windows strings to Wine? It might be a violation of copyright. Unless there are application that really depend on those exact strings, I wouldn't strive to replicate them exactly (and, correspondingly, I wouldn't check them exactly). Also, I would avoid mentioning Microsoft as the author, given that it's not. Again, unless there is some application really depending on this, which at least would give as an argument to have the same strings (as I get it, compatibility can be, in some jurisdictions, a good reason for "breaking" copyright).
if (PRIMARYLANGID(GetSystemDefaultLangID()) == LANG_ENGLISH)
{
There are some tests that do not depend on the system language (clsid, cached, precision, input counts, if I am not mistaken). Those tests should be run even if the language is not set to English.
Thanks, Giovanni.