mirror of
https://github.com/adafruit/Adafruit-GFX-Library.git
synced 2026-07-28 04:16:01 +00:00
Optimise fillEllipse function. ~36% faster (#478)
* Optimised fillEllipse function * Cleaned up code
This commit is contained in:
+2
-3
@@ -430,14 +430,13 @@ void Adafruit_GFX::fillEllipse(int16_t x0, int16_t y0, int16_t rw, int16_t rh,
|
||||
|
||||
// region 1
|
||||
while ((twoRh2 * x) < (twoRw2 * y)) {
|
||||
drawFastHLine(x0 - x, y0 + y, 2 * x + 1, color);
|
||||
drawFastHLine(x0 - x, y0 - y, 2 * x + 1, color);
|
||||
|
||||
x++;
|
||||
if (decision < 0) {
|
||||
decision += rh2 + (twoRh2 * x);
|
||||
} else {
|
||||
decision += rh2 + (twoRh2 * x) - (twoRw2 * y);
|
||||
drawFastHLine(x0 - (x - 1), y0 + y, 2 * (x - 1) + 1, color);
|
||||
drawFastHLine(x0 - (x - 1), y0 - y, 2 * (x - 1) + 1, color);
|
||||
y--;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user