comparison src/video/win32/SDL_d3drender.c @ 3551:4a39f28cd935

Fixed line drawing for D3D
author Sam Lantinga <slouken@libsdl.org>
date Sat, 12 Dec 2009 20:31:28 +0000
parents 686f0e69cd37
children a579694613fd
comparison
equal deleted inserted replaced
3550:6b69c5def097 3551:4a39f28cd935
1010 vertices[i].color = color; 1010 vertices[i].color = color;
1011 vertices[i].u = 0.0f; 1011 vertices[i].u = 0.0f;
1012 vertices[i].v = 0.0f; 1012 vertices[i].v = 0.0f;
1013 } 1013 }
1014 result = 1014 result =
1015 IDirect3DDevice9_DrawPrimitiveUP(data->device, D3DPT_LINESTRIP, count, 1015 IDirect3DDevice9_DrawPrimitiveUP(data->device, D3DPT_LINESTRIP, count-1,
1016 vertices, sizeof(*vertices)); 1016 vertices, sizeof(*vertices));
1017
1018 /* DirectX 9 has the same line rasterization semantics as GDI,
1019 so we need to close the endpoint of the line */
1020 if (points[0].x != points[count-1].x || points[0].y != points[count-1].y) {
1021 vertices[0].x = (float) points[count-1].x;
1022 vertices[0].y = (float) points[count-1].y;
1023 result = IDirect3DDevice9_DrawPrimitiveUP(data->device, D3DPT_POINTLIST, 1, vertices, sizeof(*vertices));
1024 }
1025
1017 SDL_stack_free(vertices); 1026 SDL_stack_free(vertices);
1018 if (FAILED(result)) { 1027 if (FAILED(result)) {
1019 D3D_SetError("DrawPrimitiveUP()", result); 1028 D3D_SetError("DrawPrimitiveUP()", result);
1020 return -1; 1029 return -1;
1021 } 1030 }