Skip to content

Commit

Permalink
Adjust filled circle dimensions to match circle (tuupola#109)
Browse files Browse the repository at this point in the history

Co-authored-by: smarq8 <[email protected]>
  • Loading branch information
tuupola and smarq8 authored Mar 16, 2023
1 parent 42016a8 commit 302b012
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/hagl_circle.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,14 @@ hagl_fill_circle(void const *surface, int16_t x0, int16_t y0, int16_t r, hagl_co
hagl_draw_hline(surface, x0 - x, y0 - y, x * 2, color);
hagl_draw_hline(surface, x0 - y, y0 + x, y * 2, color);
hagl_draw_hline(surface, x0 - y, y0 - x, y * 2, color);
x++;

if (d > 0) {
y--;
d = d + 4 * (x - y) + 10;
} else {
if (d <= 0) {
d = d + 4 * x + 6;
x++;
} else {
d = d + 4 * (x - y) + 10;
x++;
y--;
}
}
}

0 comments on commit 302b012

Please sign in to comment.