|
2 | 2 |
|
3 | 3 | MIT License |
4 | 4 |
|
5 | | -Copyright (c) 2018-2023 Mika Tuupola |
| 5 | +Copyright (c) 2018-2026 Mika Tuupola |
6 | 6 |
|
7 | 7 | Permission is hereby granted, free of charge, to any person obtaining a copy |
8 | 8 | of this software and associated documentation files (the "Software"), to deal |
@@ -45,6 +45,12 @@ hagl_draw_ellipse(void const *surface, int16_t x0, int16_t y0, int16_t a, int16_ |
45 | 45 | int32_t asq = a * a; |
46 | 46 | int32_t bsq = b * b; |
47 | 47 |
|
| 48 | + /* Zero radius ellipse should output a single pixel */ |
| 49 | + if (0 == a && 0 == b) { |
| 50 | + hagl_put_pixel(surface, x0, y0, color); |
| 51 | + return; |
| 52 | + } |
| 53 | + |
48 | 54 | hagl_put_pixel(surface, x0, y0 + b, color); |
49 | 55 | hagl_put_pixel(surface, x0, y0 - b, color); |
50 | 56 |
|
@@ -118,6 +124,12 @@ hagl_fill_ellipse(void const *surface, int16_t x0, int16_t y0, int16_t a, int16_ |
118 | 124 | int32_t asq = a * a; |
119 | 125 | int32_t bsq = b * b; |
120 | 126 |
|
| 127 | + /* Zero radius ellipse should output a single pixel */ |
| 128 | + if (0 == a && 0 == b) { |
| 129 | + hagl_put_pixel(surface, x0, y0, color); |
| 130 | + return; |
| 131 | + } |
| 132 | + |
121 | 133 | hagl_put_pixel(surface, x0, y0 + b, color); |
122 | 134 | hagl_put_pixel(surface, x0, y0 - b, color); |
123 | 135 |
|
|
0 commit comments