adafruit / Adafruit-GFX-Library

Adafruit GFX graphics core Arduino library, this is the 'core' class that all our other graphics libraries derive from
https://learn.adafruit.com/adafruit-gfx-graphics-library
Other
2.41k stars 1.55k forks source link

Add new method drawBitmapFast with better performance #458

Open jsseab opened 3 months ago

jsseab commented 3 months ago

Added a new method drawBitmapFast in Adafruit_SPITFT which is esentially a copy of the Adafruit_GFX drawBitmap but with much better performance. This is achieved by setting up the address window for the whole image; not for each pixel.

Performance is about 8 times higher.

The method applies clipping so that only the portion of the image that is within the display bounds is written.

Code has been tested with various X/Y offsets to verify that clipping is properly applied.

Note that I was forced to create a copy because of the stated limitations of Adafruit_GFX. I would rather change the Adafruit_GFX method, but that would require adding some abstract methods (e.g. for setting up the window) which would break backward compatibility.

This change is related to this issue: https://github.com/adafruit/Adafruit-GFX-Library/issues/415