# HG changeset patch # User Sam Lantinga # Date 1260649888 0 # Node ID 4a39f28cd9355785879e63b15aef8fb57ca8e017 # Parent 6b69c5def097a3bd90bdfd4533d61b9f8385ff44 Fixed line drawing for D3D diff -r 6b69c5def097 -r 4a39f28cd935 src/video/win32/SDL_d3drender.c --- a/src/video/win32/SDL_d3drender.c Sat Dec 12 20:30:25 2009 +0000 +++ b/src/video/win32/SDL_d3drender.c Sat Dec 12 20:31:28 2009 +0000 @@ -1012,8 +1012,17 @@ vertices[i].v = 0.0f; } result = - IDirect3DDevice9_DrawPrimitiveUP(data->device, D3DPT_LINESTRIP, count, + IDirect3DDevice9_DrawPrimitiveUP(data->device, D3DPT_LINESTRIP, count-1, vertices, sizeof(*vertices)); + + /* DirectX 9 has the same line rasterization semantics as GDI, + so we need to close the endpoint of the line */ + if (points[0].x != points[count-1].x || points[0].y != points[count-1].y) { + vertices[0].x = (float) points[count-1].x; + vertices[0].y = (float) points[count-1].y; + result = IDirect3DDevice9_DrawPrimitiveUP(data->device, D3DPT_POINTLIST, 1, vertices, sizeof(*vertices)); + } + SDL_stack_free(vertices); if (FAILED(result)) { D3D_SetError("DrawPrimitiveUP()", result);