Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Fixed line drawing for D3D
Browse files Browse the repository at this point in the history
  • Loading branch information
slouken committed Dec 12, 2009
1 parent 0031bda commit 0176e3e
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/video/win32/SDL_d3drender.c
Expand Up @@ -1012,8 +1012,17 @@ D3D_RenderLines(SDL_Renderer * renderer, const SDL_Point * points, int count)
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);
Expand Down

0 comments on commit 0176e3e

Please sign in to comment.