adafruit / Adafruit_CircuitPython_ProgressBar

Dynamic progress bar widget for CircuitPython displays
MIT License
6 stars 9 forks source link

Use vectorio instead of bitmap #11

Closed FoamyGuy closed 4 years ago

FoamyGuy commented 4 years ago

This changes the way the progress bar is drawn to use vectorio.Polygon objects. It results is less memory usage.

Running on PyPortal the simpletest with a print mem_alloc() added I get these results:

Current release mpy: mem_alloc 155232

Version from this PR: mem_alloc 15136

Anecdotally it seems like erasing back to 0 progress is faster than before, but I can't be sure.

FoamyGuy commented 4 years ago

These changes would make the library incompatible with Circuit Python version 5.x.

It is probably worth giving some additional thought to this, and perhaps adding backward compatibility that uses the bitmap approach.

FoamyGuy commented 4 years ago

After thinking this over a bit more I think it makes the most sense to keep vectorio out of this ProgressBar library for now.

There are other potential improvements noted in #10 that won't remove compatibility with 5.x versions. Those are better candidates for the short term.

For now I will plan to create a separate library Vector_ProgressBar that will use the vectorio implementation. That way it's available for anyone that wants it, and it won't make the logic in this library more complex