mirror of
https://github.com/Relintai/sdl2_frt.git
synced 2025-01-07 18:39:37 +01:00
metal: Fix line drawing, again.
This commit is contained in:
parent
4ea1a10bd2
commit
731a5d1c53
@ -1066,32 +1066,19 @@ METAL_QueueDrawLines(SDL_Renderer * renderer, SDL_RenderCommand *cmd, const SDL_
|
|||||||
angles. Maybe !!! FIXME for later, though. */
|
angles. Maybe !!! FIXME for later, though. */
|
||||||
|
|
||||||
points += count - 2; /* update the last line. */
|
points += count - 2; /* update the last line. */
|
||||||
verts += count - 2;
|
verts += (count * 2) - 2;
|
||||||
|
|
||||||
float xstart = /*0.5f +*/ points[0].x; /* 0.5f to get to the center of the pixel. */
|
const float xstart = points[0].x;
|
||||||
float ystart = /*0.5f +*/ points[0].y;
|
const float ystart = points[0].y;
|
||||||
float xend = /*0.5f +*/ points[1].x;
|
const float xend = points[1].x;
|
||||||
float yend = /*0.5f +*/ points[1].y;
|
const float yend = points[1].y;
|
||||||
|
|
||||||
if (xstart == xend) { /* vertical line */
|
if (ystart == yend) { /* horizontal line */
|
||||||
if (yend > ystart) {
|
verts[0] += (xend > xstart) ? 1.0f : -1.0f;
|
||||||
yend += 1.0f;
|
} else if (xstart == xend) { /* vertical line */
|
||||||
} else {
|
verts[1] += (yend > ystart) ? 1.0f : -1.0f;
|
||||||
ystart += 1.0f;
|
|
||||||
}
|
|
||||||
} else if (ystart == yend) { /* horizontal line */
|
|
||||||
if (xend > xstart) {
|
|
||||||
xend += 1.0f;
|
|
||||||
} else {
|
|
||||||
xstart += 1.0f;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
*(verts++) = xstart;
|
|
||||||
*(verts++) = ystart;
|
|
||||||
*(verts++) = xend;
|
|
||||||
*(verts++) = yend;
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user