d2d1: Implement D2D1Tan().

Signed-off-by: Giovanni Mascellani <wine@mascellani.eu>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Giovanni Mascellani 2020-10-26 20:09:28 +03:30 committed by Alexandre Julliard
parent 4f6bd00a84
commit 9cf8fab952
4 changed files with 31 additions and 2 deletions

View File

@ -7,5 +7,5 @@
@ stdcall D2D1CreateDevice(ptr ptr ptr)
@ stub D2D1CreateDeviceContext
@ stdcall D2D1SinCos(float ptr ptr)
@ stub D2D1Tan
@ stdcall D2D1Tan(float)
@ stub D2D1Vec3Length

View File

@ -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;

View File

@ -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)

View File

@ -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);