Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GFX lib with font, canvas, and drawBitmap() runs slow #415

Open
norbinz opened this issue Feb 13, 2023 · 2 comments
Open

GFX lib with font, canvas, and drawBitmap() runs slow #415

norbinz opened this issue Feb 13, 2023 · 2 comments

Comments

@norbinz
Copy link

norbinz commented Feb 13, 2023

I breadboarded an Adafruit 3677 (ItsyBitsy 32u4 5V) with an Adafruit 4383 (240x135 LCD ST7789).
I'm seeing very slow run-time of the GFX library's drawBitmap().
In the Adafruit forum I asked what's the reason for the slowness, and does the library offer a faster alternative?
I shared a demonstration sketch that includes the slow drawBitmap(), and a faster code that I whipped up.
A support (?) fellow suggested that I ask on github.
Here's the forum discussion:
https://forums.adafruit.com/viewtopic.php?p=960409

I understand that the GFX lib has a Prime Directive, but I'm not sure if that applies here.

@norbinz
Copy link
Author

norbinz commented Feb 14, 2023

Oops, broken URL. Trying again:
https://forums.adafruit.com/viewtopic.php?p=960155

@jsseab
Copy link

jsseab commented Aug 14, 2024

I noticed this problem too. I have an application that draws a canvas that is 141 x 19 pixels, and this takes around 183 ms with an ATMega644 running at 10 MHz (it's a custom Arduino-compatible board).

I looked at the implementation and realized one big factor is how each pixel write is done with an address window that is 1x1 pixels. This is obviously not a very good idea. A much better implementation is to setup the whole window first, then just write all pixels in sequence.

I changed the code and got about 23 ms execution time (8 times faster!). I will try and submit a pull request for this, but I am a little unsure of exactly how to implement the change due to the class hierarchy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants