@@ -350,33 +350,31 @@ void Adafruit_GFX::drawLine(int16_t x0, int16_t y0, int16_t x1, int16_t y1,
350350 @brief Draw an ellipse outline
351351 @param x0 Center-point x coordinate
352352 @param y0 Center-point y coordinate
353- @param rw Horizontal width of ellipse
354- @param rh Vertical height of ellipse
353+ @param rw Horizontal radius of ellipse
354+ @param rh Vertical radius of ellipse
355355 @param color 16-bit 5-6-5 Color to draw with
356356*/
357357/* *************************************************************************/
358358void Adafruit_GFX::drawEllipse (int16_t x0, int16_t y0, int16_t rw, int16_t rh,
359- uint16_t color) {
359+ uint16_t color) {
360360#if defined(ESP8266)
361361 yield ();
362362#endif
363363 // Bresenham's ellipse algorithm
364-
365364 int16_t x = 0 , y = rh;
366365 int32_t rw2 = rw * rw, rh2 = rh * rh;
367366 int32_t twoRw2 = 2 * rw2, twoRh2 = 2 * rh2;
368367
369- int32_t decision = rh2 - (rw2 * rh) + (rw2/ 4 );
368+ int32_t decision = rh2 - (rw2 * rh) + (rw2 / 4 );
370369
371370 startWrite ();
372371
373- // region 1
372+ // region 1
374373 while ((twoRh2 * x) < (twoRw2 * y)) {
375374 writePixel (x0 + x, y0 + y, color);
376375 writePixel (x0 - x, y0 + y, color);
377376 writePixel (x0 + x, y0 - y, color);
378377 writePixel (x0 - x, y0 - y, color);
379-
380378 x++;
381379 if (decision < 0 ) {
382380 decision += rh2 + (twoRh2 * x);
@@ -386,14 +384,14 @@ void Adafruit_GFX::drawEllipse(int16_t x0, int16_t y0, int16_t rw, int16_t rh,
386384 }
387385 }
388386
389- // region 2
390- decision = ((rh2 * (2 * x + 1 ) * (2 * x + 1 )) >> 2 ) + (rw2 * (y - 1 ) * (y - 1 )) - (rw2 * rh2);
387+ // region 2
388+ decision = ((rh2 * (2 * x + 1 ) * (2 * x + 1 )) >> 2 ) +
389+ (rw2 * (y - 1 ) * (y - 1 )) - (rw2 * rh2);
391390 while (y >= 0 ) {
392391 writePixel (x0 + x, y0 + y, color);
393392 writePixel (x0 - x, y0 + y, color);
394393 writePixel (x0 + x, y0 - y, color);
395394 writePixel (x0 - x, y0 - y, color);
396-
397395 y--;
398396 if (decision > 0 ) {
399397 decision += rw2 - (twoRw2 * y);
@@ -411,8 +409,8 @@ void Adafruit_GFX::drawEllipse(int16_t x0, int16_t y0, int16_t rw, int16_t rh,
411409 @brief Draw an ellipse with filled colour
412410 @param x0 Center-point x coordinate
413411 @param y0 Center-point y coordinate
414- @param rw Horizontal width of ellipse
415- @param rh Vertical height of ellipse
412+ @param rw Horizontal radius of ellipse
413+ @param rh Vertical radius of ellipse
416414 @param color 16-bit 5-6-5 Color to draw with
417415*/
418416/* *************************************************************************/
@@ -422,20 +420,19 @@ void Adafruit_GFX::fillEllipse(int16_t x0, int16_t y0, int16_t rw, int16_t rh,
422420 yield ();
423421#endif
424422 // Bresenham's ellipse algorithm
425-
426423 int16_t x = 0 , y = rh;
427424 int32_t rw2 = rw * rw, rh2 = rh * rh;
428425 int32_t twoRw2 = 2 * rw2, twoRh2 = 2 * rh2;
429426
430- int32_t decision = rh2 - (rw2 * rh) + (rw2/ 4 );
427+ int32_t decision = rh2 - (rw2 * rh) + (rw2 / 4 );
431428
432429 startWrite ();
433430
434- // region 1
431+ // region 1
435432 while ((twoRh2 * x) < (twoRw2 * y)) {
436433 drawFastHLine (x0 - x, y0 + y, 2 * x + 1 , color);
437434 drawFastHLine (x0 - x, y0 - y, 2 * x + 1 , color);
438-
435+
439436 x++;
440437 if (decision < 0 ) {
441438 decision += rh2 + (twoRh2 * x);
@@ -445,13 +442,13 @@ void Adafruit_GFX::fillEllipse(int16_t x0, int16_t y0, int16_t rw, int16_t rh,
445442 }
446443 }
447444
448- // region 2
449- decision = ((rh2 * (2 * x + 1 ) * (2 * x + 1 )) >> 2 ) + (rw2 * (y - 1 ) * (y - 1 )) - (rw2 * rh2);
445+ // region 2
446+ decision = ((rh2 * (2 * x + 1 ) * (2 * x + 1 )) >> 2 ) +
447+ (rw2 * (y - 1 ) * (y - 1 )) - (rw2 * rh2);
450448 while (y >= 0 ) {
451-
452449 drawFastHLine (x0 - x, y0 + y, 2 * x + 1 , color);
453450 drawFastHLine (x0 - x, y0 - y, 2 * x + 1 , color);
454-
451+
455452 y--;
456453 if (decision > 0 ) {
457454 decision += rw2 - (twoRw2 * y);
0 commit comments