Skip to content

Commit 1418af1

Browse files
committed
Formatting fixes
1 parent ff66950 commit 1418af1

File tree

2 files changed

+22
-23
lines changed

2 files changed

+22
-23
lines changed

Adafruit_GFX.cpp

Lines changed: 18 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -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
/**************************************************************************/
358358
void 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,31 +409,30 @@ 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
/**************************************************************************/
419417
void Adafruit_GFX::fillEllipse(int16_t x0, int16_t y0, int16_t rw, int16_t rh,
420-
uint16_t color) {
418+
uint16_t color) {
421419
#if defined(ESP8266)
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);

Adafruit_GFX.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,10 @@ class Adafruit_GFX : public Print {
7373
void fillCircle(int16_t x0, int16_t y0, int16_t r, uint16_t color);
7474
void fillCircleHelper(int16_t x0, int16_t y0, int16_t r, uint8_t cornername,
7575
int16_t delta, uint16_t color);
76-
void drawEllipse(int16_t x0, int16_t y0, int16_t rw, int16_t rh, uint16_t color);
77-
void fillEllipse(int16_t x0, int16_t y0, int16_t rw, int16_t rh, uint16_t color);
76+
void drawEllipse(int16_t x0, int16_t y0, int16_t rw, int16_t rh,
77+
uint16_t color);
78+
void fillEllipse(int16_t x0, int16_t y0, int16_t rw, int16_t rh,
79+
uint16_t color);
7880
void drawTriangle(int16_t x0, int16_t y0, int16_t x1, int16_t y1, int16_t x2,
7981
int16_t y2, uint16_t color);
8082
void fillTriangle(int16_t x0, int16_t y0, int16_t x1, int16_t y1, int16_t x2,

0 commit comments

Comments
 (0)