Commit ebb99bde authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

d3dx9: Implement getting/setting line width.

parent 2941e518
......@@ -29,6 +29,7 @@ struct d3dx9_line
IDirect3DDevice9 *device;
IDirect3DStateBlock9 *state;
float width;
};
static inline struct d3dx9_line *impl_from_ID3DXLine(ID3DXLine *iface)
......@@ -192,16 +193,25 @@ static float WINAPI d3dx9_line_GetPatternScale(ID3DXLine *iface)
static HRESULT WINAPI d3dx9_line_SetWidth(ID3DXLine *iface, float width)
{
FIXME("iface %p, width %.8e stub!\n", iface, width);
struct d3dx9_line *line = impl_from_ID3DXLine(iface);
return E_NOTIMPL;
TRACE("iface %p, width %.8e.\n", iface, width);
if (width <= 0.0f)
return D3DERR_INVALIDCALL;
line->width = width;
return D3D_OK;
}
static float WINAPI d3dx9_line_GetWidth(ID3DXLine *iface)
{
FIXME("iface %p stub!\n", iface);
struct d3dx9_line *line = impl_from_ID3DXLine(iface);
return 1.0f;
TRACE("iface %p.\n", iface);
return line->width;
}
static HRESULT WINAPI d3dx9_line_SetAntialias(ID3DXLine *iface, BOOL antialias)
......@@ -306,6 +316,7 @@ HRESULT WINAPI D3DXCreateLine(struct IDirect3DDevice9 *device, struct ID3DXLine
object->ref = 1;
object->device = device;
IDirect3DDevice9_AddRef(device);
object->width = 1.0f;
*line = &object->ID3DXLine_iface;
......
......@@ -115,6 +115,38 @@ static void test_create_line(IDirect3DDevice9* device)
ok(ref == 0, "Got %x references to line %p, expected 0\n", ref, line);
}
static void test_line_width(IDirect3DDevice9* device)
{
ID3DXLine *line = NULL;
ULONG refcount;
float width;
HRESULT hr;
hr = D3DXCreateLine(device, &line);
ok(hr == D3D_OK, "Failed to create a line, hr %#x.\n", hr);
width = ID3DXLine_GetWidth(line);
ok(width == 1.0f, "Unexpected line width %.8e.\n", width);
hr = ID3DXLine_SetWidth(line, 0.0f);
ok(hr == D3DERR_INVALIDCALL, "Unexpected hr %#x.\n", hr);
width = ID3DXLine_GetWidth(line);
ok(width == 1.0f, "Unexpected line width %.8e.\n", width);
hr = ID3DXLine_SetWidth(line, -1.0f);
ok(hr == D3DERR_INVALIDCALL, "Unexpected hr %#x.\n", hr);
width = ID3DXLine_GetWidth(line);
ok(width == 1.0f, "Unexpected line width %.8e.\n", width);
hr = ID3DXLine_SetWidth(line, 10.0f);
ok(hr == D3D_OK, "Unexpected hr %#x.\n", hr);
width = ID3DXLine_GetWidth(line);
ok(width == 10.0f, "Unexpected line width %.8e.\n", width);
refcount = ID3DXLine_Release(line);
ok(!refcount, "Got %u references to line.\n", refcount);
}
START_TEST(line)
{
HWND wnd;
......@@ -148,6 +180,7 @@ START_TEST(line)
}
test_create_line(device);
test_line_width(device);
IDirect3DDevice9_Release(device);
IDirect3D9_Release(d3d);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment