Giovanni Mascellani : d2d1: Implement D2D1Tan().

Alexandre Julliard julliard at winehq.org
Mon Oct 26 16:59:42 CDT 2020


Module: wine
Branch: master
Commit: 9cf8fab9528f9e6bffd6d96073de2e0c919bd957
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=9cf8fab9528f9e6bffd6d96073de2e0c919bd957

Author: Giovanni Mascellani <wine at mascellani.eu>
Date:   Mon Oct 26 20:27:28 2020 +0330

d2d1: Implement D2D1Tan().

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    |  7 +++++++
 dlls/d2d1/tests/d2d1.c | 23 ++++++++++++++++++++++-
 include/d2d1_1.idl     |  1 +
 4 files changed, 31 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 943347d7884..9c5337590cd 100644
--- a/dlls/d2d1/factory.c
+++ b/dlls/d2d1/factory.c
@@ -721,6 +721,13 @@ void WINAPI D2D1SinCos(float angle, float *s, float *c)
     *c = cosf(angle);
 }
 
+float WINAPI D2D1Tan(float angle)
+{
+    TRACE("angle %.8e.\n", 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 df1df01c051..b269770365f 100644
--- a/dlls/d2d1/tests/d2d1.c
+++ b/dlls/d2d1/tests/d2d1.c
@@ -9428,7 +9428,7 @@ static void test_wic_bitmap_format(void)
 static void test_math(void)
 {
     unsigned int i;
-    float s, c;
+    float s, c, t;
 
     static const struct
     {
@@ -9445,6 +9445,20 @@ static void test_math(void)
         {M_PI,        -8.74227766e-008f, -1.0f},
     };
 
+    static const struct
+    {
+        float x;
+        float t;
+    }
+    t_data[] =
+    {
+        {0.0f,         0.0f},
+        {1.0f,         1.55740774f},
+        {2.0f,        -2.18503976f},
+        {M_PI / 2.0f, -2.28773320e+007f},
+        {M_PI,         8.74227766e-008f},
+    };
+
     for (i = 0; i < ARRAY_SIZE(sc_data); ++i)
     {
         D2D1SinCos(sc_data[i].x, &s, &c);
@@ -9453,6 +9467,13 @@ static void test_math(void)
         ok(compare_float(c, sc_data[i].c, 0),
                 "Test %u: Got unexpected cos %.8e, expected %.8e.\n", i, 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),
+                "Test %u: Got unexpected tan %.8e, expected %.8e.\n", i, 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);




More information about the wine-cvs mailing list