Fixed assertion on number of points rendered

This commit is contained in:
Sam Lantinga 2022-01-08 12:28:43 -08:00
parent 4b71962031
commit 5346c93b62
1 changed files with 6 additions and 12 deletions

View File

@ -2832,7 +2832,7 @@ static int plotLineLow(SDL_Renderer *renderer, float x0, float y0, float x1, flo
D = (2 * dy) - dx; D = (2 * dy) - dx;
y = y0; y = y0;
for (x = x0; x <= x1; ++x) { for (render_count = 0, x = x0; x <= x1; ++x, ++render_count) {
tmp->x = x; tmp->x = x;
tmp->y = y; tmp->y = y;
tmp++; tmp++;
@ -2843,12 +2843,9 @@ static int plotLineLow(SDL_Renderer *renderer, float x0, float y0, float x1, flo
D += 2*dy; D += 2*dy;
} }
} }
SDL_assert((tmp - points) == count);
if (draw_last) { if (!draw_last) {
render_count = count; --render_count;
} else {
render_count = count - 1;
} }
if (draw_first) { if (draw_first) {
render_points = points; render_points = points;
@ -2892,7 +2889,7 @@ static int plotLineHigh(SDL_Renderer *renderer, float x0, float y0, float x1, fl
D = (2 * dx) - dy; D = (2 * dx) - dy;
x = x0; x = x0;
for (y = y0; y <= y1; ++y) { for (render_count = 0, y = y0; y <= y1; ++y, ++render_count) {
tmp->x = x; tmp->x = x;
tmp->y = y; tmp->y = y;
tmp++; tmp++;
@ -2903,12 +2900,9 @@ static int plotLineHigh(SDL_Renderer *renderer, float x0, float y0, float x1, fl
D += 2*dx; D += 2*dx;
} }
} }
SDL_assert((tmp - points) == count);
if (draw_last) { if (!draw_last) {
render_count = count; --render_count;
} else {
render_count = count - 1;
} }
if (draw_first) { if (draw_first) {
render_points = points; render_points = points;