Signed-off-by: Giovanni Mascellani wine@mascellani.eu --- dlls/d2d1/d2d1.spec | 2 +- dlls/d2d1/factory.c | 6 ++++++ dlls/d2d1/tests/d2d1.c | 29 +++++++++++++++++++++++++++++ include/d2d1_1.idl | 1 + 4 files changed, 37 insertions(+), 1 deletion(-)
diff --git a/dlls/d2d1/d2d1.spec b/dlls/d2d1/d2d1.spec index 0ebcd0af553..410abfa5de6 100644 --- a/dlls/d2d1/d2d1.spec +++ b/dlls/d2d1/d2d1.spec @@ -6,6 +6,6 @@ @ stub D2D1ConvertColorSpace @ stdcall D2D1CreateDevice(ptr ptr ptr) @ stub D2D1CreateDeviceContext -@ stub D2D1SinCos +@ stdcall D2D1SinCos(float ptr ptr) @ stub D2D1Tan @ stub D2D1Vec3Length diff --git a/dlls/d2d1/factory.c b/dlls/d2d1/factory.c index 2f50836bbcd..2cce8afc4a4 100644 --- a/dlls/d2d1/factory.c +++ b/dlls/d2d1/factory.c @@ -713,6 +713,12 @@ HRESULT WINAPI D2D1CreateDevice(IDXGIDevice *dxgi_device, return hr; }
+void WINAPI D2D1SinCos(float angle, float *s, float *c) +{ + *s = sinf(angle); + *c = cosf(angle); +} + static BOOL get_config_key_dword(HKEY default_key, HKEY application_key, const char *name, DWORD *value) { DWORD type, data, size; diff --git a/dlls/d2d1/tests/d2d1.c b/dlls/d2d1/tests/d2d1.c index 166cdfccda6..9ec86eac3a5 100644 --- a/dlls/d2d1/tests/d2d1.c +++ b/dlls/d2d1/tests/d2d1.c @@ -9425,6 +9425,34 @@ static void test_wic_bitmap_format(void) DestroyWindow(window); }
+static void test_math(void) +{ + float s, c; + int i; + + static const struct + { + float x; + float s; + float c; + } + sc_data[] = + { + {0.0, 0.0, 1.0}, + {1.0, 8.41470957e-001, 5.40302277e-001}, + {2.0, 9.09297407e-001, -4.16146845e-001}, + {M_PI / 2.0, 1.0, -4.37113883e-008}, + {M_PI, -8.74227766e-008, -1.0}, + }; + + for (i = 0; i < ARRAY_SIZE(sc_data); ++i) + { + D2D1SinCos(sc_data[i].x, &s, &c); + ok(compare_float(s, sc_data[i].s, 0), "Wrong sin(%.8e) (%.8e instead of %.8e).\n", sc_data[i].x, s, sc_data[i].s); + ok(compare_float(c, sc_data[i].c, 0), "Wrong cos(%.8e) (%.8e instead of %.8e).\n", sc_data[i].x, c, sc_data[i].c); + } +} + START_TEST(d2d1) { unsigned int argc, i; @@ -9477,6 +9505,7 @@ START_TEST(d2d1) queue_test(test_max_bitmap_size); queue_test(test_dpi); queue_test(test_wic_bitmap_format); + queue_test(test_math);
run_queued_tests(); } diff --git a/include/d2d1_1.idl b/include/d2d1_1.idl index ddb7669c24b..6fa893edbda 100644 --- a/include/d2d1_1.idl +++ b/include/d2d1_1.idl @@ -794,3 +794,4 @@ interface ID2D1Factory1 : ID2D1Factory
[local] HRESULT __stdcall D2D1CreateDevice(IDXGIDevice *dxgi_device, const D2D1_CREATION_PROPERTIES *creation_properties, ID2D1Device **device); +[local] void __stdcall D2D1SinCos(float angle, float *s, float *c);
Signed-off-by: Giovanni Mascellani wine@mascellani.eu --- dlls/d2d1/d2d1.spec | 2 +- dlls/d2d1/factory.c | 5 +++++ dlls/d2d1/tests/d2d1.c | 22 +++++++++++++++++++++- include/d2d1_1.idl | 1 + 4 files changed, 28 insertions(+), 2 deletions(-)
diff --git a/dlls/d2d1/d2d1.spec b/dlls/d2d1/d2d1.spec index 410abfa5de6..7b624c7096e 100644 --- a/dlls/d2d1/d2d1.spec +++ b/dlls/d2d1/d2d1.spec @@ -7,5 +7,5 @@ @ stdcall D2D1CreateDevice(ptr ptr ptr) @ stub D2D1CreateDeviceContext @ stdcall D2D1SinCos(float ptr ptr) -@ stub D2D1Tan +@ stdcall D2D1Tan(float) @ stub D2D1Vec3Length diff --git a/dlls/d2d1/factory.c b/dlls/d2d1/factory.c index 2cce8afc4a4..d21520bb8c3 100644 --- a/dlls/d2d1/factory.c +++ b/dlls/d2d1/factory.c @@ -719,6 +719,11 @@ void WINAPI D2D1SinCos(float angle, float *s, float *c) *c = cosf(angle); }
+float WINAPI D2D1Tan(float angle) +{ + return tanf(angle); +} + static BOOL get_config_key_dword(HKEY default_key, HKEY application_key, const char *name, DWORD *value) { DWORD type, data, size; diff --git a/dlls/d2d1/tests/d2d1.c b/dlls/d2d1/tests/d2d1.c index 9ec86eac3a5..2bad058feb1 100644 --- a/dlls/d2d1/tests/d2d1.c +++ b/dlls/d2d1/tests/d2d1.c @@ -9427,7 +9427,7 @@ static void test_wic_bitmap_format(void)
static void test_math(void) { - float s, c; + float s, c, t; int i;
static const struct @@ -9445,12 +9445,32 @@ static void test_math(void) {M_PI, -8.74227766e-008, -1.0}, };
+ static const struct + { + float x; + float t; + } + t_data[] = + { + {0.0, 0.0}, + {1.0, 1.55740774}, + {2.0, -2.18503976}, + {M_PI / 2.0, -2.28773320e+007}, + {M_PI, 8.74227766e-008}, + }; + for (i = 0; i < ARRAY_SIZE(sc_data); ++i) { D2D1SinCos(sc_data[i].x, &s, &c); ok(compare_float(s, sc_data[i].s, 0), "Wrong sin(%.8e) (%.8e instead of %.8e).\n", sc_data[i].x, s, sc_data[i].s); ok(compare_float(c, sc_data[i].c, 0), "Wrong cos(%.8e) (%.8e instead of %.8e).\n", sc_data[i].x, c, sc_data[i].c); } + + for (i = 0; i < ARRAY_SIZE(t_data); ++i) + { + t = D2D1Tan(t_data[i].x); + ok(compare_float(t, t_data[i].t, 1), "Wrong tan(%.8e) (%.8e instead of %.8e).\n", t_data[i].x, t, t_data[i].t); + } }
START_TEST(d2d1) diff --git a/include/d2d1_1.idl b/include/d2d1_1.idl index 6fa893edbda..bd111bd6628 100644 --- a/include/d2d1_1.idl +++ b/include/d2d1_1.idl @@ -795,3 +795,4 @@ interface ID2D1Factory1 : ID2D1Factory [local] HRESULT __stdcall D2D1CreateDevice(IDXGIDevice *dxgi_device, const D2D1_CREATION_PROPERTIES *creation_properties, ID2D1Device **device); [local] void __stdcall D2D1SinCos(float angle, float *s, float *c); +[local] float __stdcall D2D1Tan(float angle);
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=80953
Your paranoid android.
=== w2008s64 (32 bit report) ===
d2d1: d2d1: Timeout
=== w2008s64 (64 bit report) ===
d2d1: d2d1: Timeout
Signed-off-by: Giovanni Mascellani wine@mascellani.eu --- dlls/d2d1/d2d1.spec | 2 +- dlls/d2d1/factory.c | 5 +++++ dlls/d2d1/tests/d2d1.c | 26 +++++++++++++++++++++++++- include/d2d1_1.idl | 1 + 4 files changed, 32 insertions(+), 2 deletions(-)
diff --git a/dlls/d2d1/d2d1.spec b/dlls/d2d1/d2d1.spec index 7b624c7096e..0ae894109fb 100644 --- a/dlls/d2d1/d2d1.spec +++ b/dlls/d2d1/d2d1.spec @@ -8,4 +8,4 @@ @ stub D2D1CreateDeviceContext @ stdcall D2D1SinCos(float ptr ptr) @ stdcall D2D1Tan(float) -@ stub D2D1Vec3Length +@ stdcall D2D1Vec3Length(float float float) diff --git a/dlls/d2d1/factory.c b/dlls/d2d1/factory.c index d21520bb8c3..e1a6191dfa9 100644 --- a/dlls/d2d1/factory.c +++ b/dlls/d2d1/factory.c @@ -724,6 +724,11 @@ float WINAPI D2D1Tan(float angle) return tanf(angle); }
+float WINAPI D2D1Vec3Length(float x, float y, float z) +{ + return sqrtf(x * x + y * y + z * z); +} + static BOOL get_config_key_dword(HKEY default_key, HKEY application_key, const char *name, DWORD *value) { DWORD type, data, size; diff --git a/dlls/d2d1/tests/d2d1.c b/dlls/d2d1/tests/d2d1.c index 2bad058feb1..7957866a040 100644 --- a/dlls/d2d1/tests/d2d1.c +++ b/dlls/d2d1/tests/d2d1.c @@ -9427,7 +9427,7 @@ static void test_wic_bitmap_format(void)
static void test_math(void) { - float s, c, t; + float s, c, t, l; int i;
static const struct @@ -9459,6 +9459,23 @@ static void test_math(void) {M_PI, 8.74227766e-008}, };
+ static const struct { + float x; + float y; + float z; + float l; + } + l_data[] = + { + {0.0, 0.0, 0.0, 0.0}, + {1.0, 0.0, 0.0, 1.0}, + {0.0, 1.0, 0.0, 1.0}, + {0.0, 0.0, 1.0, 1.0}, + {1.0, 1.0, 1.0, 1.73205078}, + {1.0, 2.0, 2.0, 3.0}, + {1.0, 2.0, 3.0, 3.74165750}, + }; + for (i = 0; i < ARRAY_SIZE(sc_data); ++i) { D2D1SinCos(sc_data[i].x, &s, &c); @@ -9471,6 +9488,13 @@ static void test_math(void) t = D2D1Tan(t_data[i].x); ok(compare_float(t, t_data[i].t, 1), "Wrong tan(%.8e) (%.8e instead of %.8e).\n", t_data[i].x, t, t_data[i].t); } + + for (i = 0; i < ARRAY_SIZE(l_data); ++i) + { + l = D2D1Vec3Length(l_data[i].x, l_data[i].y, l_data[i].z); + ok(compare_float(l, l_data[i].l, 0), "Wrong len(%.8e, %.8e, %.8e) (%.8e instead of %.8e).\n", + l_data[i].x, l_data[i].y, l_data[i].z, l, l_data[i].l); + } }
START_TEST(d2d1) diff --git a/include/d2d1_1.idl b/include/d2d1_1.idl index bd111bd6628..6eab3959cd1 100644 --- a/include/d2d1_1.idl +++ b/include/d2d1_1.idl @@ -796,3 +796,4 @@ interface ID2D1Factory1 : ID2D1Factory const D2D1_CREATION_PROPERTIES *creation_properties, ID2D1Device **device); [local] void __stdcall D2D1SinCos(float angle, float *s, float *c); [local] float __stdcall D2D1Tan(float angle); +[local] float __stdcall D2D1Vec3Length(float x, float y, float z);
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=80954
Your paranoid android.
=== w2008s64 (32 bit report) ===
d2d1: d2d1: Timeout
=== w2008s64 (64 bit report) ===
d2d1: d2d1: Timeout
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=80952
Your paranoid android.
=== w2008s64 (32 bit report) ===
d2d1: d2d1: Timeout
=== w2008s64 (64 bit report) ===
d2d1: d2d1: Timeout