Skip to content

Commit 4c89798

Browse files
Optimise fillEllipse function. ~36% faster (#478)
* Optimised fillEllipse function * Cleaned up code
1 parent 9e06b6d commit 4c89798

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

Adafruit_GFX.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -430,14 +430,13 @@ void Adafruit_GFX::fillEllipse(int16_t x0, int16_t y0, int16_t rw, int16_t rh,
430430

431431
// region 1
432432
while ((twoRh2 * x) < (twoRw2 * y)) {
433-
drawFastHLine(x0 - x, y0 + y, 2 * x + 1, color);
434-
drawFastHLine(x0 - x, y0 - y, 2 * x + 1, color);
435-
436433
x++;
437434
if (decision < 0) {
438435
decision += rh2 + (twoRh2 * x);
439436
} else {
440437
decision += rh2 + (twoRh2 * x) - (twoRw2 * y);
438+
drawFastHLine(x0 - (x - 1), y0 + y, 2 * (x - 1) + 1, color);
439+
drawFastHLine(x0 - (x - 1), y0 - y, 2 * (x - 1) + 1, color);
441440
y--;
442441
}
443442
}

0 commit comments

Comments
 (0)