Giovanni Mascellani : d2d1: Implement D2D1SinCos().
Alexandre Julliard
julliard at winehq.org
Mon Oct 26 16:59:42 CDT 2020
Module: wine
Branch: master
Commit: 4f6bd00a8495c80fd6faf940cef09e875bf1a5bc
URL: https://source.winehq.org/git/wine.git/?a=commit;h=4f6bd00a8495c80fd6faf940cef09e875bf1a5bc
Author: Giovanni Mascellani <wine at mascellani.eu>
Date: Mon Oct 26 20:27:27 2020 +0330
d2d1: Implement D2D1SinCos().
Signed-off-by: Giovanni Mascellani <wine at mascellani.eu>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/d2d1/d2d1.spec | 2 +-
dlls/d2d1/factory.c | 8 ++++++++
dlls/d2d1/tests/d2d1.c | 31 +++++++++++++++++++++++++++++++
include/d2d1_1.idl | 1 +
4 files changed, 41 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..943347d7884 100644
--- a/dlls/d2d1/factory.c
+++ b/dlls/d2d1/factory.c
@@ -713,6 +713,14 @@ HRESULT WINAPI D2D1CreateDevice(IDXGIDevice *dxgi_device,
return hr;
}
+void WINAPI D2D1SinCos(float angle, float *s, float *c)
+{
+ TRACE("angle %.8e, s %p, c %p.\n", angle, s, 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..df1df01c051 100644
--- a/dlls/d2d1/tests/d2d1.c
+++ b/dlls/d2d1/tests/d2d1.c
@@ -9425,6 +9425,36 @@ static void test_wic_bitmap_format(void)
DestroyWindow(window);
}
+static void test_math(void)
+{
+ unsigned int i;
+ float s, c;
+
+ static const struct
+ {
+ float x;
+ float s;
+ float c;
+ }
+ sc_data[] =
+ {
+ {0.0f, 0.0f, 1.0f},
+ {1.0f, 8.41470957e-001f, 5.40302277e-001f},
+ {2.0f, 9.09297407e-001f, -4.16146845e-001f},
+ {M_PI / 2.0f, 1.0f, -4.37113883e-008f},
+ {M_PI, -8.74227766e-008f, -1.0f},
+ };
+
+ 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),
+ "Test %u: Got unexpected sin %.8e, expected %.8e.\n", i, s, sc_data[i].s);
+ ok(compare_float(c, sc_data[i].c, 0),
+ "Test %u: Got unexpected cos %.8e, expected %.8e.\n", i, c, sc_data[i].c);
+ }
+}
+
START_TEST(d2d1)
{
unsigned int argc, i;
@@ -9477,6 +9507,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);
More information about the wine-cvs
mailing list